LT_ALIGN = 1,
LT_ALIGNPOSSIBLE,
LT_ARGUMENT,
+ LT_AUTONESTS,
+ LT_AUTONESTEDBY,
LT_MARGIN,
LT_BOTTOMSEP,
LT_CATEGORY,
LT_LATEXTYPE,
LT_LEFTDELIM,
LT_LEFTMARGIN,
+ LT_NEED_CPROTECT,
LT_NEED_PROTECT,
LT_NEWLINE,
LT_NEXTNOINDENT,
- LT_NESTS,
LT_PAR_GROUP,
LT_PARINDENT,
LT_PARSEP,
/////////////////////
Layout::Layout()
- : add_to_toc_(false), is_toc_caption_(false)
+ : add_to_toc_(false), is_toc_caption_(true)
{
unknown_ = false;
margintype = MARGIN_STATIC;
intitle = false;
inpreamble = false;
needprotect = false;
+ needcprotect = false;
keepempty = false;
font = inherit_font;
labelfont = inherit_font;
{ "align", LT_ALIGN },
{ "alignpossible", LT_ALIGNPOSSIBLE },
{ "argument", LT_ARGUMENT },
+ { "autonests", LT_AUTONESTS },
{ "babelpreamble", LT_BABELPREAMBLE },
{ "bottomsep", LT_BOTTOMSEP },
{ "category", LT_CATEGORY },
{ "innertag", LT_INNERTAG },
{ "inpreamble", LT_INPREAMBLE },
{ "intitle", LT_INTITLE },
+ { "isautonestedby", LT_AUTONESTEDBY },
{ "istoccaption", LT_ISTOCCAPTION },
{ "itemcommand", LT_ITEMCOMMAND },
{ "itemsep", LT_ITEMSEP },
{ "leftdelim", LT_LEFTDELIM },
{ "leftmargin", LT_LEFTMARGIN },
{ "margin", LT_MARGIN },
+ { "needcprotect", LT_NEED_CPROTECT },
{ "needprotect", LT_NEED_PROTECT },
- { "nests", LT_NESTS },
{ "newline", LT_NEWLINE },
{ "nextnoindent", LT_NEXTNOINDENT },
{ "obsoletedby", LT_OBSOLETEDBY },
latexargs_.clear();
itemargs_.clear();
postcommandargs_.clear();
+ listpreamble_.clear();
}
break;
lex >> needprotect;
break;
+ case LT_NEED_CPROTECT:
+ lex >> needcprotect;
+ break;
+
case LT_KEEPEMPTY:
lex >> keepempty;
break;
break;
}
- case LT_NESTS: {
- docstring const nest = subst(subst(subst(lex.getLongString(from_ascii("EndNests")),
- from_ascii("\n"), docstring()),
- from_ascii(" "), docstring()),
- from_ascii("\t"), docstring());
- vector<docstring> const nests =
- getVectorFromString(nest);
- nests_.insert(nests.begin(), nests.end());
+ case LT_AUTONESTS: {
+ docstring autonest = lex.getLongString(from_ascii("EndAutoNests"));
+ autonest = subst(autonest, from_ascii("\n"), docstring());
+ autonest = subst(autonest, from_ascii("\t"), docstring());
+ autonest = subst(autonest, from_ascii("\""), docstring());
+ autonest = subst(autonest, '_', ' ');
+ vector<docstring> const autonests =
+ getVectorFromString(autonest, from_ascii(","), false, true);
+ autonests_.insert(autonests.begin(), autonests.end());
+ break;
+ }
+
+ case LT_AUTONESTEDBY: {
+ docstring autonest = lex.getLongString(from_ascii("EndIsAutoNestedBy"));
+ autonest = subst(autonest, from_ascii("\n"), docstring());
+ autonest = subst(autonest, from_ascii("\t"), docstring());
+ autonest = subst(autonest, from_ascii("\""), docstring());
+ autonest = subst(autonest, '_', ' ');
+ vector<docstring> const autonests =
+ getVectorFromString(autonest, from_ascii(","), false, true);
+ autonested_by_.insert(autonests.begin(), autonests.end());
break;
}
latexarg arg;
// writeArgument() makes use of these default values
arg.mandatory = false;
+ arg.nodelims = false;
arg.autoinsert = false;
arg.insertcotext = false;
bool error = false;
lex >> id;
bool const itemarg = prefixIs(id, "item:");
bool const postcmd = prefixIs(id, "post:");
+ bool const listpreamble = prefixIs(id, "listpreamble:");
while (!finished && lex.isOK() && !error) {
lex.next();
itemargs_[id] = arg;
else if (postcmd)
postcommandargs_[id] = arg;
- else
+ else if (listpreamble) {
+ // list preamble has no delimiters by default
+ arg.nodelims = true;
+ listpreamble_[id] = arg;
+ } else
latexargs_[id] = arg;
}
for (LaTeXArgMap::const_iterator it = postcommandargs_.begin();
it != postcommandargs_.end(); ++it)
writeArgument(os, it->first, it->second);
+ for (LaTeXArgMap::const_iterator it = listpreamble_.begin();
+ it != listpreamble_.end(); ++it)
+ writeArgument(os, it->first, it->second);
os << "\tNeedProtect " << needprotect << "\n"
+ "\tNeedCProtect " << needcprotect << "\n"
"\tKeepEmpty " << keepempty << '\n';
if (labelfont == font)
lyxWrite(os, font, "Font", 1);
}
os << '\n';
}
- if (!nests_.empty()) {
- os << "\tNests\n\t";
- for (set<docstring>::const_iterator it = nests_.begin();
- it != nests_.end(); ++it) {
- if (it != nests_.begin())
+ if (!autonests_.empty()) {
+ os << "\tAutoNests\n\t";
+ for (set<docstring>::const_iterator it = autonests_.begin();
+ it != autonests_.end(); ++it) {
+ if (it != autonests_.begin())
+ os << ',';
+ os << to_utf8(*it);
+ }
+ os << "\n\tEndAutoNests\n";
+ }
+ if (!autonested_by_.empty()) {
+ os << "\tIsAutoNestedBy\n\t\t";
+ for (set<docstring>::const_iterator it = autonested_by_.begin();
+ it != autonested_by_.end(); ++it) {
+ if (it != autonested_by_.begin())
os << ',';
os << to_utf8(*it);
}
- os << "\n\tEndNests\n";
+ os << "\n\tEndIsAutoNestedBy\n";
}
if (refprefix.empty())
os << "\tRefPrefix OFF\n";
bool Layout::hasArgs() const
{
return !latexargs_.empty() || !postcommandargs_.empty() ||
- !itemargs_.empty();
+ !itemargs_.empty() || !listpreamble_.empty();
}
LaTeXArgMap args = latexargs_;
if (!postcommandargs_.empty())
args.insert(postcommandargs_.begin(), postcommandargs_.end());
+ if (!listpreamble_.empty())
+ args.insert(listpreamble_.begin(), listpreamble_.end());
if (!itemargs_.empty())
args.insert(itemargs_.begin(), itemargs_.end());
return args;