From: Richard Heck Date: Thu, 10 Dec 2009 19:28:00 +0000 (+0000) Subject: CSS for the TOC, and a couple small fixes. X-Git-Tag: 2.0.0~4859 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=46e70895a93cdedc41526a5609f547b8b740b452;p=features.git CSS for the TOC, and a couple small fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32460 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc index 60aca98a68..2f7b48a58c 100644 --- a/lib/layouts/stdtitle.inc +++ b/lib/layouts/stdtitle.inc @@ -10,6 +10,34 @@ Format 19 +# CSS for the TOC +AddToHTMLPreamble + +EndPreamble + + Style Title Margin Static LatexType Command diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp index 9f20ee5675..bbae751763 100644 --- a/src/insets/InsetTOC.cpp +++ b/src/insets/InsetTOC.cpp @@ -91,9 +91,10 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const xs << StartTag("div", "class='toc'"); - // we want to figure out look like a chapter, section, or whatever. + // we want to look like a chapter, section, or whatever. // so we're going to look for the layout with the minimum toclevel - // number. we'll take the first one, just because. + // number > 0, because we don't want Part. + // we'll take the first one, just because. DocumentClass const & dc = buffer().params().documentClass(); TextClass::LayoutList::const_iterator lit = dc.begin(); TextClass::LayoutList::const_iterator len = dc.end(); @@ -101,14 +102,14 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const Layout const * lay = NULL; for (; lit != len; ++lit) { int const level = lit->toclevel; - if (level == Layout::NOT_IN_TOC || level >= minlevel) + if (level > 0 && (level == Layout::NOT_IN_TOC || level >= minlevel)) continue; lay = &*lit; minlevel = level; } - string const tocclass = lay ? lay->defaultCSSClass() + " ": ""; - string const tocattr = "class='" + tocclass + "tochead'"; + string const tocclass = lay ? " " + lay->defaultCSSClass(): ""; + string const tocattr = "class='tochead" + tocclass + "'"; xs << StartTag("div", tocattr) << _("Table of Contents") @@ -157,15 +158,4 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const } -void InsetTOC::validate(LaTeXFeatures & features) const -{ - if (features.runparams().flavor != OutputParams::HTML) - return; - features.addPreambleSnippet(""); -} - } // namespace lyx diff --git a/src/insets/InsetTOC.h b/src/insets/InsetTOC.h index 95fbfcdf7c..a6bfe3d5cd 100644 --- a/src/insets/InsetTOC.h +++ b/src/insets/InsetTOC.h @@ -42,8 +42,6 @@ public: /// static bool isCompatibleCommand(std::string const & cmd) { return cmd == defaultCommand(); } - /// - void validate(LaTeXFeatures & features) const; private: Inset * clone() const { return new InsetTOC(*this); } };