X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextClass.cpp;h=981dcd185c23b99d256cfca5f4add1c9fb26b8e9;hb=4b7f1b3c3918cd32070c72b6d8e95a888981c7a2;hp=e19b0ec2003d72e068b2387fca7a842a3d681e30;hpb=9929f8985643696242653fc66388fc532d4eec02;p=lyx.git diff --git a/src/TextClass.cpp b/src/TextClass.cpp index e19b0ec200..981dcd185c 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -66,7 +66,7 @@ private: }; // Keep the changes documented in the Customization manual. -int const FORMAT = 19; +int const FORMAT = 22; bool layout2layout(FileName const & filename, FileName const & tempfile) @@ -196,7 +196,8 @@ enum TextClassTags { TC_ADDTOHTMLPREAMBLE, TC_DEFAULTMODULE, TC_PROVIDESMODULE, - TC_EXCLUDESMODULE + TC_EXCLUDESMODULE, + TC_HTMLTOCSECTION }; @@ -215,6 +216,7 @@ namespace { { "float", TC_FLOAT }, { "format", TC_FORMAT }, { "htmlpreamble", TC_HTMLPREAMBLE }, + { "htmltocsection", TC_HTMLTOCSECTION }, { "ifcounter", TC_IFCOUNTER }, { "ifstyle", TC_IFSTYLE }, { "input", TC_INPUT }, @@ -529,6 +531,10 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) 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")); @@ -852,7 +858,7 @@ void TextClass::readFloat(Lexer & lexrc) FT_LISTNAME, FT_BUILTIN, FT_HTMLSTYLE, - FT_HTMLCLASS, + FT_HTMLATTR, FT_HTMLTAG, FT_END }; @@ -861,7 +867,7 @@ void TextClass::readFloat(Lexer & lexrc) { "end", FT_END }, { "extension", FT_EXT }, { "guiname", FT_NAME }, - { "htmlclass", FT_HTMLCLASS }, + { "htmlattr", FT_HTMLATTR }, { "htmlstyle", FT_HTMLSTYLE }, { "htmltag", FT_HTMLTAG }, { "latexbuiltin", FT_BUILTIN }, @@ -875,7 +881,7 @@ void TextClass::readFloat(Lexer & lexrc) lexrc.pushTable(floatTags); string ext; - string htmlclass; + string htmlattr; string htmlstyle; string htmltag; string listName; @@ -940,9 +946,9 @@ void TextClass::readFloat(Lexer & lexrc) lexrc.next(); builtin = lexrc.getBool(); break; - case FT_HTMLCLASS: + case FT_HTMLATTR: lexrc.next(); - htmlclass = lexrc.getString(); + htmlattr = lexrc.getString(); break; case FT_HTMLSTYLE: lexrc.next(); @@ -961,7 +967,7 @@ void TextClass::readFloat(Lexer & lexrc) // Here if have a full float if getout == true if (getout) { Floating fl(type, placement, ext, within, style, name, - listName, htmltag, htmlclass, htmlstyle, builtin); + listName, htmltag, htmlattr, htmlstyle, builtin); floatlist_.newFloat(fl); // each float has its own counter counters_.newCounter(from_ascii(type), from_ascii(within), @@ -1166,6 +1172,7 @@ Layout TextClass::createBasicLayout(docstring const & name, bool unknown) const return *defaultLayout; } + ///////////////////////////////////////////////////////////////////////// // // DocumentClassBundle @@ -1265,6 +1272,32 @@ bool DocumentClass::hasTocLevels() const } +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