LT_REFPREFIX,
LT_RESETARGS,
LT_RIGHTDELIM,
+ LT_FORCELOCAL,
LT_INTITLE // keep this last!
};
htmlforcecss_ = false;
htmltitle_ = false;
spellcheck = true;
+ forcelocal = 0;
itemcommand_ = "item";
}
bool Layout::read(Lexer & lex, TextClass const & tclass)
+{
+ // If this is an empty layout, or if no force local version is set,
+ // we know that we will not discard the stuff to read
+ if (forcelocal == 0)
+ return readIgnoreForcelocal(lex, tclass);
+ Layout tmp(*this);
+ tmp.forcelocal = 0;
+ bool const ret = tmp.readIgnoreForcelocal(lex, tclass);
+ // Keep the stuff if
+ // - the read version is higher
+ // - both versions are infinity (arbitrary decision)
+ // - the file did not contain any local version (needed for not
+ // skipping user defined local layouts)
+ if (tmp.forcelocal <= 0 || tmp.forcelocal > forcelocal)
+ *this = tmp;
+ return ret;
+}
+
+
+bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
{
// This table is sorted alphabetically [asierra 30March96]
LexerKeyword layoutTags[] = {
{ "endlabelstring", LT_ENDLABELSTRING },
{ "endlabeltype", LT_ENDLABELTYPE },
{ "font", LT_FONT },
+ { "forcelocal", LT_FORCELOCAL },
{ "freespacing", LT_FREE_SPACING },
{ "htmlattr", LT_HTMLATTR },
{ "htmlforcecss", LT_HTMLFORCECSS },
case LT_SPELLCHECK:
lex >> spellcheck;
break;
+
+ case LT_FORCELOCAL:
+ lex >> forcelocal;
+ break;
}
}
lex.popTable();
void Layout::readEndLabelType(Lexer & lex)
{
+ // this should be const, but can't be because
+ // of PushPopHelper.
static LexerKeyword endlabelTypeTags[] = {
{ "box", END_LABEL_BOX },
{ "filled_box", END_LABEL_FILLED_BOX },
if (!preamble_.empty())
os << "\tPreamble\n\t"
<< to_utf8(subst(rtrim(preamble_, "\n"),
- from_ascii("\n"), from_ascii("\n\t")))
+ from_ascii("\n"), from_ascii("\n\t")))
<< "\n\tEndPreamble\n";
if (!langpreamble_.empty())
os << "\tLangPreamble\n\t"
<< to_utf8(subst(rtrim(langpreamble_, "\n"),
- from_ascii("\n"), from_ascii("\n\t")))
+ from_ascii("\n"), from_ascii("\n\t")))
<< "\n\tEndLangPreamble\n";
if (!babelpreamble_.empty())
os << "\tBabelPreamble\n\t"
<< to_utf8(subst(rtrim(babelpreamble_, "\n"),
- from_ascii("\n"), from_ascii("\n\t")))
+ from_ascii("\n"), from_ascii("\n\t")))
<< "\n\tEndBabelPreamble\n";
switch (labeltype) {
case LABEL_ABOVE:
<< "\n\tEndPreamble\n";
os << "\tHTMLTitle " << htmltitle_ << "\n"
"\tSpellcheck " << spellcheck << "\n"
+ "\tForceLocal " << forcelocal << "\n"
"End\n";
}
htmldefaultstyle_ += from_ascii(tmp);
}
-// tex2lyx does not see output_xhtml.cpp
-#ifndef NO_LAYOUT_CSS
// alignment
string where = alignmentToCSS(align);
if (!where.empty()) {
htmldefaultstyle_ += from_ascii("text-align: " + where + ";\n");
}
-#endif
// wrap up what we have, if anything
if (!htmldefaultstyle_.empty())