DocBook: make InsetText respect tag types.

This commit is contained in:
Thibaut Cuvelier 2020-11-18 05:54:08 +01:00
parent 3a02251bfa
commit 1176fab1d4
4 changed files with 26 additions and 13 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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());
}
}