DocBook: implement AEA and APA.

This commit is contained in:
Thibaut Cuvelier 2020-11-28 00:51:27 +01:00
parent 7437a6ce3c
commit 14cfcf00cb
5 changed files with 58 additions and 3 deletions

View File

@ -513,6 +513,12 @@ export/templates/Articles/Int._Journal_of_Modern_Physics_(C|D)_docbook5
# - Broken references.
export/templates/Articles/Journal_of_the_Acoustical_Society_of_America_%28JASA%29_docbook5
export/templates/Articles/Astronomy_%26_Astrophysics_docbook5
export/templates/Articles/American_Psychological_Association_%28APA%29_docbook5
# - Empty article!?
export/templates/Articles/Hebrew_Article_%28KOMA-Script%29_docbook5
# - Empty figure. Broken references. Float notes not implemented (how to do it?).
export/templates/Articles/American_Economic_Association_%28AEA%29_docbook5
export/templates/Articles/American_Psychological_Association_%28APA%29,_v._7_docbook5
Sublabel: docbook poster
# Posters cannot be properly exported, the LyX documents are too far from

View File

@ -53,6 +53,9 @@ Style ShortTitle
LatexName shortTitle
InTitle 1
Align Center
DocBookTag titleabbrev
DocBookTagType paragraph
DocBookInInfo maybe
End
Style Publication_Month
@ -66,24 +69,39 @@ Style Publication_Month
LabelFont
Color Red
EndFont
DocBookTag date
DocBookAttr role='month'
DocBookTagType paragraph
DocBookInInfo maybe
End
Style Publication_Year
CopyStyle Publication_Month
LatexName pubYear
LabelString "Publication Year:"
DocBookTag date
DocBookAttr role='year'
DocBookTagType paragraph
DocBookInInfo maybe
End
Style Publication_Volume
CopyStyle Publication_Month
LatexName pubVolume
LabelString "Publication Volume:"
DocBookTag volumenum
DocBookTagType paragraph
DocBookInInfo maybe
End
Style Publication_Issue
CopyStyle Publication_Month
LatexName pubIssue
LabelString "Publication Issue:"
DocBookTag issuenum
DocBookAttr ""
DocBookTagType paragraph
DocBookInInfo maybe
End
Style JEL
@ -111,6 +129,10 @@ Style Acknowledgement
LabelString "Acknowledgement."
Preamble
EndPreamble
DocBookTag para
DocBookAttr ""
DocBookWrapperTag acknowledgements
DocBookWrapperMergeWithPrevious true
End
Style Figure_Notes
@ -122,6 +144,7 @@ Style Figure_Notes
Argument 1
LabelString "Figure Note"
Tooltip "Text of a note in a figure"
DocBookTag emphasis
EndArgument
LeftMargin MMM
TopSep 0.5
@ -137,6 +160,8 @@ Style Figure_Notes
Shape Italic
Size Small
EndFont
DocBookTag para
DocBookWrapperTag note
End
Style Table_Notes
@ -145,6 +170,8 @@ Style Table_Notes
Argument 1
LabelString "Table Note"
Tooltip "Text of a note in a table"
Tooltip "Text of a note in a figure"
DocBookTag emphasis
EndArgument
End

View File

@ -71,6 +71,10 @@ Style RightHeader
Size Small
EndFont
Align Right
DocBookTag titleabbrev
DocBookAttr role='right-header'
DocBookTagType paragraph
DocBookInInfo maybe
End
@ -125,6 +129,10 @@ Style ShortTitle
DocBookTag titleabbrev
DocBookTagType paragraph
DocBookInInfo maybe
DocBookTag titleabbrev
DocBookAttr role='short-title'
DocBookTagType paragraph
DocBookInInfo maybe
End

View File

@ -154,6 +154,10 @@ Style LeftHeader
Series Bold
Size Small
EndFont
DocBookTag authorinitials
DocBookAttr role='left-header'
DocBookTagType paragraph
DocBookInInfo maybe
End
@ -612,6 +616,9 @@ Style Course
Size Small
Shape Italic
EndFont
DocBookTag releaseinfo
DocBookAttr role='course'
DocBookInInfo always
End
@ -632,7 +639,14 @@ Style addORCIDlink
LabelString "Author-name"
Tooltip ORCID
Mandatory 1
DocBookTag phrase
DocBookAttr role='author-name'
EndArgument
# TODO: for DocBook, this won't work outside the preamble.
DocBookTag personblurb
DocBookAttr role='orcid'
DocBookTagType paragraph
DocBookInInfo maybe
End

View File

@ -1063,9 +1063,6 @@ void docbookParagraphs(Text const &text,
return;
});
std::stack<std::pair<int, string>> headerLevels; // Used to determine when to open/close sections: store the depth
// of the section and the tag that was used to open it.
// Detect whether the document contains sections. If there are no sections, treatment is largely simplified.
// In particular, there can't be an abstract, unless it is manually marked.
bool documentHasSections;
@ -1083,6 +1080,9 @@ void docbookParagraphs(Text const &text,
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
bpit = info.epit;
std::stack<std::pair<int, string>> headerLevels; // Used to determine when to open/close sections: store the depth
// of the section and the tag that was used to open it.
// Then, iterate through the paragraphs of this document.
auto par = text.paragraphs().iterator_at(bpit);
auto end = text.paragraphs().iterator_at(epit);