]> git.lyx.org Git - features.git/commitdiff
CSS for the TOC, and a couple small fixes.
authorRichard Heck <rgheck@comcast.net>
Thu, 10 Dec 2009 19:28:00 +0000 (19:28 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 10 Dec 2009 19:28:00 +0000 (19:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32460 a592a061-630c-0410-9148-cb99ea01b6c8

lib/layouts/stdtitle.inc
src/insets/InsetTOC.cpp
src/insets/InsetTOC.h

index 60aca98a68a9e36d84ecb9b635ad7d4127dc7c39..2f7b48a58cc9003bef181c2e69bc022951dddf22 100644 (file)
 
 Format 19
 
+# CSS for the TOC
+AddToHTMLPreamble
+<style type="text/css">
+       div.toc { 
+               margin: 2em 0em; 
+               border-style: solid; 
+               border-width: 2px 0px; 
+               padding: 1em 0em; 
+       }
+       div.tochead { font-size: x-large; font-weight: bold; }
+       div.lyxtoc-1 { 
+               margin: 1em 0em 0em 0em; 
+               font-size: x-large; 
+               font-weight: bold; 
+       }
+       div.lyxtoc-2 { 
+               margin: 0em 0em 0em 1em; 
+               font-size: large; 
+               font-weight: normal; 
+       }
+       div.lyxtoc-3 { margin: 0em 0em 0em 1em; font-size: medium; }
+       div.lyxtoc-4 { margin: 0em 0em 0em 1em; }
+       div.lyxtoc-5 { margin: 0em 0em 0em 1em; }
+       div.lyxtoc-6 { margin: 0em 0em 0em 1em; }
+</style>
+EndPreamble
+
+
 Style Title
        Margin                Static
        LatexType             Command
index 9f20ee5675a30d9b4bc9a726eedb87fe72fd6917..bbae7517635a384a63f8d561c05470eeba732bc0 100644 (file)
@@ -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("<style type=\"text/css\">\n"
-                       "div.lyxtoc-1 { margin-left: 2em; text-indent: -2em; }\n"
-                       "span.bibtexlabel:before{ content: \"[\"; }\n"
-                       "span.bibtexlabel:after{ content: \"] \"; }\n"
-                       "</style>");
-}
-
 } // namespace lyx
index 95fbfcdf7c86ae4105ef11844439f28db6106e83..a6bfe3d5cdb6b0e52cc47b74b0eb928341227dbb 100644 (file)
@@ -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); }
 };