From bfddee97e191a853f0576f4fab3f095c4e9ce0de Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 12 Apr 2011 17:33:18 +0000 Subject: [PATCH] Better TOC output for XHTML, per Rob and Pavel. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38354 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/layouts/stdtitle.inc | 5 +++++ src/insets/InsetTOC.cpp | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc index 7081de49d0..1669614f98 100644 --- a/lib/layouts/stdtitle.inc +++ b/lib/layouts/stdtitle.inc @@ -34,6 +34,11 @@ AddToHTMLPreamble div.lyxtoc-4 { margin: 0em 0em 0em 1em; } div.lyxtoc-5 { margin: 0em 0em 0em 1em; } div.lyxtoc-6 { margin: 0em 0em 0em 1em; } + a.tocentry { + text-decoration: none; + color: black; + } + a.tocentry:visited { color: black; } a.tocarrow { font-weight: bold; text-decoration: none; diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp index b5159f937f..bac2f43699 100644 --- a/src/insets/InsetTOC.cpp +++ b/src/insets/InsetTOC.cpp @@ -159,6 +159,10 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const // Now output TOC info for this entry Paragraph const & par = it->dit().innerParagraph(); + + string const attr = "href='#" + par.magicLabel() + "' class='tocentry'"; + xs << html::StartTag("a", attr); + // First the label, if there is one docstring const & label = par.params().labelString(); if (!label.empty()) @@ -168,7 +172,9 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const ours.for_toc = true; Font const dummy; par.simpleLyXHTMLOnePar(buffer(), xs, ours, dummy); - xs << " "; + + xs << html::EndTag("a") << " "; + // Now a link to that paragraph string const parattr = "href='#" + par.magicLabel() + "' class='tocarrow'"; xs << html::StartTag("a", parattr);