DocBook: implement achemso.

This commit is contained in:
Thibaut Cuvelier 2020-11-12 03:18:03 +01:00
parent 2f8443afbe
commit 14887dda1c
4 changed files with 65 additions and 2 deletions

View File

@ -455,6 +455,9 @@ export/templates/Letters/DIN-Brief_docbook5
# - AMS: order of elements is not compatible with DocBook (some parts must be in <info>, others cannot, while
# still being in the book's header).
export/examples/.*/American_Mathematical_Society_%28AMS%29_docbook5
# - ACS: comments in the middle of the author info can wreak havoc (fixable).
Some bibliography entries do not exist within the document. Floats are empty.
export/examples/Articles/American_Chemical_Society_%28ACS%29_docbook5
# - 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
# - EmbeddedObjects: this document is too complex, with captions within tables, many LaTeX parameters when including

View File

@ -38,6 +38,7 @@ Style Standard
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label
DocBookTag para
End
Input stdcounters.inc
@ -75,6 +76,9 @@ Style Title
Tooltip "Short title which will appear in the running header"
InsertCotext 1
EndArgument
DocBookTag title
DocBookTagType paragraph
DocBookInInfo maybe
End
Style Author
@ -88,6 +92,12 @@ Style Author
Family Sans
Size Large
EndFont
DocBookTag personname
DocBookTagType paragraph
DocBookWrapperTag author
DocBookWrapperTagType block
# Don't merge with the previous, as the author name indicates a new author.
DocBookInInfo always
End
Style Email
@ -110,18 +120,38 @@ Style Affiliation
Tooltip "Short name which appears in the footer of the title page"
InsertCotext 1
EndArgument
DocBookTag affiliation
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
DocBookItemTagType paragraph
DocBookInInfo always
End
Style Alt_Affiliation
CopyStyle Affiliation
LatexName altaffiliation
TopSep 0.7
DocBookTag affiliation
DocBookAttr role='alternate'
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
DocBookItemTagType paragraph
DocBookInInfo always
End
Style Also_Affiliation
CopyStyle Affiliation
LatexName alsoaffiliation
TopSep 0.5
DocBookTag affiliation
DocBookAttr role='also'
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag orgname
DocBookItemTagType paragraph
DocBookInInfo always
End
Style Fax
@ -131,6 +161,13 @@ Style Fax
LabelSep xx
LabelType Static
LabelString "Fax:"
DocBookTag address
DocBookTagType paragraph
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag phone
DocBookItemTagType paragraph
DocBookInInfo always
End
Style Phone
@ -138,6 +175,13 @@ Style Phone
LatexName phone
LabelString "Phone:"
TopSep 0.5
DocBookTag address
DocBookTagType paragraph
DocBookWrapperTag author
DocBookWrapperMergeWithPrevious true
DocBookItemTag fax
DocBookItemTagType paragraph
DocBookInInfo always
End
Style Abbreviations
@ -251,12 +295,17 @@ Style Acknowledgement
Series Bold
Size Large
EndFont
DocBookTag para
DocBookWrapperTag acknowledgements
End
Style SupplementalInfo
CopyStyle Acknowledgement
LatexName suppinfo
LabelString "Supporting Information Available"
DocBookTag para
DocBookWrapperTag sidebar
DocBookWrapperMergeWithPrevious true
End
Style TOC_entry
@ -264,6 +313,9 @@ Style TOC_entry
LatexName tocentry
ParSep 0.3
LabelString "Graphical TOC Entry"
DocBookTag para
DocBookWrapperTag sidebar
DocBookWrapperMergeWithPrevious true
End
InsetLayout Flex:Bibnote
@ -300,6 +352,8 @@ InsetLayout Flex:Chemistry
Color blue
EndFont
MultiPar false
DocBookTag phrase
DocBookAttr role='chemistry'
End
InsetLayout Flex:Latin

View File

@ -53,7 +53,7 @@ Style Author
DocBookTag personname
DocBookTagType paragraph
DocBookWrapperTag author
DocBookWrapperTagType inline
DocBookWrapperTagType block
DocBookInInfo always
End

View File

@ -11,6 +11,7 @@
*/
#include <config.h>
#include <set>
#include "Floating.h"
@ -47,7 +48,8 @@ Floating::Floating(string const & type, string const & placement,
std::string Floating::docbookFloatType() const
{
// TODO: configure this in the layouts?
if (floattype_ == "figure") {
if (floattype_ == "figure" || floattype_ == "graph" ||
floattype_ == "chart" || floattype_ == "scheme") {
return "figure";
} else if (floattype_ == "table" || floattype_ == "tableau") {
return "table";
@ -101,9 +103,13 @@ string Floating::defaultCSSClass() const
string Floating::docbookAttr() const
{
std::set<std::string> achemso = { "chart", "graph", "scheme" };
// For algorithms, a type attribute must be mentioned, if not already present in docbook_attr_.
if (docbookFloatType() == "algorithm" && docbook_attr_.find("type=") != std::string::npos)
return docbook_attr_ + " type='algorithm'";
// Specific floats for achemso.
else if (docbookFloatType() == "figure" && achemso.find(floattype_) != achemso.end())
return docbook_attr_ + " type='" + floattype_ + "'";
else
return docbook_attr_;
}