[LyX/master] DocBook: implement achemso.

Thibaut Cuvelier tcuvelier at lyx.org
Thu Nov 12 01:48:55 UTC 2020


commit 14887dda1c94dfd81e4521ec340b014ed78c415c
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Thu Nov 12 03:18:03 2020 +0100

    DocBook: implement achemso.
---
 development/autotests/invertedTests |    3 ++
 lib/layouts/achemso.layout          |   54 +++++++++++++++++++++++++++++++++++
 lib/layouts/stdtitle.inc            |    2 +-
 src/Floating.cpp                    |    8 ++++-
 4 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests
index fa7a3c0..e568b8e 100644
--- a/development/autotests/invertedTests
+++ b/development/autotests/invertedTests
@@ -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
diff --git a/lib/layouts/achemso.layout b/lib/layouts/achemso.layout
index e86c56f..4ed6621 100644
--- a/lib/layouts/achemso.layout
+++ b/lib/layouts/achemso.layout
@@ -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
diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc
index 9fbc3b7..fe9592d 100644
--- a/lib/layouts/stdtitle.inc
+++ b/lib/layouts/stdtitle.inc
@@ -53,7 +53,7 @@ Style Author
 	DocBookTag            personname
 	DocBookTagType        paragraph
 	DocBookWrapperTag     author
-	DocBookWrapperTagType inline
+	DocBookWrapperTagType block
 	DocBookInInfo         always
 End
 
diff --git a/src/Floating.cpp b/src/Floating.cpp
index ff1667f..a226d51 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -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_;
 }


More information about the lyx-cvs mailing list