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. # - Broken references.
export/templates/Articles/Journal_of_the_Acoustical_Society_of_America_%28JASA%29_docbook5 export/templates/Articles/Journal_of_the_Acoustical_Society_of_America_%28JASA%29_docbook5
export/templates/Articles/Astronomy_%26_Astrophysics_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 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

View File

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

View File

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

View File

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

View File

@ -1063,9 +1063,6 @@ void docbookParagraphs(Text const &text,
return; 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. // 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. // In particular, there can't be an abstract, unless it is manually marked.
bool documentHasSections; bool documentHasSections;
@ -1083,6 +1080,9 @@ void docbookParagraphs(Text const &text,
outputDocBookInfo(text, buf, xs, runparams, paragraphs, info); outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
bpit = info.epit; 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. // Then, iterate through the paragraphs of this document.
auto par = text.paragraphs().iterator_at(bpit); auto par = text.paragraphs().iterator_at(bpit);
auto end = text.paragraphs().iterator_at(epit); auto end = text.paragraphs().iterator_at(epit);