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"> <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> <info>
<title>Title</title> <title>Title</title>
<subjectset role='pacs'><subject><subjectterm>PACS code1 <!-- \and --> <subjectset role='pacs'>
<subject><subjectterm>PACS code1 <!-- \and -->
PACS code2 <!-- \and --> PACS code2 <!-- \and -->
more</subjectterm></subject></subjectset><subjectset role='mcs'><subject><subjectterm>MSC code1 <!-- \and --> more</subjectterm></subject>
MSC code2 <!-- \and --> </subjectset>
more</subjectterm></subject></subjectset><keywordset><keyword>First keyword <!-- \and --> <keywordset>
<keyword>First keyword <!-- \and -->
Second 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> <para>Abstract text. </para>
</abstract> </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.) # - Springer. (The svmono_light should still pass.)
export/templates/Books/Springer.*/.*_docbook5 export/templates/Books/Springer.*/.*_docbook5
!export/export/docbook/svmono_light_docbook5 !export/export/docbook/svmono_light_docbook5
!export/export/docbook/svglo_docbook5
export/export/docbook/sv.*_docbook5 export/export/docbook/sv.*_docbook5
# - scrbook with too many customisations. # - scrbook with too many customisations.
export/templates/Theses/PhD_Thesis/.*_docbook5 export/templates/Theses/PhD_Thesis/.*_docbook5

View File

@ -74,6 +74,7 @@ InsetLayout Flex:PACS
LabelString "PACS" LabelString "PACS"
DocBookTag subjectset DocBookTag subjectset
DocBookAttr role='pacs' DocBookAttr role='pacs'
DocBookTagType block
DocBookItemWrapperTag subject DocBookItemWrapperTag subject
DocBookItemWrapperTagType paragraph DocBookItemWrapperTagType paragraph
DocBookItemTag subjectterm DocBookItemTag subjectterm
@ -89,6 +90,7 @@ InsetLayout Flex:Subclass
LabelString "Mathematics Subject Classification" LabelString "Mathematics Subject Classification"
DocBookTag subjectset DocBookTag subjectset
DocBookAttr role='mcs' DocBookAttr role='mcs'
DocBookTagType block
DocBookItemWrapperTag subject DocBookItemWrapperTag subject
DocBookItemWrapperTagType paragraph DocBookItemWrapperTagType paragraph
DocBookItemTag subjectterm DocBookItemTag subjectterm
@ -104,6 +106,7 @@ InsetLayout Flex:CRSC
LabelString "CR Subject Classification" LabelString "CR Subject Classification"
DocBookTag subjectset DocBookTag subjectset
DocBookAttr role='crsc' DocBookAttr role='crsc'
DocBookTagType block
DocBookItemWrapperTag subject DocBookItemWrapperTag subject
DocBookItemWrapperTagType paragraph DocBookItemWrapperTagType paragraph
DocBookItemTag subjectterm DocBookItemTag subjectterm

View File

@ -625,7 +625,7 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op
// Start outputting this inset. // Start outputting this inset.
if (opts & WriteOuterTag) { if (opts & WriteOuterTag) {
if (!il.docbookwrappertag().empty() && il.docbookwrappertag() != "NONE" && il.docbookwrappertag() != "IGNORE") 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") { if (!il.docbooktag().empty() && il.docbooktag() != "NONE" && il.docbooktag() != "IGNORE") {
docstring attrs = docstring(); docstring attrs = docstring();
@ -633,14 +633,14 @@ void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions op
attrs += from_ascii(il.docbookattr()); attrs += from_ascii(il.docbookattr());
if (il.docbooktag() == "link") if (il.docbooktag() == "link")
attrs += from_ascii(" xlink:href=\"") + text_.asString() + from_ascii("\""); 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") 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") 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. // 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 (opts & WriteOuterTag) {
if (!il.docbookitemtag().empty() && il.docbookitemtag() != "NONE" && il.docbookitemtag() != "IGNORE") 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") 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") 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") if (!il.docbookwrappertag().empty() && il.docbookwrappertag() != "NONE" && il.docbookwrappertag() != "IGNORE")
xs << xml::EndTag(il.docbookwrappertag()); xml::closeTag(xs, il.docbookwrappertag(), il.docbookwrappertagtype());
} }
} }