[LyX/master] DocBook: fix font issues when a paragraph has an InsetNewline.
Thibaut Cuvelier
tcuvelier at lyx.org
Sat Sep 19 18:18:56 UTC 2020
commit 9d3a717ef1eda27ab2b58ae84b483d044364e156
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.
---
autotests/export/docbook/issue5165.xml | 5 +++--
autotests/export/docbook/labeling_list_nested.xml | 19 ++++++-------------
autotests/export/docbook/list_depth.xml | 5 ++---
src/Paragraph.cpp | 5 ++++-
4 files changed, 15 insertions(+), 19 deletions(-)
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 aad1ccf..b4e4bc3 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3358,12 +3358,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.
More information about the lyx-cvs
mailing list