commit 14cfcf00cbeb66aacb23f30ad523b21f5a3a566f
Author: Thibaut Cuvelier <[email protected]>
Date:   Sat Nov 28 00:51:27 2020 +0100

    DocBook: implement AEA and APA.
---
 development/autotests/invertedTests |    6 ++++++
 lib/layouts/AEA.layout              |   27 +++++++++++++++++++++++++++
 lib/layouts/apa.layout              |    8 ++++++++
 lib/layouts/apax.inc                |   14 ++++++++++++++
 src/output_docbook.cpp              |    6 +++---
 5 files changed, 58 insertions(+), 3 deletions(-)

diff --git a/development/autotests/invertedTests 
b/development/autotests/invertedTests
index 6fb757b..9e8ec54 100644
--- a/development/autotests/invertedTests
+++ b/development/autotests/invertedTests
@@ -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
diff --git a/lib/layouts/AEA.layout b/lib/layouts/AEA.layout
index d94ebb3..a395c73 100644
--- a/lib/layouts/AEA.layout
+++ b/lib/layouts/AEA.layout
@@ -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
 
diff --git a/lib/layouts/apa.layout b/lib/layouts/apa.layout
index dcacaee..bf2ef2a 100644
--- a/lib/layouts/apa.layout
+++ b/lib/layouts/apa.layout
@@ -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
 
 
diff --git a/lib/layouts/apax.inc b/lib/layouts/apax.inc
index 8edc84e..6deb07e 100644
--- a/lib/layouts/apax.inc
+++ b/lib/layouts/apax.inc
@@ -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
 
 
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 8f313e1..96e83b2 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -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);
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to