Am Tue, 4 Aug 2020 15:24:25 +0200 schrieb Kornel Benko <kor...@lyx.org>:
> Exporting doc/Customization.lyx to docbook5 gives invalid result. > > Bisecting this file lead to the attached mwe. > > The error vanishes, if we remove the ragged line break (between 'Centered' > and 'abcd') > > Kornel > For me the attached patch cures this case. Kornel
diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp index 05c6ee417f..45d52b23da 100644 --- a/src/insets/InsetNewline.cpp +++ b/src/insets/InsetNewline.cpp @@ -174,12 +174,20 @@ int InsetNewline::plaintext(odocstringstream & os, void InsetNewline::docbook(XMLStream & xs, OutputParams const & runparams) const { if (runparams.docbook_in_par) { xs.closeFontTags(); - xs << xml::EndTag("para"); - xs << xml::StartTag("para"); + if (!xs.pending_tags_empty()) { + xs << xml::EndTag("para"); + xs << xml::StartTag("para"); + } + else { + xs << xml::CR() << xml::CompTag("br") << xml::CR(); + } + } + else { + xs << xml::CR() << xml::CompTag("br") << xml::CR(); } } docstring InsetNewline::xhtml(XMLStream & xs, OutputParams const &) const diff --git a/src/xml.h b/src/xml.h index 12e7f25fa5..b585a48a9d 100644 --- a/src/xml.h +++ b/src/xml.h @@ -124,10 +124,12 @@ private: TagPtr makeTagPtr(T const & tag) { return std::make_shared<T>(tag); } /// TagDeque pending_tags_; /// TagDeque tag_stack_; +public: + bool pending_tags_empty() { return pending_tags_.empty();}; }; namespace xml { /// Escape the given character, if necessary, to an entity.
pgp9nk3kvdtCT.pgp
Description: Digitale Signatur von OpenPGP
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel