From 3232377fc822730bda77ec5c0f9220666d9513ae Mon Sep 17 00:00:00 2001 From: rgheck Date: Mon, 26 Oct 2009 02:51:51 +0000 Subject: [PATCH] Allow the suppression of LyX's own labels. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31746 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/layouts/stdlists.inc | 1 + src/Layout.h | 1 + src/output_xhtml.cpp | 23 +++++++++++++---------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/layouts/stdlists.inc b/lib/layouts/stdlists.inc index 1cbf2cb94d..8829529649 100644 --- a/lib/layouts/stdlists.inc +++ b/lib/layouts/stdlists.inc @@ -27,6 +27,7 @@ Style Itemize LabelString "*" HTMLTag ul HTMLItem li + HTMLLabel NONE End diff --git a/src/Layout.h b/src/Layout.h index 787342de77..28085dbd6b 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -302,6 +302,7 @@ private: /// descriptions, in which case it would be: dt. Another use is to /// customize the display of, say, the auto-generated label for /// sections. Defaults to "span". + /// If set to "NONE", this suppresses the printing of the label. std::string htmllabel_; /// Attributes for the label. Defaults to: class="layoutnamelabel". std::string htmllabelattr_; diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 90204b2e82..a27a9f4bf7 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -307,11 +307,12 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf, } bool item_tag_opened = false; bool const labelfirst = style.htmllabelfirst(); + bool madelabel = false; if (isNormalEnv(style)) { // in this case, we print the label only for the first // paragraph (as in a theorem). item_tag_opened = openItemTag(os, style); - if (par == pbegin) { + if (par == pbegin && style.htmllabel() != "NONE") { docstring const lbl = pbegin->expandLabel(style, buf.params(), false); if (!lbl.empty()) { @@ -325,28 +326,30 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf, } else { // some kind of list if (!labelfirst) item_tag_opened = openItemTag(os, style); - if (style.labeltype == LABEL_MANUAL) { - bool const label_tag_opened = openLabelTag(os, style); + if (style.labeltype == LABEL_MANUAL + && style.htmllabel() != "NONE") { + madelabel = openLabelTag(os, style); sep = par->firstWordLyXHTML(os, runparams); - if (label_tag_opened) + if (madelabel) closeLabelTag(os, style); os << '\n'; } - else if (style.labeltype != LABEL_NO_LABEL) { - bool const label_tag_opened = openLabelTag(os, style); + else if (style.labeltype != LABEL_NO_LABEL + && style.htmllabel() != "NONE") { + madelabel = openLabelTag(os, style); os << par->expandLabel(style, buf.params(), false); - if (label_tag_opened) + if (madelabel) closeLabelTag(os, style); os << '\n'; } if (labelfirst) item_tag_opened = openItemTag(os, style); - else - os << ""; + else if (madelabel) + os << ""; } par->simpleLyXHTMLOnePar(buf, os, runparams, text.outerFont(distance(begin, par)), sep); - if (!isNormalEnv(style) && labelfirst) + if (!isNormalEnv(style) && !labelfirst && madelabel) os << ""; ++par; if (item_tag_opened) { -- 2.11.4.GIT