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();
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")
int lastdepth = 0;
for (; it != en; ++it) {
Paragraph const & par = it->dit().innerParagraph();
- Font const dummy;
int const depth = it->depth();
+ if (depth > buffer().params().tocdepth)
+ continue;
+ Font const dummy;
if (depth > lastdepth) {
xs.cr();
// open as many tags as we need to open to get to this level
attr << "class='lyxtoc-" << depth << "'";
xs << StartTag("div", attr.str());
}
+ string const parattr = "href='#" + par.magicLabel() + "' class='tocarrow'";
par.simpleLyXHTMLOnePar(buffer(), xs, op, dummy, true);
+ xs << " ";
+ xs << StartTag("a", parattr);
+ // FIXME XHTML
+ // There ought to be a simple way to customize this.
+ xs << XHTMLStream::NextRaw() << "⇘";
+ xs << EndTag("a");
}
for (int i = lastdepth; i > 0; --i)
xs << EndTag("div");
}
-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