From 1176fab1d479b21a2cc0d165cf341c99ad0661c1 Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Wed, 18 Nov 2020 05:54:08 +0100 Subject: [PATCH] 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 47c242a877..c7d3a4071b 100644 --- a/autotests/export/docbook/svglo.xml +++ b/autotests/export/docbook/svglo.xml @@ -4,13 +4,22 @@
Title -PACS code1 + +PACS code1 PACS code2 -moreMSC code1 -MSC code2 -moreFirst keyword +more + + +First keyword Second keyword -More +More + + +MSC code1 +MSC code2 +more + + Abstract text. diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests index 754bea361d..fe3aad4533 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 3e9503d3b3..25d146a3a3 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 d33a43bcbe..fe3d160710 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()); } }