#include <fstream>
#include <sstream>
+#ifdef ERROR
+#undef ERROR
+#endif
+
using namespace std;
using namespace lyx::support;
};
// Keep the changes documented in the Customization manual.
-int const FORMAT = 16;
+int const FORMAT = 20;
bool layout2layout(FileName const & filename, FileName const & tempfile)
TC_OUTPUTFORMAT,
TC_INPUT,
TC_STYLE,
+ TC_IFSTYLE,
TC_DEFAULTSTYLE,
TC_INSETLAYOUT,
TC_NOSTYLE,
TC_RIGHTMARGIN,
TC_FLOAT,
TC_COUNTER,
+ TC_IFCOUNTER,
TC_NOFLOAT,
TC_TITLELATEXNAME,
TC_TITLELATEXTYPE,
{ "float", TC_FLOAT },
{ "format", TC_FORMAT },
{ "htmlpreamble", TC_HTMLPREAMBLE },
+ { "ifcounter", TC_IFCOUNTER },
+ { "ifstyle", TC_IFSTYLE },
{ "input", TC_INPUT },
{ "insetlayout", TC_INSETLAYOUT },
{ "leftmargin", TC_LEFTMARGIN },
break;
}
+ // used below to track whether we are in an IfStyle or IfCounter tag.
+ bool ifstyle = false;
+ bool ifcounter = false;
+
switch (static_cast<TextClassTags>(le)) {
case TC_FORMAT:
}
break;
+ case TC_IFSTYLE:
+ ifstyle = true;
+ // fall through
case TC_STYLE: {
if (!lexrc.next()) {
lexrc.printError("No name given for style: `$$Token'.");
} else if (hasLayout(name)) {
Layout & lay = operator[](name);
error = !readStyle(lexrc, lay);
- } else {
+ } else if (!ifstyle) {
Layout layout;
layout.setName(name);
error = !readStyle(lexrc, layout);
defaultlayout_ = name;
}
}
+ else {
+ // scan the rest and discard it
+ Layout lay;
+ readStyle(lexrc, lay);
+ error = false;
+ }
+
+ // reset flag
+ ifstyle = false;
break;
}
readFloat(lexrc);
break;
+ case TC_IFCOUNTER:
+ ifcounter = true;
case TC_COUNTER:
if (lexrc.next()) {
docstring const name = lexrc.getDocString();
// and discard it.
c.read(lexrc);
} else
- error = !counters_.read(lexrc, name);
+ error = !counters_.read(lexrc, name, !ifcounter);
}
else {
lexrc.printError("No name given for style: `$$Token'.");
error = true;
}
+ // reset flag
+ ifcounter = false;
break;
case TC_TITLELATEXTYPE:
FT_BUILTIN,
FT_HTMLSTYLE,
FT_HTMLCLASS,
- FT_HTMLTYPE,
+ FT_HTMLTAG,
FT_END
};
{ "guiname", FT_NAME },
{ "htmlclass", FT_HTMLCLASS },
{ "htmlstyle", FT_HTMLSTYLE },
- { "htmltype", FT_HTMLTYPE },
+ { "htmltag", FT_HTMLTAG },
{ "latexbuiltin", FT_BUILTIN },
{ "listname", FT_LISTNAME },
{ "numberwithin", FT_WITHIN },
string ext;
string htmlclass;
string htmlstyle;
- string htmltype;
+ string htmltag;
string listName;
string name;
string placement;
lexrc.next();
htmlstyle = lexrc.getLongString("EndHTMLStyle");
break;
- case FT_HTMLTYPE:
+ case FT_HTMLTAG:
lexrc.next();
- htmltype = lexrc.getString();
+ htmltag = lexrc.getString();
break;
case FT_END:
getout = true;
// Here if have a full float if getout == true
if (getout) {
Floating fl(type, placement, ext, within, style, name,
- listName, htmltype, htmlclass, htmlstyle, builtin);
+ listName, htmltag, htmlclass, htmlstyle, builtin);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
LayoutModuleList::const_iterator en = modlist.end();
for (; it != en; it++) {
string const modName = *it;
- LyXModule * lm = moduleList[modName];
+ LyXModule * lm = theModuleList[modName];
if (!lm) {
docstring const msg =
bformat(_("The module %1$s has been requested by\n"