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
This commit is contained in:
Richard Heck 2009-12-10 19:28:00 +00:00
parent ffe73b795b
commit 46e70895a9
3 changed files with 34 additions and 18 deletions

View File

@ -10,6 +10,34 @@
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

View 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

View 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); }
};