From 59c04f7096779680caa0ba7623f9b53affef218b Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 14 Jan 2010 22:24:43 +0000 Subject: [PATCH] The fortoc argument I introduced earlier should all along have gone into OutputParams. So now it is there. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33044 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/OutputParams.cpp | 2 +- src/OutputParams.h | 9 +++++++++ src/Paragraph.cpp | 6 +++--- src/Paragraph.h | 1 - src/insets/InsetIndex.cpp | 4 +++- src/insets/InsetTOC.cpp | 4 +++- src/output_xhtml.cpp | 5 +++-- 7 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index 2e129cec18..09583d94c8 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -30,7 +30,7 @@ OutputParams::OutputParams(Encoding const * enc) par_begin(0), par_end(0), isLastPar(false), dryrun(false), verbatim(false), html_disable_captions(false), html_in_par(false), - html_make_pars(true), includeall(false) + html_make_pars(true), for_toc(false), includeall(false) { // Note: in PreviewLoader::Impl::dumpPreamble // OutputParams runparams(0); diff --git a/src/OutputParams.h b/src/OutputParams.h index cea089e1f1..2ea48be8b6 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -203,19 +203,28 @@ public: /// is this the last paragraph in the current buffer/inset? bool isLastPar; + /** whether or not do actual file copying and image conversion * This mode will be used to preview the source code */ bool dryrun; + /// Should we output verbatim or escape LaTeX's special chars? bool verbatim; + /// Should we output captions? bool html_disable_captions; + /// Are we already in a paragraph? bool html_in_par; + /// Does the present context even permit paragraphs? bool html_make_pars; + + /// Are we generating this material for inclusion in a TOC-like entity? + bool for_toc; + /// Include all children notwithstanding the use of \includeonly bool includeall; }; diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index b3b75f020e..abee04a727 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2396,7 +2396,6 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf, XHTMLStream & xs, OutputParams const & runparams, Font const & outerfont, - bool fortoc, pos_type initial) const { docstring retval; @@ -2407,7 +2406,7 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf, Layout const & style = *d->layout_; - if (!fortoc) { + if (!runparams.for_toc) { // generate a magic label for this paragraph string const attr = "id='" + magicLabel() + "'"; xs << CompTag("a", attr); @@ -2448,7 +2447,8 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf, InsetCommand const * ic = inset->asInsetCommand(); InsetLayout const & il = inset->getLayout(); InsetMath const * im = inset->asInsetMath(); - if (!fortoc || im || il.isInToc() || (ic && ic->isInToc())) { + if (!runparams.for_toc + || im || il.isInToc() || (ic && ic->isInToc())) { OutputParams np = runparams; if (!il.htmlisblock()) np.html_in_par = true; diff --git a/src/Paragraph.h b/src/Paragraph.h index 761e6e9b5d..2c04b66935 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -168,7 +168,6 @@ public: XHTMLStream & xs, OutputParams const & runparams, Font const & outerfont, - bool fortoc = false, pos_type initial = 0) const; /// diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 0c39fcb2cc..68d171a544 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -746,7 +746,9 @@ docstring InsetPrintIndex::xhtml(XHTMLStream &, OutputParams const & op) const // modify what we get back. odocstringstream ent; XHTMLStream entstream(ent); - par.simpleLyXHTMLOnePar(buffer(), entstream, op, dummy, true); + OutputParams ours = op; + ours.for_toc = true; + par.simpleLyXHTMLOnePar(buffer(), entstream, ours, dummy); // these will contain XHTML versions of the main entry, etc // remember that everything will already have been escaped, diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp index b81f6a9393..50d713a119 100644 --- a/src/insets/InsetTOC.cpp +++ b/src/insets/InsetTOC.cpp @@ -131,7 +131,9 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const xs << StartTag("div", attr.str()); } string const parattr = "href='#" + par.magicLabel() + "' class='tocarrow'"; - par.simpleLyXHTMLOnePar(buffer(), xs, op, dummy, true); + OutputParams ours = op; + ours.for_toc = true; + par.simpleLyXHTMLOnePar(buffer(), xs, ours, dummy); xs << " "; xs << StartTag("a", parattr); // FIXME XHTML diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 0b271dc896..60df83400d 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -225,7 +225,8 @@ bool XHTMLStream::closeFontTags() bool noFontTags = true; for (; it != en; ++it) { if (html::isFontTag(it->tag_)) { - writeError("Font tag `" + it->tag_ + "' still open in closeFontTags()."); + writeError("Font tag `" + it->tag_ + "' still open in closeFontTags().\n" + "This is likely not a problem, but you might want to check."); noFontTags = false; } } @@ -725,7 +726,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf, openItemTag(xs, style); } par->simpleLyXHTMLOnePar(buf, xs, runparams, - text.outerFont(distance(begin, par)), false, sep); + text.outerFont(distance(begin, par)), sep); ++par; // We may not want to close the tag yet, in particular, // if we're not at the end... -- 2.39.5