#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 = 17;
+int const FORMAT = 24;
bool layout2layout(FileName const & filename, FileName const & tempfile)
TC_ADDTOHTMLPREAMBLE,
TC_DEFAULTMODULE,
TC_PROVIDESMODULE,
- TC_EXCLUDESMODULE
+ TC_EXCLUDESMODULE,
+ TC_HTMLTOCSECTION
};
{ "float", TC_FLOAT },
{ "format", TC_FORMAT },
{ "htmlpreamble", TC_HTMLPREAMBLE },
+ { "htmltocsection", TC_HTMLTOCSECTION },
{ "ifcounter", TC_IFCOUNTER },
{ "ifstyle", TC_IFSTYLE },
{ "input", TC_INPUT },
case TC_HTMLPREAMBLE:
htmlpreamble_ = from_utf8(lexrc.getLongString("EndPreamble"));
break;
+
+ case TC_HTMLTOCSECTION:
+ html_toc_section_ = from_utf8(trim(lexrc.getString()));
+ break;
case TC_ADDTOPREAMBLE:
preamble_ += from_utf8(lexrc.getLongString("EndPreamble"));
FT_WITHIN,
FT_STYLE,
FT_LISTNAME,
- FT_BUILTIN,
+ FT_NEEDSFLOAT,
FT_HTMLSTYLE,
- FT_HTMLCLASS,
- FT_HTMLTYPE,
+ FT_HTMLATTR,
+ FT_HTMLTAG,
+ FT_LISTCOMMAND,
FT_END
};
{ "end", FT_END },
{ "extension", FT_EXT },
{ "guiname", FT_NAME },
- { "htmlclass", FT_HTMLCLASS },
+ { "htmlattr", FT_HTMLATTR },
{ "htmlstyle", FT_HTMLSTYLE },
- { "htmltype", FT_HTMLTYPE },
- { "latexbuiltin", FT_BUILTIN },
+ { "htmltag", FT_HTMLTAG },
+ { "listcommand", FT_LISTCOMMAND },
{ "listname", FT_LISTNAME },
+ { "needsfloatpkg", FT_NEEDSFLOAT },
{ "numberwithin", FT_WITHIN },
{ "placement", FT_PLACEMENT },
{ "style", FT_STYLE },
lexrc.pushTable(floatTags);
string ext;
- string htmlclass;
+ string htmlattr;
string htmlstyle;
- string htmltype;
+ string htmltag;
string listName;
+ string listCommand;
string name;
string placement;
string style;
string type;
string within;
- bool builtin = false;
+ bool needsfloat = true;
bool getout = false;
while (!getout && lexrc.isOK()) {
style = fl.style();
name = fl.name();
listName = fl.listName();
- builtin = fl.builtin();
+ needsfloat = fl.needsFloatPkg();
+ listCommand = fl.listCommand();
}
break;
case FT_NAME:
lexrc.next();
style = lexrc.getString();
break;
+ case FT_LISTCOMMAND:
+ lexrc.next();
+ listCommand = lexrc.getString();
+ break;
case FT_LISTNAME:
lexrc.next();
listName = lexrc.getString();
break;
- case FT_BUILTIN:
+ case FT_NEEDSFLOAT:
lexrc.next();
- builtin = lexrc.getBool();
+ needsfloat = lexrc.getBool();
break;
- case FT_HTMLCLASS:
+ case FT_HTMLATTR:
lexrc.next();
- htmlclass = lexrc.getString();
+ htmlattr = lexrc.getString();
break;
case FT_HTMLSTYLE:
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
+ // Here we have a full float if getout == true
if (getout) {
+ if (!needsfloat && listCommand.empty())
+ LYXERR0("The layout does not provide a list command " <<
+ "for the builtin float `" << type << "'. LyX will " <<
+ "not be able to produce a float list.");
Floating fl(type, placement, ext, within, style, name,
- listName, htmltype, htmlclass, htmlstyle, builtin);
+ listName, listCommand, htmltag, htmlattr, htmlstyle,
+ needsfloat);
floatlist_.newFloat(fl);
// each float has its own counter
counters_.newCounter(from_ascii(type), from_ascii(within),
return *defaultLayout;
}
+
/////////////////////////////////////////////////////////////////////////
//
// DocumentClassBundle
}
+Layout const & DocumentClass::htmlTOCLayout() const
+{
+ if (html_toc_section_.empty()) {
+ // we're going to look for the layout with the minimum toclevel
+ TextClass::LayoutList::const_iterator lit = begin();
+ TextClass::LayoutList::const_iterator const len = end();
+ int minlevel = 1000;
+ Layout const * lay = NULL;
+ for (; lit != len; ++lit) {
+ int const level = lit->toclevel;
+ // we don't want Part
+ if (level == Layout::NOT_IN_TOC || level < 0 || level >= minlevel)
+ continue;
+ lay = &*lit;
+ minlevel = level;
+ }
+ if (lay)
+ html_toc_section_ = lay->name();
+ else
+ // hmm. that is very odd, so we'll do our best
+ html_toc_section_ = defaultLayoutName();
+ }
+ return operator[](html_toc_section_);
+}
+
+
/////////////////////////////////////////////////////////////////////////
//
// PageSides