mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
DocBook: implement REVTeX.
Improvements to abstract detection: it can now contain lists or anything with a higher depth. Implement video floats.
This commit is contained in:
parent
13ab1a4d8b
commit
dae0640436
@ -453,7 +453,7 @@ export/examples/.*/American_Mathematical_Society_%28AMS%29_docbook5
|
|||||||
export/examples/Articles/American_Chemical_Society_%28ACS%29_docbook5
|
export/examples/Articles/American_Chemical_Society_%28ACS%29_docbook5
|
||||||
# - A&A: formula with two references (only one xml:id allowed per <equation> tag).
|
# - A&A: formula with two references (only one xml:id allowed per <equation> tag).
|
||||||
export/examples/Articles/Astronomy_%26_Astrophysics_docbook5
|
export/examples/Articles/Astronomy_%26_Astrophysics_docbook5
|
||||||
# - Elsevier: footnotes in the metadata (author footnotes are definitely not supported, though).
|
# - Elsevier: footnotes in the metadata (author footnotes are not supported, except maybe through annotations).
|
||||||
export/templates/Articles/Elsevier_docbook5
|
export/templates/Articles/Elsevier_docbook5
|
||||||
# - Branches may cause problems (especially when mixing with parts that must go in <info>).
|
# - Branches may cause problems (especially when mixing with parts that must go in <info>).
|
||||||
export/export/latex/languages/supported-languages_(|babel|babel_auto-legacy)_?docbook5
|
export/export/latex/languages/supported-languages_(|babel|babel_auto-legacy)_?docbook5
|
||||||
@ -493,6 +493,12 @@ export/examples/(es|fr)/Modules/Linguistics_docbook5
|
|||||||
export/examples/ko/cjk-ko-doc_docbook5
|
export/examples/ko/cjk-ko-doc_docbook5
|
||||||
# - Metadata in abstract paragraph.
|
# - Metadata in abstract paragraph.
|
||||||
export/templates/Articles/Springers_Global_Journal_Template_%28V._3%29_docbook5
|
export/templates/Articles/Springers_Global_Journal_Template_%28V._3%29_docbook5
|
||||||
|
# - Sweave impossible to implement. Document irremediably wrong (no .bib file, still referenced in the text).
|
||||||
|
export/templates/Articles/R_Journal_docbook5
|
||||||
|
# - Misplaced acknowledgements (fixable).
|
||||||
|
export/templates/Articles/REVTeX_%28V._4%29_docbook5
|
||||||
|
# - Forbidden inlines, equation in formatting, broken references, float in paragraphs, videos.
|
||||||
|
export/templates/Articles/REVTeX_%28V._4.1%29_docbook5
|
||||||
|
|
||||||
Sublabel: docbook poster
|
Sublabel: docbook poster
|
||||||
# Posters cannot be properly exported, the LyX documents are too far from
|
# Posters cannot be properly exported, the LyX documents are too far from
|
||||||
|
@ -31,3 +31,4 @@ export/export/docbook/Hollywood_docbook5
|
|||||||
export/templates/Letters/French_Letter_%28lettre%29_docbook5
|
export/templates/Letters/French_Letter_%28lettre%29_docbook5
|
||||||
export/templates/Letters/Letter_%28Standard_Class%29_docbook5
|
export/templates/Letters/Letter_%28Standard_Class%29_docbook5
|
||||||
export/templates/Articles/Springers_Global_Journal_Template_%28V._3%29_docbook5
|
export/templates/Articles/Springers_Global_Journal_Template_%28V._3%29_docbook5
|
||||||
|
export/templates/Articles/REVTeX_%28V._4%29_docbook5
|
||||||
|
@ -49,7 +49,11 @@ Style Terms
|
|||||||
End
|
End
|
||||||
|
|
||||||
Style Keywords
|
Style Keywords
|
||||||
CopyStyle Terms
|
CopyStyle Terms
|
||||||
LatexName keywords
|
LatexName keywords
|
||||||
LabelString "Keywords:"
|
LabelString "Keywords:"
|
||||||
|
DocBookTag keyword
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag keywordset
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
@ -215,10 +215,11 @@ Style Thanks
|
|||||||
CopyStyle Address
|
CopyStyle Address
|
||||||
LatexName thanks
|
LatexName thanks
|
||||||
LabelString "Thanks:"
|
LabelString "Thanks:"
|
||||||
DocBookTag para
|
DocBookTag personname
|
||||||
DocBookWrapperTag acknowledgements
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag othercredit
|
||||||
DocBookWrapperMergeWithPrevious true
|
DocBookWrapperMergeWithPrevious true
|
||||||
DocBookInInfo never
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,6 +226,16 @@ Style PACS
|
|||||||
CopyStyle Keywords
|
CopyStyle Keywords
|
||||||
LatexName pacs
|
LatexName pacs
|
||||||
LabelString "Physics and Astronomy Classification System number:"
|
LabelString "Physics and Astronomy Classification System number:"
|
||||||
|
DocBookTag subjectset
|
||||||
|
DocBookAttr role='pacs'
|
||||||
|
DocBookTagType block
|
||||||
|
DocBookItemWrapperTag subject
|
||||||
|
DocBookItemWrapperTagType paragraph
|
||||||
|
DocBookItemTag subjectterm
|
||||||
|
DocBookItemTagType inline
|
||||||
|
DocBookWrapperTag NONE
|
||||||
|
DocBookWrapperAttr ""
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -233,6 +243,16 @@ Style MSC
|
|||||||
CopyStyle Keywords
|
CopyStyle Keywords
|
||||||
LatexName ams
|
LatexName ams
|
||||||
LabelString "Mathematics Subject Classification number:"
|
LabelString "Mathematics Subject Classification number:"
|
||||||
|
DocBookTag subjectset
|
||||||
|
DocBookAttr role='msc'
|
||||||
|
DocBookTagType block
|
||||||
|
DocBookItemWrapperTag subject
|
||||||
|
DocBookItemWrapperTagType paragraph
|
||||||
|
DocBookItemTag subjectterm
|
||||||
|
DocBookItemTagType inline
|
||||||
|
DocBookWrapperTag NONE
|
||||||
|
DocBookWrapperAttr ""
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +79,11 @@ Style Affiliation
|
|||||||
Color Green
|
Color Green
|
||||||
Series Bold
|
Series Bold
|
||||||
EndFont
|
EndFont
|
||||||
|
DocBookTag address
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -91,6 +96,12 @@ Style Affiliation_(alternate)
|
|||||||
Tooltip "Optional argument to the altaffiliation command"
|
Tooltip "Optional argument to the altaffiliation command"
|
||||||
EndArgument
|
EndArgument
|
||||||
PassThru 1
|
PassThru 1
|
||||||
|
DocBookTag address
|
||||||
|
DocBookAttr role='alternate'
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -123,6 +134,12 @@ Style Author_Email
|
|||||||
TextFont
|
TextFont
|
||||||
Family Roman
|
Family Roman
|
||||||
EndFont
|
EndFont
|
||||||
|
DocBookTag email
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperTagType block
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -135,6 +152,12 @@ Style Author_URL
|
|||||||
Tooltip "Optional argument to the homepage command"
|
Tooltip "Optional argument to the homepage command"
|
||||||
EndArgument
|
EndArgument
|
||||||
PassThru 1
|
PassThru 1
|
||||||
|
DocBookTag uri
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperTagType block
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -164,6 +187,10 @@ Style Keywords
|
|||||||
Color Green
|
Color Green
|
||||||
Series Bold
|
Series Bold
|
||||||
EndFont
|
EndFont
|
||||||
|
DocBookTag keyword
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag keywordset
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -171,6 +198,16 @@ Style PACS
|
|||||||
CopyStyle Keywords
|
CopyStyle Keywords
|
||||||
LatexName pacs
|
LatexName pacs
|
||||||
LabelString "PACS numbers:"
|
LabelString "PACS numbers:"
|
||||||
|
DocBookTag subjectset
|
||||||
|
DocBookAttr role='pacs'
|
||||||
|
DocBookTagType block
|
||||||
|
DocBookItemWrapperTag subject
|
||||||
|
DocBookItemWrapperTagType paragraph
|
||||||
|
DocBookItemTag subjectterm
|
||||||
|
DocBookItemTagType inline
|
||||||
|
DocBookWrapperTag NONE
|
||||||
|
DocBookWrapperAttr ""
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -184,13 +221,22 @@ Style Preprint
|
|||||||
BottomSep 1.5
|
BottomSep 1.5
|
||||||
ParSep 1.5
|
ParSep 1.5
|
||||||
Align Left
|
Align Left
|
||||||
|
DocBookWrapperTag cover
|
||||||
|
DocBookWrapperAttr role='preprint'
|
||||||
|
DocBookTag para
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
Style Thanks
|
Style Thanks
|
||||||
|
# TODO: This style has a misleading name, innit?
|
||||||
CopyStyle Affiliation
|
CopyStyle Affiliation
|
||||||
LatexName thanks
|
LatexName thanks
|
||||||
LabelString "Title footnote:"
|
LabelString "Title footnote:"
|
||||||
|
DocBookTag subtitle
|
||||||
|
DocBookAttr role='footnote'
|
||||||
|
DocBookWrapperTag NONE
|
||||||
|
DocBookInInfo maybe
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -223,6 +269,8 @@ Style Acknowledgments
|
|||||||
Size Larger
|
Size Larger
|
||||||
EndFont
|
EndFont
|
||||||
TopSep 0.7
|
TopSep 0.7
|
||||||
|
DocBookTag para
|
||||||
|
DocBookWrapperTag acknowledgements
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ Style Standard
|
|||||||
Align Block
|
Align Block
|
||||||
AlignPossible Block, Left, Right, Center
|
AlignPossible Block, Left, Right, Center
|
||||||
LabelType No_Label
|
LabelType No_Label
|
||||||
|
DocBookTag para
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -113,6 +114,10 @@ Style Preprint
|
|||||||
BottomSep 1.5
|
BottomSep 1.5
|
||||||
ParSep 1.5
|
ParSep 1.5
|
||||||
Align Left
|
Align Left
|
||||||
|
DocBookWrapperTag cover
|
||||||
|
DocBookWrapperAttr role='preprint'
|
||||||
|
DocBookTag para
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -149,6 +154,11 @@ Style Affiliation
|
|||||||
LabelFont
|
LabelFont
|
||||||
Shape Italic
|
Shape Italic
|
||||||
EndFont
|
EndFont
|
||||||
|
DocBookTag address
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -162,6 +172,12 @@ Style Affiliation_(alternate)
|
|||||||
Tooltip "Optional argument to the altaffiliation command"
|
Tooltip "Optional argument to the altaffiliation command"
|
||||||
EndArgument
|
EndArgument
|
||||||
LabelString "Affiliation (alternate):"
|
LabelString "Affiliation (alternate):"
|
||||||
|
DocBookTag address
|
||||||
|
DocBookAttr role='alternate'
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -198,6 +214,13 @@ Style Thanks
|
|||||||
CopyStyle Affiliation
|
CopyStyle Affiliation
|
||||||
LatexName thanks
|
LatexName thanks
|
||||||
LabelString "Thanks:"
|
LabelString "Thanks:"
|
||||||
|
DocBookTag personblurb
|
||||||
|
DocBookAttr role='thanks'
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookItemTag para
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -217,6 +240,12 @@ Style Author_Email
|
|||||||
LabelFont
|
LabelFont
|
||||||
Family Roman
|
Family Roman
|
||||||
EndFont
|
EndFont
|
||||||
|
DocBookTag email
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperTagType block
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -230,6 +259,12 @@ Style Author_URL
|
|||||||
Tooltip "Optional argument to the homepage command"
|
Tooltip "Optional argument to the homepage command"
|
||||||
EndArgument
|
EndArgument
|
||||||
LabelString "URL:"
|
LabelString "URL:"
|
||||||
|
DocBookTag uri
|
||||||
|
DocBookTagType paragraph
|
||||||
|
DocBookWrapperTag author
|
||||||
|
DocBookWrapperTagType block
|
||||||
|
DocBookWrapperMergeWithPrevious true
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -256,6 +291,8 @@ Style Acknowledgments
|
|||||||
Series Bold
|
Series Bold
|
||||||
Size Large
|
Size Large
|
||||||
EndFont
|
EndFont
|
||||||
|
DocBookTag para
|
||||||
|
DocBookWrapperTag acknowledgements
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
@ -268,6 +305,16 @@ Style PACS
|
|||||||
LabelType Static
|
LabelType Static
|
||||||
LabelSep M
|
LabelSep M
|
||||||
LabelString "PACS number:"
|
LabelString "PACS number:"
|
||||||
|
DocBookTag subjectset
|
||||||
|
DocBookAttr role='pacs'
|
||||||
|
DocBookTagType block
|
||||||
|
DocBookItemWrapperTag subject
|
||||||
|
DocBookItemWrapperTagType paragraph
|
||||||
|
DocBookItemTag subjectterm
|
||||||
|
DocBookItemTagType inline
|
||||||
|
DocBookWrapperTag NONE
|
||||||
|
DocBookWrapperAttr ""
|
||||||
|
DocBookInInfo always
|
||||||
End
|
End
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@ std::string Floating::docbookFloatType() const
|
|||||||
return "table";
|
return "table";
|
||||||
} else if (floattype_ == "algorithm") {
|
} else if (floattype_ == "algorithm") {
|
||||||
return "algorithm";
|
return "algorithm";
|
||||||
|
} else if (floattype_ == "video") {
|
||||||
|
return "video";
|
||||||
} else {
|
} else {
|
||||||
// If nothing matches, return something that will not be valid.
|
// If nothing matches, return something that will not be valid.
|
||||||
LYXERR0("Unrecognised float type: " + floattype_);
|
LYXERR0("Unrecognised float type: " + floattype_);
|
||||||
@ -118,7 +120,7 @@ string Floating::docbookAttr() const
|
|||||||
string Floating::docbookTag(bool hasTitle) const
|
string Floating::docbookTag(bool hasTitle) const
|
||||||
{
|
{
|
||||||
// TODO: configure this in the layouts?
|
// TODO: configure this in the layouts?
|
||||||
if (docbookFloatType() == "figure" || docbookFloatType() == "algorithm") {
|
if (docbookFloatType() == "figure" || docbookFloatType() == "algorithm" || docbookFloatType() == "video") {
|
||||||
return hasTitle ? "figure" : "informalfigure";
|
return hasTitle ? "figure" : "informalfigure";
|
||||||
} else if (docbookFloatType() == "table") {
|
} else if (docbookFloatType() == "table") {
|
||||||
return hasTitle ? "table" : "informaltable";
|
return hasTitle ? "table" : "informaltable";
|
||||||
|
@ -379,6 +379,9 @@ public:
|
|||||||
/// Should the layouts that should/must go into <info> be generated?
|
/// Should the layouts that should/must go into <info> be generated?
|
||||||
bool docbook_generate_info = true;
|
bool docbook_generate_info = true;
|
||||||
|
|
||||||
|
/// Should wrappers be ignored? Mostly useful to avoid generation of <abstract>.
|
||||||
|
bool docbook_ignore_wrapper = false;
|
||||||
|
|
||||||
/// Are we generating this material for inclusion in a TOC-like entity?
|
/// Are we generating this material for inclusion in a TOC-like entity?
|
||||||
bool for_toc = false;
|
bool for_toc = false;
|
||||||
|
|
||||||
|
@ -757,6 +757,11 @@ void docbookNoSubfigures(XMLStream & xs, OutputParams const & runparams, const I
|
|||||||
|
|
||||||
void InsetFloat::docbook(XMLStream & xs, OutputParams const & runparams) const
|
void InsetFloat::docbook(XMLStream & xs, OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
|
// if (runparams.docbook_in_par) {
|
||||||
|
// xs << xml::EndTag("para");
|
||||||
|
// xs << xml::CR();
|
||||||
|
// }
|
||||||
|
|
||||||
const InsetCaption* caption = getCaptionInset();
|
const InsetCaption* caption = getCaptionInset();
|
||||||
const InsetLabel* label = getLabelInset();
|
const InsetLabel* label = getLabelInset();
|
||||||
|
|
||||||
@ -780,6 +785,11 @@ void InsetFloat::docbook(XMLStream & xs, OutputParams const & runparams) const
|
|||||||
docbookSubfigures(xs, runparams, caption, label, subfigures);
|
docbookSubfigures(xs, runparams, caption, label, subfigures);
|
||||||
else
|
else
|
||||||
docbookNoSubfigures(xs, runparams, caption, label, ftype, this);
|
docbookNoSubfigures(xs, runparams, caption, label, ftype, this);
|
||||||
|
|
||||||
|
// if (runparams.docbook_in_par) {
|
||||||
|
// xs << xml::CR();
|
||||||
|
// xs << xml::StartTag("para");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ string fontToAttribute(xml::FontTypes type) {
|
|||||||
|
|
||||||
// Higher-level convenience functions.
|
// Higher-level convenience functions.
|
||||||
|
|
||||||
void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar)
|
void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar, const OutputParams & runparams)
|
||||||
{
|
{
|
||||||
if (par == prevpar)
|
if (par == prevpar)
|
||||||
prevpar = nullptr;
|
prevpar = nullptr;
|
||||||
@ -182,7 +182,7 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
|
|||||||
// next paragraph is the affiliation, then it should be output in the same <author> tag (different
|
// next paragraph is the affiliation, then it should be output in the same <author> tag (different
|
||||||
// layout, same wrapper tag).
|
// layout, same wrapper tag).
|
||||||
Layout const & lay = par->layout();
|
Layout const & lay = par->layout();
|
||||||
bool openWrapper = lay.docbookwrappertag() != "NONE";
|
bool openWrapper = lay.docbookwrappertag() != "NONE" && !runparams.docbook_ignore_wrapper;
|
||||||
if (prevpar != nullptr) {
|
if (prevpar != nullptr) {
|
||||||
Layout const & prevlay = prevpar->layout();
|
Layout const & prevlay = prevpar->layout();
|
||||||
if (prevlay.docbookwrappertag() != "NONE") {
|
if (prevlay.docbookwrappertag() != "NONE") {
|
||||||
@ -209,19 +209,20 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xml::openTag(xs, lay.docbookitemwrappertag(), lay.docbookitemwrapperattr(), lay.docbookitemwrappertagtype());
|
||||||
xml::openTag(xs, lay.docbookitemtag(), lay.docbookitemattr(), lay.docbookitemtagtype());
|
xml::openTag(xs, lay.docbookitemtag(), lay.docbookitemattr(), lay.docbookitemtagtype());
|
||||||
xml::openTag(xs, lay.docbookiteminnertag(), lay.docbookiteminnerattr(), lay.docbookiteminnertagtype());
|
xml::openTag(xs, lay.docbookiteminnertag(), lay.docbookiteminnerattr(), lay.docbookiteminnertagtype());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
|
void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar, const OutputParams & runparams)
|
||||||
{
|
{
|
||||||
if (par == nextpar)
|
if (par == nextpar)
|
||||||
nextpar = nullptr;
|
nextpar = nullptr;
|
||||||
|
|
||||||
// See comment in openParTag.
|
// See comment in openParTag.
|
||||||
Layout const & lay = par->layout();
|
Layout const & lay = par->layout();
|
||||||
bool closeWrapper = lay.docbookwrappertag() != "NONE";
|
bool closeWrapper = lay.docbookwrappertag() != "NONE" && !runparams.docbook_ignore_wrapper;
|
||||||
if (nextpar != nullptr) {
|
if (nextpar != nullptr) {
|
||||||
Layout const & nextlay = nextpar->layout();
|
Layout const & nextlay = nextpar->layout();
|
||||||
if (nextlay.docbookwrappertag() != "NONE") {
|
if (nextlay.docbookwrappertag() != "NONE") {
|
||||||
@ -236,6 +237,7 @@ void closeParTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpa
|
|||||||
// Main logic.
|
// Main logic.
|
||||||
xml::closeTag(xs, lay.docbookiteminnertag(), lay.docbookiteminnertagtype());
|
xml::closeTag(xs, lay.docbookiteminnertag(), lay.docbookiteminnertagtype());
|
||||||
xml::closeTag(xs, lay.docbookitemtag(), lay.docbookitemtagtype());
|
xml::closeTag(xs, lay.docbookitemtag(), lay.docbookitemtagtype());
|
||||||
|
xml::closeTag(xs, lay.docbookitemwrappertag(), lay.docbookitemwrappertagtype());
|
||||||
xml::closeTag(xs, lay.docbookinnertag(), lay.docbookinnertagtype());
|
xml::closeTag(xs, lay.docbookinnertag(), lay.docbookinnertagtype());
|
||||||
xml::closeTag(xs, lay.docbooktag(), lay.docbooktagtype());
|
xml::closeTag(xs, lay.docbooktag(), lay.docbooktagtype());
|
||||||
if (closeWrapper)
|
if (closeWrapper)
|
||||||
@ -412,12 +414,12 @@ void makeParagraph(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (open_par)
|
if (open_par)
|
||||||
openParTag(xs, &*par, prevpar);
|
openParTag(xs, &*par, prevpar, runparams);
|
||||||
|
|
||||||
xs << XMLStream::ESCAPE_NONE << parXML;
|
xs << XMLStream::ESCAPE_NONE << parXML;
|
||||||
|
|
||||||
if (close_par)
|
if (close_par)
|
||||||
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
|
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr, runparams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +448,7 @@ void makeEnvironment(Text const &text,
|
|||||||
// Output the opening tag for this environment, but only if it has not been previously opened (condition
|
// Output the opening tag for this environment, but only if it has not been previously opened (condition
|
||||||
// implemented in openParTag).
|
// implemented in openParTag).
|
||||||
auto prevpar = text.paragraphs().getParagraphBefore(par);
|
auto prevpar = text.paragraphs().getParagraphBefore(par);
|
||||||
openParTag(xs, &*par, prevpar); // TODO: switch in layout for par/block?
|
openParTag(xs, &*par, prevpar, runparams);
|
||||||
|
|
||||||
// Generate the contents of this environment. There is a special case if this is like some environment.
|
// Generate the contents of this environment. There is a special case if this is like some environment.
|
||||||
Layout const & style = par->layout();
|
Layout const & style = par->layout();
|
||||||
@ -483,7 +485,7 @@ void makeEnvironment(Text const &text,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the environment.
|
// Close the environment.
|
||||||
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block?
|
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr, runparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -630,14 +632,14 @@ void makeCommand(
|
|||||||
|
|
||||||
// Generate this command.
|
// Generate this command.
|
||||||
auto prevpar = text.paragraphs().getParagraphBefore(par);
|
auto prevpar = text.paragraphs().getParagraphBefore(par);
|
||||||
openParTag(xs, &*par, prevpar);
|
openParTag(xs, &*par, prevpar, runparams);
|
||||||
|
|
||||||
auto pars = par->simpleDocBookOnePar(buf, runparams,text.outerFont(distance(begin, par)));
|
auto pars = par->simpleDocBookOnePar(buf, runparams,text.outerFont(distance(begin, par)));
|
||||||
for (auto & parXML : pars)
|
for (auto & parXML : pars)
|
||||||
// TODO: decide what to do with openParTag/closeParTag in new lines.
|
// TODO: decide what to do with openParTag/closeParTag in new lines.
|
||||||
xs << XMLStream::ESCAPE_NONE << parXML;
|
xs << XMLStream::ESCAPE_NONE << parXML;
|
||||||
|
|
||||||
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
|
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr, runparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -737,6 +739,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
|
|||||||
|
|
||||||
// Traverse everything that might belong to <info>.
|
// Traverse everything that might belong to <info>.
|
||||||
bool hasAbstractLayout = false;
|
bool hasAbstractLayout = false;
|
||||||
|
depth_type abstractDepth = -1;
|
||||||
pit_type cpit = bpit;
|
pit_type cpit = bpit;
|
||||||
for (; cpit < epit; ++cpit) {
|
for (; cpit < epit; ++cpit) {
|
||||||
// Skip paragraphs that don't generate anything in DocBook.
|
// Skip paragraphs that don't generate anything in DocBook.
|
||||||
@ -755,10 +758,26 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
|
|||||||
// If this is marked as an abstract by the layout, put it in the right set.
|
// If this is marked as an abstract by the layout, put it in the right set.
|
||||||
if (style.docbookabstract()) {
|
if (style.docbookabstract()) {
|
||||||
hasAbstractLayout = true;
|
hasAbstractLayout = true;
|
||||||
|
abstractDepth = par.getDepth();
|
||||||
abstractWithLayout.emplace(cpit);
|
abstractWithLayout.emplace(cpit);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deeper paragraphs following the abstract must still be considered as part of the abstract.
|
||||||
|
// For instance, this includes lists. There should not be any other kind of paragraph in between.
|
||||||
|
if (abstractDepth != -1 && style.docbookininfo() == "never") {
|
||||||
|
if (par.getDepth() > abstractDepth) {
|
||||||
|
abstractWithLayout.emplace(cpit);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (par.getDepth() == abstractDepth) {
|
||||||
|
// This is not an abstract paragraph and it should not either be considered as part
|
||||||
|
// of it. It breaks the rule that abstract paragraphs must follow each other.
|
||||||
|
abstractDepth = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Based on layout information, store this paragraph in one set: should be in <info>, must be,
|
// Based on layout information, store this paragraph in one set: should be in <info>, must be,
|
||||||
// or abstract (either because of layout or of position).
|
// or abstract (either because of layout or of position).
|
||||||
if (style.docbookininfo() == "always")
|
if (style.docbookininfo() == "always")
|
||||||
@ -769,7 +788,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const ¶graphs,
|
|||||||
(style.docbooktag() == "NONE" || style.docbooktag() == "para") &&
|
(style.docbooktag() == "NONE" || style.docbooktag() == "para") &&
|
||||||
style.docbookwrappertag() == "NONE")
|
style.docbookwrappertag() == "NONE")
|
||||||
// In this case, it is very likely that style.docbookininfo() == "never"! Be extra careful
|
// In this case, it is very likely that style.docbookininfo() == "never"! Be extra careful
|
||||||
// about anything that gets caught here.
|
// about anything that gets caught here. For instance, don't ake into account
|
||||||
abstractNoLayout.emplace(cpit);
|
abstractNoLayout.emplace(cpit);
|
||||||
else // This should definitely not be in <info>.
|
else // This should definitely not be in <info>.
|
||||||
break;
|
break;
|
||||||
@ -901,6 +920,7 @@ void outputDocBookInfo(
|
|||||||
|
|
||||||
auto rp = runparams;
|
auto rp = runparams;
|
||||||
rp.docbook_generate_info = false;
|
rp.docbook_generate_info = false;
|
||||||
|
rp.docbook_ignore_wrapper = true;
|
||||||
|
|
||||||
set<pit_type> doneParas; // Paragraphs that have already been converted (mostly to deal with lists).
|
set<pit_type> doneParas; // Paragraphs that have already been converted (mostly to deal with lists).
|
||||||
for (auto const & p : info.abstract) {
|
for (auto const & p : info.abstract) {
|
||||||
@ -908,6 +928,7 @@ void outputDocBookInfo(
|
|||||||
auto oldPar = paragraphs.iterator_at(p);
|
auto oldPar = paragraphs.iterator_at(p);
|
||||||
auto newPar = makeAny(text, buf, xs2, rp, oldPar);
|
auto newPar = makeAny(text, buf, xs2, rp, oldPar);
|
||||||
|
|
||||||
|
// Find insets that should go outside the abstract.
|
||||||
auto subinfos = gatherInfo(oldPar);
|
auto subinfos = gatherInfo(oldPar);
|
||||||
for (auto & subinfo: subinfos)
|
for (auto & subinfo: subinfos)
|
||||||
infoInsets.insert(subinfo);
|
infoInsets.insert(subinfo);
|
||||||
@ -968,23 +989,18 @@ void outputDocBookInfo(
|
|||||||
// - Finally, always output the abstract as the last item of the <info>, as it requires special treatment
|
// - Finally, always output the abstract as the last item of the <info>, as it requires special treatment
|
||||||
// (especially if it contains several paragraphs that are empty).
|
// (especially if it contains several paragraphs that are empty).
|
||||||
if (hasAbstract) {
|
if (hasAbstract) {
|
||||||
if (info.abstractLayout) {
|
string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
|
||||||
xs << XMLStream::ESCAPE_NONE << abstract;
|
if (tag == "NONE")
|
||||||
xs << xml::CR();
|
tag = "abstract";
|
||||||
} else {
|
|
||||||
string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
|
|
||||||
if (tag == "NONE")
|
|
||||||
tag = "abstract";
|
|
||||||
|
|
||||||
if (!xs.isLastTagCR())
|
if (!xs.isLastTagCR())
|
||||||
xs << xml::CR();
|
xs << xml::CR();
|
||||||
|
|
||||||
xs << xml::StartTag(tag);
|
xs << xml::StartTag(tag);
|
||||||
xs << xml::CR();
|
xs << xml::CR();
|
||||||
xs << XMLStream::ESCAPE_NONE << abstract;
|
xs << XMLStream::ESCAPE_NONE << abstract;
|
||||||
xs << xml::EndTag(tag);
|
xs << xml::EndTag(tag);
|
||||||
xs << xml::CR();
|
xs << xml::CR();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End the <info> tag if it was started.
|
// End the <info> tag if it was started.
|
||||||
|
Loading…
Reference in New Issue
Block a user