[LyX features/feature/docbook] DocBook: support Full Width from Tufte Book.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Aug 30 22:16:46 UTC 2020


The branch, feature/docbook, has been updated.

- Log -----------------------------------------------------------------

commit a9e2203a9f7acfacf970c989096d1011e7fa1098
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 31 00:43:02 2020 +0200

    DocBook: support Full Width from Tufte Book.

diff --git a/autotests/export/docbook/Tufte_Book.xml b/autotests/export/docbook/Tufte_Book.xml
index 3fb7f24..4968e25 100644
--- a/autotests/export/docbook/Tufte_Book.xml
+++ b/autotests/export/docbook/Tufte_Book.xml
@@ -3,26 +3,32 @@
   See http://www.lyx.org/ for more information -->
 <book xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
 <info>
-
 <title>Tufte Examples</title>
+<author>
+<personname>Fake Author</personname>
+</author>
 </info>
 <chapter>
-<title>The Features of the Tufte-book Class</title>
+<title>
+The Features of the Tufte-book Class
+</title>
 <para>In this document, it was endeavored to show some of the features of the <emphasis role='sans'>Tufte-book</emphasis> class. In the first chapter, their use is outlined. In the second chapter, their use through a handout that was created in a calculus class is demonstrated.</para>
 <section>
-<title>Working with Text</title>
-<para>One of the most prominent and distinctive features of this style is the extensive use of sidenotes. There is a wide margin to provide ample room for sidenotes and small figures. Any footnotes will automatically be converted to sidenotes.<footnote><para>This is a sidenote that was entered using a <code>footnote</code>.</para>
-</footnote> Alternatively, you can also use the <code>Sidenote</code> inset directly; you'll find it in the <emphasis role='sans'>Insert&#x21D2;Custom Insets</emphasis> menu.This is a sidenote that was entered using a <code>sidenote</code>.</para>
+<title>
+Working with Text
+</title>
+<para>One of the most prominent and distinctive features of this style is the extensive use of sidenotes. There is a wide margin to provide ample room for sidenotes and small figures. Any footnotes will automatically be converted to sidenotes.<footnote>
+<para>This is a sidenote that was entered using a <code>footnote</code>.</para>
+</footnote> Alternatively, you can also use the <code>Sidenote</code> inset directly; you'll find it in the <emphasis role='sans'>Insert&#x21D2;Custom Insets</emphasis> menu.This is a sidenote that was entered using a sidenote.</para>
 <para>If you like to place ancillary information in the margin without the sidenote mark (the superscript number), you can use the <code>Marginnote</code> inset. This is Tufte's margin note. Notice that there isn't a number preceding the note, and there is no number in the main text where this note was written. The normal margin note will work as well, but it will look rather odd.<sidebar role="margin">
-<?dbfo float-type="margin.note"?><sidebar role="margin">This is a normal margin note. Don't use it.</sidebar></sidebar></para>
-<para>Another useful innovation is Tufte's <code>NewThought</code> character style (<emphasis role='sans'>Edit&#x21D2;TextStyle&#x21D2;NewThought</emphasis>). It introduces new thoughts by means of small caps, as demonstrated in this paragraph. </para>
+<?dbfo float-type="margin.note"?>
+<para>This is a normal margin note. Don't use it.</para></sidebar></para>
+<para><emphasis role='newthought'>Another useful</emphasis> innovation is Tufte's <code>NewThought</code> character style (<emphasis role='sans'>Edit&#x21D2;TextStyle&#x21D2;NewThought</emphasis>). It introduces new thoughts by means of small caps, as demonstrated in this paragraph. </para>
 <para>The Tufte document classes include two new character styles and some improvements on existing commands for letterspacing.</para>
-<para>When setting strings of <emphasis role='allcaps'>ALL CAPS</emphasis> or small caps, the letterspacing—that is, the spacing between the letters—should be increased slightly.<biblioref endterm="Bringhurst2005" /> The <emphasis>AllCaps</emphasis> character style (<emphasis role='sans'>Edit&#x21D2;TextStyle&#x21D2;AllCaps</emphasis>) has proper letterspacing for strings of <emphasis role='allcaps'>FULL CAPITAL LETTERS</emphasis>, and the <emphasis>SmallCaps</emphasis> character style (<emphasis role='sans'>Edit&#x21D2;TextStyle&#x21D2;SmallCaps</emphasis>) has letterspacing for small capital letters. These commands will also automatically convert the case of the text to upper- or lowercase, respectively.</para>
+<para>When setting strings of <emphasis role='allcaps'>ALL CAPS</emphasis> or <emphasis role='smallcaps'>small caps</emphasis>, the letterspacing—that is, the spacing between the letters—should be increased slightly.<biblioref endterm="Bringhurst2005" /> The <emphasis>AllCaps</emphasis> character style (<emphasis role='sans'>Edit&#x21D2;TextStyle&#x21D2;AllCaps</emphasis>) has proper letterspacing for strings of <emphasis role='allcaps'>FULL CAPITAL LETTERS</emphasis>, and the <emphasis>SmallCaps</emphasis> character style (<emphasis role='sans'>Edit&#x21D2;TextStyle&#x21D2;SmallCaps</emphasis>) has letterspacing for <emphasis role='smallcaps'>small capital letters</emphasis>. These commands will also automatically convert the case of the text to upper- or lowercase, respectively.</para>
 <para>The normal <emphasis>Small Caps</emphasis> shape has also been redefined to include letterspacing. Its case is left as is, however. This allows one to use both uppercase and lowercase letters: <emphasis role='smallcaps'>The Initial Letters Of The Words In This Sentence Are Capitalized.</emphasis></para>
 <para>Finally, the<emphasis> Full Width</emphasis> paragraph environment provides a paragraph layout that stretches across the main text block and the sidenotes area:</para>
-<Full Width>
-Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.
-</Full Width>
+<para role='fullwidth'>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.</para>
 </section>
 </chapter>
 <bibliography>
diff --git a/lib/layouts/tufte-book.layout b/lib/layouts/tufte-book.layout
index 2b88ca3..e469996 100644
--- a/lib/layouts/tufte-book.layout
+++ b/lib/layouts/tufte-book.layout
@@ -243,6 +243,8 @@ Style Full_Width
 	Align			Block
 	AlignPossible	Block, Left, Right, Center
 	LabelType		No_Label
+	DocBookTag      para
+	DocBookAttr     role='fullwidth'
 End
 
 # this steps the counters

commit 864c1cb05db795d79415ce37f80c78c3ac41857b
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 31 00:42:32 2020 +0200

    DocBook: fix margin notes.
    
    They were nested twice in <sidebar>. Also fixes a new line issue.

diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index 04c464a..ab15f77 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -44,8 +44,7 @@ InsetLayout Marginal
 	EndHTMLStyle
 	AddToToc              marginalnote
 	IsTocCaption          true
-	DocBookTag            sidebar
-	DocBookAttr           role="margin"
+	DocBookTag            para
 End
 
 InsetLayout Foot
diff --git a/src/insets/InsetMarginal.cpp b/src/insets/InsetMarginal.cpp
index 5d2fb90..3a5296d 100644
--- a/src/insets/InsetMarginal.cpp
+++ b/src/insets/InsetMarginal.cpp
@@ -49,6 +49,7 @@ void InsetMarginal::docbook(XMLStream & xs, OutputParams const & runparams) cons
 	xs << xml::StartTag("sidebar", "role=\"margin\"");
 	xs << xml::CR();
 	xs << XMLStream::ESCAPE_NONE << "<?dbfo float-type=\"margin.note\"?>";
+	xs << xml::CR();
 	InsetText::docbook(xs, runparams);
 	xs << xml::EndTag("sidebar");
 }

commit 8de9615087eafce2f13117716ce26e4296bc9f8c
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 31 00:21:12 2020 +0200

    DocBook: new lines around formulae.

diff --git a/autotests/export/docbook/mathml_ns_entities.xml b/autotests/export/docbook/mathml_ns_entities.xml
index 2ee7f39..0c1509e 100644
--- a/autotests/export/docbook/mathml_ns_entities.xml
+++ b/autotests/export/docbook/mathml_ns_entities.xml
@@ -1,21 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This DocBook file was created by LyX 2.4.0dev
   See http://www.lyx.org/ for more information -->
-<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.1">
+<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
 <title>Test document</title>
 <para>A formula: 
- <informalequation>
-  <m:math>
-  <m:alt role='tex'>\Vert,\vert</m:alt>
+<informalequation>
+<alt role='tex'>\Vert,\vert</alt>
+ <m:math>
+ 
  <m:mrow>
   <m:mrow><m:mi>&#x2225;</m:mi><m:mo>,</m:mo><m:mi>&#x007C;</m:mi>
   </m:mrow>
  </m:mrow>
-  </m:math>
- </informalequation>A second formula: 
- <informalequation>
-  <m:math>
-  <m:alt role='tex'>\left\Vert \mathbf{a^{T}\,x}\right\Vert _{2}\leq x_{0}</m:alt>
+ </m:math>
+</informalequation>
+A second formula: 
+<informalequation>
+<alt role='tex'>\left\Vert \mathbf{a^{T}\,x}\right\Vert _{2}\leq x_{0}</alt>
+ <m:math>
+ 
  <m:mrow>
   <m:mrow>
    <m:msub>
@@ -45,7 +48,7 @@
    </m:msub>
   </m:mrow>
  </m:mrow>
-  </m:math>
- </informalequation></para>
-
-</article>
+ </m:math>
+</informalequation>
+</para>
+</article>
\ No newline at end of file
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index e8dc3af..23c477c 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2408,13 +2408,11 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
 {
 	// Choose the tag around the MathML equation.
 	docstring name;
+	bool doCR = false;
 	if (getType() == hullSimple)
 		name = from_ascii("inlineequation");
 	else {
-		// This is a block equation, always have <informalequation> on its own line.
-		if (!xs.isLastTagCR())
-			xs << xml::CR();
-
+		doCR = true; // This is a block equation, always have <informalequation> on its own line.
 		name = from_ascii("informalequation");
 	}
 
@@ -2429,6 +2427,10 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
 		}
 	}
 
+	if (doCR)
+		if (!xs.isLastTagCR())
+			xs << xml::CR();
+
 	xs << xml::StartTag(name, attr);
 	xs << xml::CR();
 
@@ -2475,6 +2477,8 @@ void InsetMathHull::docbook(XMLStream & xs, OutputParams const & runparams) cons
 	xs << XMLStream::ESCAPE_NONE << osmath.str();
 	xs << xml::CR();
 	xs << xml::EndTag(name);
+	if (doCR)
+		xs << xml::CR();
 }
 
 

commit 7975aa61b5de5a29f9a9f82768775d808994ad01
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 31 00:18:35 2020 +0200

    DocBook: avoid generating fonts for "special cases" like equations.

diff --git a/autotests/export/docbook/lists.xml b/autotests/export/docbook/lists.xml
index 6812230..ce2d970 100644
--- a/autotests/export/docbook/lists.xml
+++ b/autotests/export/docbook/lists.xml
@@ -125,7 +125,7 @@
 <varlistentry>
 <term>LyX:</term>
 <listitem>
-
+<para />
 <variablelist>
 <varlistentry>
 <term>lyx16</term>
diff --git a/autotests/export/docbook/math_in_font.xml b/autotests/export/docbook/math_in_font.xml
index 0758a2e..45bb544 100644
--- a/autotests/export/docbook/math_in_font.xml
+++ b/autotests/export/docbook/math_in_font.xml
@@ -4,7 +4,8 @@
 <article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
 <title>LyX</title>
 <para>Some text before.</para>
-<informalequation><alt role='tex'>\cfrac[l]{A}{B+C}\,,\,\cfrac{A}{B+C}\,,\,\cfrac[r]{A}{B+C}</alt>
+<informalequation>
+<alt role='tex'>\cfrac[l]{A}{B+C}\,,\,\cfrac{A}{B+C}\,,\,\cfrac[r]{A}{B+C}</alt>
  <m:math>
  
  <m:mrow>
@@ -35,6 +36,7 @@
    </m:mfrac>
   </m:mrow>
  </m:mrow>
- </m:math></informalequation><para>Some text after.</para>
-
+ </m:math>
+</informalequation>
+<para>Some text after.</para>
 </article>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 0e89381..67d6480 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3320,7 +3320,8 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
                                                       OutputParams const & runparams,
                                                       Font const & outerfont,
                                                       pos_type initial,
-                                                      bool is_last_par) const
+                                                      bool is_last_par,
+                                                      bool ignore_fonts) const
 {
 	// Track whether we have opened these tags
 	DocBookFontState fs;
@@ -3349,33 +3350,37 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 		// If this is an InsetNewline, generate a new paragraph. Also reset the fonts, so that tags are closed in
 		// this paragraph.
 		if (getInset(i) != nullptr && getInset(i)->lyxCode() == NEWLINE_CODE) {
-			xs->closeFontTags();
+			if (!ignore_fonts)
+				xs->closeFontTags();
 			generatedParagraphs.push_back(os.str());
 			os = odocstringstream();
 			delete xs;
 			xs = new XMLStream(os);
-			font_old = outerfont.fontInfo();
+			if (!ignore_fonts)
+				font_old = outerfont.fontInfo();
 		}
 
-		// Determine which tags should be opened or closed.
+		// Determine which tags should be opened or closed regarding fonts.
 		Font const font = getFont(buf.masterBuffer()->params(), i, outerfont);
-		tie(tagsToOpen, tagsToClose) = computeDocBookFontSwitch(font_old, font, default_family, fs);
+		if (!ignore_fonts) {
+			tie(tagsToOpen, tagsToClose) = computeDocBookFontSwitch(font_old, font, default_family, fs);
 
-		// FIXME XHTML
-		// Other such tags? What about the other text ranges?
+			// FIXME XHTML
+			// Other such tags? What about the other text ranges?
 
-		vector<xml::EndFontTag>::const_iterator cit = tagsToClose.begin();
-		vector<xml::EndFontTag>::const_iterator cen = tagsToClose.end();
-		for (; cit != cen; ++cit)
-			*xs << *cit;
+			vector<xml::EndFontTag>::const_iterator cit = tagsToClose.begin();
+			vector<xml::EndFontTag>::const_iterator cen = tagsToClose.end();
+			for (; cit != cen; ++cit)
+				*xs << *cit;
 
-		vector<xml::FontTag>::const_iterator sit = tagsToOpen.begin();
-		vector<xml::FontTag>::const_iterator sen = tagsToOpen.end();
-		for (; sit != sen; ++sit)
-			*xs << *sit;
+			vector<xml::FontTag>::const_iterator sit = tagsToOpen.begin();
+			vector<xml::FontTag>::const_iterator sen = tagsToOpen.end();
+			for (; sit != sen; ++sit)
+				*xs << *sit;
 
-		tagsToClose.clear();
-		tagsToOpen.clear();
+			tagsToClose.clear();
+			tagsToOpen.clear();
+		}
 
 		if (Inset const * inset = getInset(i)) {
 			if (!runparams.for_toc || inset->isInToc()) {
@@ -3396,7 +3401,8 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 	// FIXME, this code is just imported from XHTML
 	// I'm worried about what happens if a branch, say, is itself
 	// wrapped in some font stuff. I think that will not work.
-	xs->closeFontTags();
+	if (!ignore_fonts)
+		xs->closeFontTags();
 
 	// In listings, new lines are very important. Avoid generating one for the last line.
 	if (runparams.docbook_in_listing && !is_last_par)
diff --git a/src/Paragraph.h b/src/Paragraph.h
index 96c19c0..597a10b 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -214,7 +214,8 @@ public:
 							                   OutputParams const & runparams,
 							                   Font const & outerfont,
 							                   pos_type initial = 0,
-							                   bool is_last_par = false) const;
+							                   bool is_last_par = false,
+							                   bool ignore_fonts = false) const;
 
 	/// \return any material that has had to be deferred until after the
 	/// paragraph has closed.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index c0ad33e..ffd16d3 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -511,7 +511,7 @@ void makeParagraph(
 	// Open and close tags around each contained paragraph.
 	auto nextpar = par;
 	++nextpar;
-	auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end);
+	auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
 	for (auto & parXML : pars) {
 		if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
 			if (open_par)

commit 1f55f647c7cca9e17e6af817441726cfb83a5c10
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 30 23:56:16 2020 +0200

    DocBook: fix line issues around programlisting.

diff --git a/autotests/export/docbook/listings.xml b/autotests/export/docbook/listings.xml
index e65de60..1ed2694 100644
--- a/autotests/export/docbook/listings.xml
+++ b/autotests/export/docbook/listings.xml
@@ -5,6 +5,5 @@
 <title>Test document</title>
 <para>This is a programlisting: </para>
 <programlisting>First line of programlisting
-Second line of programlisting
-</programlisting>
+Second line of programlisting</programlisting>
 </article>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index a034e72..0e89381 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3319,7 +3319,8 @@ std::tuple<vector<xml::FontTag>, vector<xml::EndFontTag>> computeDocBookFontSwit
 std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
                                                       OutputParams const & runparams,
                                                       Font const & outerfont,
-                                                      pos_type initial) const
+                                                      pos_type initial,
+                                                      bool is_last_par) const
 {
 	// Track whether we have opened these tags
 	DocBookFontState fs;
@@ -3396,7 +3397,9 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 	// I'm worried about what happens if a branch, say, is itself
 	// wrapped in some font stuff. I think that will not work.
 	xs->closeFontTags();
-	if (runparams.docbook_in_listing)
+
+	// In listings, new lines are very important. Avoid generating one for the last line.
+	if (runparams.docbook_in_listing && !is_last_par)
 		*xs << xml::CR();
 
 	// Finalise the last (and most likely only) paragraph.
diff --git a/src/Paragraph.h b/src/Paragraph.h
index ee31403..96c19c0 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -213,7 +213,8 @@ public:
 	std::vector<docstring> simpleDocBookOnePar(Buffer const & buf,
 							                   OutputParams const & runparams,
 							                   Font const & outerfont,
-							                   pos_type initial = 0) const;
+							                   pos_type initial = 0,
+							                   bool is_last_par = false) const;
 
 	/// \return any material that has had to be deferred until after the
 	/// paragraph has closed.
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 848e4ae..93daab4 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -485,6 +485,9 @@ void InsetListings::docbook(XMLStream & xs, OutputParams const & rp) const
 {
 	InsetLayout const & il = getLayout();
 
+	if (!xs.isLastTagCR())
+		xs << xml::CR();
+
 	// Forge the attributes.
 	string attrs;
 	if (!il.docbookattr().empty())
@@ -517,6 +520,7 @@ void InsetListings::docbook(XMLStream & xs, OutputParams const & rp) const
 	// Done with the listing.
 	xs.endDivision();
 	xs << xml::EndTag(il.docbooktag());
+	xs << xml::CR();
 }
 
 
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 5323e57..c0ad33e 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -502,8 +502,6 @@ void makeParagraph(
 	//		or we're not in the last paragraph, anyway.
 	//   (ii) We didn't open it and docbook_in_par is true,
 	//		but we are in the first par, and there is a next par.
-	auto nextpar = par;
-	++nextpar;
 	bool const close_par = open_par && (!runparams.docbook_in_par);
 
 	// Determine if this paragraph has some real content. Things like new pages are not caught
@@ -511,7 +509,9 @@ void makeParagraph(
 	// Thus, remove all spaces (including new lines: \r, \n) before checking for emptiness.
 	// std::all_of allows doing this check without having to copy the string.
 	// Open and close tags around each contained paragraph.
-	auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0);
+	auto nextpar = par;
+	++nextpar;
+	auto pars = par->simpleDocBookOnePar(buf, runparams, text.outerFont(distance(begin, par)), 0, nextpar == end);
 	for (auto & parXML : pars) {
 		if (!std::all_of(parXML.begin(), parXML.end(), ::isspace)) {
 			if (open_par)

commit dbdcb4add4c8cbf036491051482c951f00793771
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 30 23:38:40 2020 +0200

    DocBook: fix font issues when a paragraph has an InsetNewline.

diff --git a/autotests/export/docbook/issue5165.xml b/autotests/export/docbook/issue5165.xml
index 2e24ebc..81d840d 100644
--- a/autotests/export/docbook/issue5165.xml
+++ b/autotests/export/docbook/issue5165.xml
@@ -4,9 +4,10 @@
 <article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
 <info>
 <title>Title</title>
-<author><personname>Author</personname></author>
+<author>
+<personname>Author</personname>
+</author>
 <date>Date</date>
 </info>
 <para>Content</para>
-
 </article>
\ No newline at end of file
diff --git a/autotests/export/docbook/labeling_list_nested.xml b/autotests/export/docbook/labeling_list_nested.xml
index 261605c..4ecb1c6 100644
--- a/autotests/export/docbook/labeling_list_nested.xml
+++ b/autotests/export/docbook/labeling_list_nested.xml
@@ -7,22 +7,19 @@
 <variablelist>
 <varlistentry>
 <term>LyX:</term>
-
 <listitem>
-
+<para />
 <variablelist>
 <varlistentry>
 <term>lyx16</term>
-
 <listitem>
-<para> LyX 1.6 file format (lyx2lyx)</para>
+<para>LyX 1.6 file format (lyx2lyx)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>lyx21</term>
-
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 </variablelist>
@@ -30,27 +27,23 @@
 </varlistentry>
 <varlistentry>
 <term>LyX:</term>
-
 <listitem>
-
+<para />
 <variablelist>
 <varlistentry>
 <term>lyx16</term>
-
 <listitem>
-<para> LyX 1.6 file format (lyx2lyx)</para>
+<para>LyX 1.6 file format (lyx2lyx)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>lyx21</term>
-
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 </variablelist>
 </listitem>
 </varlistentry>
 </variablelist>
-
 </article>
\ No newline at end of file
diff --git a/autotests/export/docbook/list_depth.xml b/autotests/export/docbook/list_depth.xml
index 3833931..5eaa83c 100644
--- a/autotests/export/docbook/list_depth.xml
+++ b/autotests/export/docbook/list_depth.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This DocBook file was created by LyX 2.4.0dev
   See http://www.lyx.org/ for more information -->
-<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.1">
+<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
 <title>Test document</title>
 <itemizedlist>
 <listitem>
@@ -9,5 +9,4 @@
 <para>Content.</para>
 </listitem>
 </itemizedlist>
-
-</article>
+</article>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 91c8bf3..a034e72 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3345,12 +3345,15 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 		if (isDeleted(i))
 			continue;
 
-		// If this is an InsetNewline, generate a new paragraph.
+		// If this is an InsetNewline, generate a new paragraph. Also reset the fonts, so that tags are closed in
+		// this paragraph.
 		if (getInset(i) != nullptr && getInset(i)->lyxCode() == NEWLINE_CODE) {
+			xs->closeFontTags();
 			generatedParagraphs.push_back(os.str());
 			os = odocstringstream();
 			delete xs;
 			xs = new XMLStream(os);
+			font_old = outerfont.fontInfo();
 		}
 
 		// Determine which tags should be opened or closed.

commit 2e41c63d058dcb2ab9d0912daa582ce2094e9124
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 30 23:29:02 2020 +0200

    DocBook: fix issue with fonts.

diff --git a/autotests/export/docbook/issue1732_charstyles-docbook.xml b/autotests/export/docbook/issue1732_charstyles-docbook.xml
index 0ed9b87..fc9bffe 100644
--- a/autotests/export/docbook/issue1732_charstyles-docbook.xml
+++ b/autotests/export/docbook/issue1732_charstyles-docbook.xml
@@ -3,5 +3,4 @@
   See http://www.lyx.org/ for more information -->
 <article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
 <para><emphasis role='bold'>Fett </emphasis><emphasis>hervorgehoben</emphasis> <code>monospace</code><emphasis role='underline'> unterstrichen.</emphasis></para>
-
 </article>
\ No newline at end of file
diff --git a/src/xml.cpp b/src/xml.cpp
index 150f4c5..dd9790f 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -208,9 +208,6 @@ bool XMLStream::closeFontTags()
 		if (**curtag != xml::parsep_tag)
 			os_ << (*curtag)->writeEndTag();
 		tag_stack_.pop_back();
-		// this shouldn't happen, since then the font tags
-		// weren't in any other tag.
-		LASSERT(!tag_stack_.empty(), return true);
 		if (tag_stack_.empty())
 			return true;
 		curtag = &tag_stack_.back();

commit a92f1c3ac3de30fbcf0c3313346a26557441bd0e
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 30 22:08:01 2020 +0200

    DocBook: fixes in bibliography (missing new line at the end).

diff --git a/autotests/export/docbook/easy.xml b/autotests/export/docbook/easy.xml
index 883c982..e301321 100644
--- a/autotests/export/docbook/easy.xml
+++ b/autotests/export/docbook/easy.xml
@@ -12,8 +12,9 @@
 <para>I am an abstract</para>
 <para>I am also an abstract</para>
 </abstract>
+
 </info>
-<section xml:id="sec.Sec-1-0">
+<section xml:id="sec.Sec-1">
 <title>I am the first section </title>
 <para>I am the first paragraph of the first section. </para>
 <para>I am the second paragraph of the first section. </para>
@@ -50,7 +51,7 @@
 <section>
 <title>I am the second section </title>
 <para>I am the only paragraph of the second section. <link xlink:href="http://example.org">Hyperlink.</link> “Text between quotes.”</para>
-<para>See <xref linkend="sec.Sec-1-0" />.</para>
+<para>See <xref linkend="sec.Sec-1" />.</para>
 </section>
 <section>
 <title>I am the third section and I deal with star sections</title>
diff --git a/autotests/export/docbook/issue_infinite_loop.xml b/autotests/export/docbook/issue_infinite_loop.xml
index d6e55ee..e262ed4 100644
--- a/autotests/export/docbook/issue_infinite_loop.xml
+++ b/autotests/export/docbook/issue_infinite_loop.xml
@@ -5,7 +5,8 @@
 <title>William Shakespeare</title>
 <section>
 <title>Publications</title>
-<bibliography>First Folio. Me. 1623..</bibliography>
 </section>
-
+<bibliography>
+<bibliomixed xml:id='firstref'>First Folio. Me. 1623..</bibliomixed>
+</bibliography>
 </article>
\ No newline at end of file
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index c03a8e2..05fd23d 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -1411,6 +1411,7 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const
 
 	// Footer for bibliography.
 	xs << xml::EndTag("bibliography");
+	xs << xml::CR();
 }
 
 

commit 628bfae0201e29749a3499b38664c62a1d7da31e
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 30 22:05:40 2020 +0200

    DocBook: fixes in lists.
    
    Actually output something when list item is empty. XMLStream discarded the sequence StartTag/EndTag (nothing in between).
    
    New-line behaviour around term in description lists.

diff --git a/autotests/export/docbook/Development.xml b/autotests/export/docbook/Development.xml
index d0bc9a4..9ec891d 100644
--- a/autotests/export/docbook/Development.xml
+++ b/autotests/export/docbook/Development.xml
@@ -6,7 +6,7 @@
 <subtitle>Version 2.3.x</subtitle>
 <section>
 <title>File formats</title>
-<section xml:id="sec.When-is-an-0">
+<section xml:id="sec.When-is-an">
 <title>When is an update of the .lyx file format number needed?</title>
 <para>When you are working on a new feature you may ask yourself whether it needs an update of the .lyx file format number. Whether an update is needed or not is not always obvious. Rule of thumb: </para>
 <blockquote>
@@ -17,30 +17,30 @@
 <varlistentry>
 <term>New&#xA0;document&#xA0;setting</term>
 <listitem>
-<para> Whenever you introduce a new setting that is stored in the document header, a file format update is needed.</para>
+<para>Whenever you introduce a new setting that is stored in the document header, a file format update is needed.</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>Removed&#xA0;document&#xA0;setting</term>
 <listitem>
-<para> If a certain setting becomes obsolete and gets removed, a file format update is needed.</para>
+<para>If a certain setting becomes obsolete and gets removed, a file format update is needed.</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>New&#xA0;valid&#xA0;value&#xA0;for&#xA0;an&#xA0;existing&#xA0;setting,</term>
 <listitem>
-<para> e.&#x2009;g.</para>
+<para>e.&#x2009;g.</para>
 <variablelist>
 <varlistentry>
 <term>Automatically&#xA0;loaded&#xA0;math&#xA0;package</term>
 <listitem>
-<para> The reason for this is that there is no true ERT inset for math formulas: Each command is parsed, and if a user happens to define a local command with the same name as a command that triggers an automatic load of a package, they need to be able to switch off the automatic loading of that package. This switch is stored by the use_package header setting.</para>
+<para>The reason for this is that there is no true ERT inset for math formulas: Each command is parsed, and if a user happens to define a local command with the same name as a command that triggers an automatic load of a package, they need to be able to switch off the automatic loading of that package. This switch is stored by the use_package header setting.</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>New&#xA0;language</term>
 <listitem>
-<para> that is stored in \language. </para>
+<para>that is stored in \language. </para>
 </listitem>
 </varlistentry>
 </variablelist>
@@ -49,49 +49,49 @@
 <varlistentry>
 <term>New&#xA0;inset</term>
 <listitem>
-<para> Of course a new inset requires a file format update.</para>
+<para>Of course a new inset requires a file format update.</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>New&#xA0;style</term>
 <listitem>
-<para> If a new style or inset layout is added to any layout file or module shipped with LyX, then a new file format is needed in the master (development) branch. It is possible to backport new styles to the stable version without a file format change.</para>
+<para>If a new style or inset layout is added to any layout file or module shipped with LyX, then a new file format is needed in the master (development) branch. It is possible to backport new styles to the stable version without a file format change.</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>Removed&#xA0;style</term>
 <listitem>
-<para> If a style or inset layout is removed in any layout file or module shipped with LyX, a new file format is required.</para>
+<para>If a style or inset layout is removed in any layout file or module shipped with LyX, a new file format is required.</para>
 </listitem>
 </varlistentry>
 </variablelist>
 <para>However, <emphasis role='bold'>new</emphasis> layouts and modules do <emphasis role='bold'>not</emphasis> require a file format update (changed 03/16). </para>
 <para>If you are still unsure, please ask on the development list.</para>
-<section xml:id="par.export-test-output-formats-1">
+<section xml:id="par.export-test-output-formats">
 <title>Output formats</title>
 <para>The following output formats are currently tested for each sample document:</para>
 <variablelist>
 <varlistentry>
 <term>LyX:</term>
 <listitem>
-
+<para />
 <variablelist>
 <varlistentry>
 <term>lyx16</term>
 <listitem>
-<para> LyX 1.6 file format (lyx2lyx)</para>
+<para>LyX 1.6 file format (lyx2lyx)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>lyx21</term>
 <listitem>
-<para> LyX 2.1 file format (lyx2lyx)</para>
+<para>LyX 2.1 file format (lyx2lyx)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>xhtml</term>
 <listitem>
-<para> LyXHTML (native LyX HTML export)</para>
+<para>LyXHTML (native LyX HTML export)</para>
 </listitem>
 </varlistentry>
 </variablelist>
@@ -100,54 +100,54 @@
 <varlistentry>
 <term>LyX&#xA0;+&#xA0;LaTeX:</term>
 <listitem>
-
+<para />
 <variablelist>
 <varlistentry>
 <term>dvi</term>
 <listitem>
-<para> DVI (8-bit latex)</para>
+<para>DVI (8-bit latex)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>dvi3_texF</term>
 <listitem>
-<para> DVI (LuaTeX with 8-bit TeX fonts)</para>
+<para>DVI (LuaTeX with 8-bit TeX fonts)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>dvi3_systemF</term>
 <listitem>
-<para> DVI (LuaTeX with Unicode fonts)</para>
+<para>DVI (LuaTeX with Unicode fonts)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdf2</term>
 <listitem>
-<para> PDF (pdflatex)</para>
+<para>PDF (pdflatex)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdf4_texF</term>
 <listitem>
-<para> PDF (XeTeX with 8-bit TeX fonts)</para>
+<para>PDF (XeTeX with 8-bit TeX fonts)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdf4_systemF</term>
 <listitem>
-<para> PDF (XeTeX with Unicode fonts)</para>
+<para>PDF (XeTeX with Unicode fonts)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdf5_texF</term>
 <listitem>
-<para> PDF (LuaTeX with 8-bit TeX fonts)</para>
+<para>PDF (LuaTeX with 8-bit TeX fonts)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdf5_systemF</term>
 <listitem>
-<para> PDF (LuaTeX with Unicode fonts)</para>
+<para>PDF (LuaTeX with Unicode fonts)</para>
 </listitem>
 </varlistentry>
 </variablelist>
@@ -156,18 +156,18 @@
 <varlistentry>
 <term>LyX&#xA0;+&#xA0;LaTeX&#xA0;+&#xA0;postprocessing:</term>
 <listitem>
-
+<para />
 <variablelist>
 <varlistentry>
 <term>pdf</term>
 <listitem>
-<para> DVI -> PS (dvips) -> PDF (ps2pdf)</para>
+<para>DVI -> PS (dvips) -> PDF (ps2pdf)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdf3</term>
 <listitem>
-<para> DVI -> PDF (dvipdfm)</para>
+<para>DVI -> PDF (dvipdfm)</para>
 </listitem>
 </varlistentry>
 </variablelist>
@@ -176,90 +176,90 @@
 <varlistentry>
 <term>not&#xA0;tested:</term>
 <listitem>
-<para> (or only if set as default output format in the document source)</para>
+<para>(or only if set as default output format in the document source)</para>
 <variablelist>
 <varlistentry>
 <term>latex</term>
 <listitem>
-<para> LaTeX (plain)</para>
+<para>LaTeX (plain)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>luatex</term>
 <listitem>
-<para> LaTeX (LuaTeX)</para>
+<para>LaTeX (LuaTeX)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>dviluatex</term>
 <listitem>
-<para> LaTeX (dviluatex)</para>
+<para>LaTeX (dviluatex)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>pdflatex</term>
 <listitem>
-<para> LaTeX (pdflatex)</para>
+<para>LaTeX (pdflatex)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>platex</term>
 <listitem>
-<para> LaTeX (pLaTeX)</para>
+<para>LaTeX (pLaTeX)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>xetex</term>
 <listitem>
-<para> LaTeX (XeTeX) </para>
+<para>LaTeX (XeTeX) </para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>eps3</term>
 <listitem>
-<para> EPS (encapsulated Postscript) (cropped)</para>
+<para>EPS (encapsulated Postscript) (cropped)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>ps</term>
 <listitem>
-<para> DVI -> Postscript (dvips)</para>
+<para>DVI -> Postscript (dvips)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>odf</term>
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>text</term>
 <listitem>
-<para> (nor text2, ..., text4)</para>
+<para>(nor text2, ..., text4)</para>
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>textparagraph</term>
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>word</term>
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>word2</term>
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 <varlistentry>
 <term>wordhtml</term>
 <listitem>
-<para> </para>
+<para />
 </listitem>
 </varlistentry>
 </variablelist>
@@ -269,5 +269,4 @@
 </section>
 </section>
 </section>
-
 </article>
\ No newline at end of file
diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index b316b14..f6d17c3 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -234,6 +234,7 @@ Style Description
   DocBookItemTag        listitem
   DocBookItemInnerTag   para
   DocBookItemLabelTag   term
+  DocBookItemLabelTagType   paragraph
 End
 
 
diff --git a/lib/layouts/egs.layout b/lib/layouts/egs.layout
index 0298b69..6ee01ed 100644
--- a/lib/layouts/egs.layout
+++ b/lib/layouts/egs.layout
@@ -269,6 +269,7 @@ Style Description
 	DocBookItemTag        listitem
 	DocBookItemInnerTag   para
 	DocBookItemLabelTag   term
+	DocBookItemLabelTagType   paragraph
 End
 
 
diff --git a/lib/layouts/hollywood.layout b/lib/layouts/hollywood.layout
index 38767c4..7d10bb9 100644
--- a/lib/layouts/hollywood.layout
+++ b/lib/layouts/hollywood.layout
@@ -142,6 +142,7 @@ Style Description
 	DocBookItemTag        listitem
 	DocBookItemInnerTag   para
 	DocBookItemLabelTag   term
+	DocBookItemLabelTagType   paragraph
 End
 
 
diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc
index 1a41a4d..9524ec0 100644
--- a/lib/layouts/scrclass.inc
+++ b/lib/layouts/scrclass.inc
@@ -69,6 +69,7 @@ Style Labeling
 	DocBookItemTag        listitem
 	DocBookItemInnerTag   para
 	DocBookItemLabelTag   term
+	DocBookItemLabelTagType   paragraph
 End
 
 Input stdsections.inc
diff --git a/lib/layouts/svcommon.inc b/lib/layouts/svcommon.inc
index 57573cc..67ed799 100644
--- a/lib/layouts/svcommon.inc
+++ b/lib/layouts/svcommon.inc
@@ -620,6 +620,7 @@ Style Description
 	DocBookItemTag        listitem
 	DocBookItemInnerTag   para
 	DocBookItemLabelTag   term
+	DocBookItemLabelTagType   paragraph
 End
 
 Style Petit
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index af836da..5323e57 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -253,6 +253,25 @@ void closeTag(XMLStream & xs, const std::string & tag, const std::string & tagty
 }
 
 
+void compTag(XMLStream & xs, const std::string & tag, const std::string & attr, const std::string & tagtype)
+{
+	if (tag.empty() || tag == "NONE")
+		return;
+
+	// Special case for <para>: always considered as a paragraph.
+	if (tag == "para" || tagtype == "paragraph" || tagtype == "block") {
+		if (!xs.isLastTagCR())
+			xs << xml::CR();
+		xs << xml::CompTag(tag, attr);
+		xs << xml::CR();
+	} else if (tagtype == "inline") {
+		xs << xml::CompTag(tag, attr);
+	} else {
+		xs.writeError("Unrecognised tag type '" + tagtype + "' for '" + tag + "'");
+	}
+}
+
+
 // Higher-level convenience functions.
 
 void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
@@ -690,9 +709,8 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
 			}
 		} else {
 			// DocBook doesn't like emptiness.
-			openTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(),
+			compTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnerattr(),
 			        par->layout().docbookiteminnertagtype());
-			closeTag(xs, par->layout().docbookiteminnertag(), par->layout().docbookiteminnertagtype());
 		}
 
 		// If the next item is deeper, it must go entirely within this item (do it recursively).
diff --git a/src/xml.cpp b/src/xml.cpp
index 557bb01..150f4c5 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -651,7 +651,8 @@ docstring xml::cleanID(docstring const & orig)
 	// as both of them would be transformed as "a.b". With this procedure, one will become "a.b" and the other "a.b-1".
 	if (mangle && mangledNames.find(content) != mangledNames.end()) {
 		int & mangleID = tMangleID.localData();
-		content += "-" + convert<docstring>(mangleID);
+		if (mangleID > 0)
+			content += "-" + convert<docstring>(mangleID);
 		mangleID += 1;
 	}
 

-----------------------------------------------------------------------

Summary of changes:
 autotests/export/docbook/Development.xml           |   83 ++++++++++----------
 autotests/export/docbook/Tufte_Book.xml            |   28 ++++---
 autotests/export/docbook/easy.xml                  |    5 +-
 .../docbook/issue1732_charstyles-docbook.xml       |    1 -
 autotests/export/docbook/issue5165.xml             |    5 +-
 autotests/export/docbook/issue_infinite_loop.xml   |    5 +-
 autotests/export/docbook/labeling_list_nested.xml  |   19 ++---
 autotests/export/docbook/list_depth.xml            |    5 +-
 autotests/export/docbook/listings.xml              |    3 +-
 autotests/export/docbook/lists.xml                 |    2 +-
 autotests/export/docbook/math_in_font.xml          |    8 +-
 autotests/export/docbook/mathml_ns_entities.xml    |   29 ++++---
 lib/layouts/beamer.layout                          |    1 +
 lib/layouts/egs.layout                             |    1 +
 lib/layouts/hollywood.layout                       |    1 +
 lib/layouts/scrclass.inc                           |    1 +
 lib/layouts/stdinsets.inc                          |    3 +-
 lib/layouts/svcommon.inc                           |    1 +
 lib/layouts/tufte-book.layout                      |    2 +
 src/Paragraph.cpp                                  |   48 +++++++----
 src/Paragraph.h                                    |    4 +-
 src/insets/InsetBibtex.cpp                         |    1 +
 src/insets/InsetListings.cpp                       |    4 +
 src/insets/InsetMarginal.cpp                       |    1 +
 src/mathed/InsetMathHull.cpp                       |   12 ++-
 src/output_docbook.cpp                             |   28 ++++++-
 src/xml.cpp                                        |    6 +-
 27 files changed, 178 insertions(+), 129 deletions(-)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list