diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index f29ca995a5..8f1d762fa3 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -312,7 +312,7 @@ InsetLayout::InsetDecoration InsetArgument::decoration() const void InsetArgument::docbook(XMLStream & xs, OutputParams const & rp) const { - if (docbooktag_ != from_ascii("NONE")) { + if (docbooktag_ != from_ascii("NONE") && docbooktag_ != from_ascii("IGNORE")) { // TODO: implement docbooktagtype_. xs << xml::StartTag(docbooktag_, docbookattr_); InsetText::docbook(xs, rp); diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 3305eddf96..9e5f4ac02e 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -616,7 +616,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op } InsetLayout const & il = getLayout(); - if (opts & WriteOuterTag && !il.docbooktag().empty() && il.docbooktag() != "NONE") { + if (opts & WriteOuterTag && !il.docbooktag().empty() && il.docbooktag() != "NONE" && il.docbooktag() != "IGNORE") { docstring attrs = docstring(); if (!il.docbookattr().empty()) attrs += from_ascii(il.docbookattr()); @@ -637,7 +637,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op docbookParagraphs(text_, buffer(), xs, runparams); xs.endDivision(); - if (opts & WriteOuterTag) + if (opts & WriteOuterTag && !il.docbooktag().empty() && il.docbooktag() != "NONE" && il.docbooktag() != "IGNORE") xs << xml::EndTag(il.docbooktag()); } diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 58e1b810f1..d25d85f573 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -412,6 +412,11 @@ void makeParagraph( OutputParams const & runparams, ParagraphList::const_iterator const & par) { + // If this kind of layout should be ignored, already leave. + if (par->layout().docbooktag() == "IGNORE") + return; + + // Useful variables. auto const begin = text.paragraphs().begin(); auto const end = text.paragraphs().end(); auto prevpar = text.paragraphs().getParagraphBefore(par); @@ -503,15 +508,16 @@ void makeParagraph( ++nextpar; auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case); for (docstring const & parXML : pars) { - if (xml::isNotOnlySpace(parXML)) { - if (open_par) - openParTag(xs, &*par, prevpar); + if (!xml::isNotOnlySpace(parXML)) + continue; - xs << XMLStream::ESCAPE_NONE << parXML; + if (open_par) + openParTag(xs, &*par, prevpar); - if (close_par) - closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); - } + xs << XMLStream::ESCAPE_NONE << parXML; + + if (close_par) + closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); } } @@ -522,6 +528,11 @@ void makeEnvironment(Text const &text, OutputParams const &runparams, ParagraphList::const_iterator const & par) { + // If this kind of layout should be ignored, already leave. + if (par->layout().docbooktag() == "IGNORE") + return; + + // Useful variables. auto const end = text.paragraphs().end(); auto nextpar = par; ++nextpar; @@ -618,10 +629,18 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text, OutputParams const &runparams, ParagraphList::const_iterator const & begin) { + // Useful variables. auto par = begin; auto const end = text.paragraphs().end(); auto const envend = findEndOfEnvironment(par, end); + // If this kind of layout should be ignored, already leave. + if (begin->layout().docbooktag() == "IGNORE") { + auto nextpar = par; + ++nextpar; + return nextpar; + } + // Output the opening tag for this environment. Layout const & envstyle = par->layout(); openTag(xs, envstyle.docbookwrappertag(), envstyle.docbookwrapperattr(), envstyle.docbookwrappertagtype()); @@ -708,6 +727,11 @@ void makeCommand( OutputParams const & runparams, ParagraphList::const_iterator const & par) { + // If this kind of layout should be ignored, already leave. + if (par->layout().docbooktag() == "IGNORE") + return; + + // Useful variables. // Unlike XHTML, no need for labels, as they are handled by DocBook tags. auto const begin = text.paragraphs().begin(); auto const end = text.paragraphs().end();