[LyX/master] DocBook: make InsetText respect tag types.

Thibaut Cuvelier tcuvelier at lyx.org
Fri Nov 20 17:11:32 UTC 2020


commit 1176fab1d479b21a2cc0d165cf341c99ad0661c1
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Wed Nov 18 05:54:08 2020 +0100

    DocBook: make InsetText respect tag types.
---
 autotests/export/docbook/svglo.xml  |   19 ++++++++++++++-----
 development/autotests/invertedTests |    1 +
 lib/layouts/svglobal3.layout        |    3 +++
 src/insets/InsetText.cpp            |   16 ++++++++--------
 4 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/autotests/export/docbook/svglo.xml b/autotests/export/docbook/svglo.xml
index 47c242a..c7d3a40 100644
--- a/autotests/export/docbook/svglo.xml
+++ b/autotests/export/docbook/svglo.xml
@@ -4,13 +4,22 @@
 <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>
-<subjectset role='pacs'><subject><subjectterm>PACS code1 <!-- \and  -->
+<subjectset role='pacs'>
+<subject><subjectterm>PACS code1 <!-- \and  -->
 PACS code2 <!-- \and  -->
-more</subjectterm></subject></subjectset><subjectset role='mcs'><subject><subjectterm>MSC code1 <!-- \and  -->
-MSC code2 <!-- \and  -->
-more</subjectterm></subject></subjectset><keywordset><keyword>First keyword <!-- \and  -->
+more</subjectterm></subject>
+</subjectset>
+<keywordset>
+<keyword>First keyword <!-- \and  -->
 Second keyword <!-- \and  -->
-More</keyword></keywordset><abstract>
+More</keyword>
+</keywordset>
+<subjectset role='mcs'>
+<subject><subjectterm>MSC code1 <!-- \and  -->
+MSC code2 <!-- \and  -->
+more</subjectterm></subject>
+</subjectset>
+<abstract>
 <para>Abstract text.   </para>
 </abstract>
 
diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests
index 754bea3..fe3aad4 100644
--- a/development/autotests/invertedTests
+++ b/development/autotests/invertedTests
@@ -443,6 +443,7 @@ export/examples/Articles/American_Astronomical_Society_%28AASTeX_v._6.2%29_docbo
 #   - Springer. (The svmono_light should still pass.)
 export/templates/Books/Springer.*/.*_docbook5
 !export/export/docbook/svmono_light_docbook5
+!export/export/docbook/svglo_docbook5
 export/export/docbook/sv.*_docbook5
 #   - scrbook with too many customisations.
 export/templates/Theses/PhD_Thesis/.*_docbook5
diff --git a/lib/layouts/svglobal3.layout b/lib/layouts/svglobal3.layout
index 3e9503d..25d146a 100644
--- a/lib/layouts/svglobal3.layout
+++ b/lib/layouts/svglobal3.layout
@@ -74,6 +74,7 @@ InsetLayout Flex:PACS
 	LabelString	"PACS"
 	DocBookTag          subjectset
 	DocBookAttr         role='pacs'
+	DocBookTagType      block
 	DocBookItemWrapperTag      subject
 	DocBookItemWrapperTagType  paragraph
 	DocBookItemTag      subjectterm
@@ -89,6 +90,7 @@ InsetLayout Flex:Subclass
 	LabelString	"Mathematics Subject Classification"
 	DocBookTag          subjectset
 	DocBookAttr         role='mcs'
+	DocBookTagType      block
 	DocBookItemWrapperTag      subject
 	DocBookItemWrapperTagType  paragraph
 	DocBookItemTag      subjectterm
@@ -104,6 +106,7 @@ InsetLayout Flex:CRSC
 	LabelString	"CR Subject Classification"
 	DocBookTag          subjectset
 	DocBookAttr         role='crsc'
+	DocBookTagType      block
 	DocBookItemWrapperTag      subject
 	DocBookItemWrapperTagType  paragraph
 	DocBookItemTag      subjectterm
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index d33a43b..fe3d160 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -625,7 +625,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op
 	// Start outputting this inset.
 	if (opts & WriteOuterTag) {
 		if (!il.docbookwrappertag().empty() && il.docbookwrappertag() != "NONE" && il.docbookwrappertag() != "IGNORE")
-			xs << xml::StartTag(il.docbookwrappertag(), il.docbookwrapperattr());
+			xml::openTag(xs, il.docbookwrappertag(), il.docbookwrapperattr(), il.docbookwrappertagtype());
 
 		if (!il.docbooktag().empty() && il.docbooktag() != "NONE" && il.docbooktag() != "IGNORE") {
 			docstring attrs = docstring();
@@ -633,14 +633,14 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op
 				attrs += from_ascii(il.docbookattr());
 			if (il.docbooktag() == "link")
 				attrs += from_ascii(" xlink:href=\"") + text_.asString() + from_ascii("\"");
-			xs << xml::StartTag(il.docbooktag(), attrs);
+			xml::openTag(xs, il.docbooktag(), attrs, il.docbooktagtype());
 		}
 
 		if (!il.docbookitemwrappertag().empty() && il.docbookitemwrappertag() != "NONE" && il.docbookitemwrappertag() != "IGNORE")
-			xs << xml::StartTag(il.docbookitemwrappertag(), il.docbookitemwrapperattr());
+			xml::openTag(xs, il.docbookitemwrappertag(), il.docbookitemwrapperattr(), il.docbookitemwrappertagtype());
 
 		if (!il.docbookitemtag().empty() && il.docbookitemtag() != "NONE" && il.docbookitemtag() != "IGNORE")
-			xs << xml::StartTag(il.docbookitemtag(), il.docbookitemattr());
+			xml::openTag(xs, il.docbookitemtag(), il.docbookitemattr(), il.docbookitemtagtype());
 	}
 
 	// No need for labels that are generated from counters. They should be handled by the external DocBook processor.
@@ -657,16 +657,16 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op
 
 	if (opts & WriteOuterTag) {
 		if (!il.docbookitemtag().empty() && il.docbookitemtag() != "NONE" && il.docbookitemtag() != "IGNORE")
-			xs << xml::EndTag(il.docbookitemtag());
+			xml::closeTag(xs, il.docbookitemtag(), il.docbookitemtagtype());
 
 		if (!il.docbookitemwrappertag().empty() && il.docbookitemwrappertag() != "NONE" && il.docbookitemwrappertag() != "IGNORE")
-			xs << xml::EndTag(il.docbookitemwrappertag());
+			xml::closeTag(xs, il.docbookitemwrappertag(), il.docbookitemwrappertagtype());
 
 		if (!il.docbooktag().empty() && il.docbooktag() != "NONE" && il.docbooktag() != "IGNORE")
-			xs << xml::EndTag(il.docbooktag());
+			xml::closeTag(xs, il.docbooktag(), il.docbooktagtype());
 
 		if (!il.docbookwrappertag().empty() && il.docbookwrappertag() != "NONE" && il.docbookwrappertag() != "IGNORE")
-			xs << xml::EndTag(il.docbookwrappertag());
+			xml::closeTag(xs, il.docbookwrappertag(), il.docbookwrappertagtype());
 	}
 }
 


More information about the lyx-cvs mailing list