[LyX/master] DocBook: define new arguments in layouts to configure new-line behaviour.

Thibaut Cuvelier tcuvelier at lyx.org
Sat Sep 19 18:18:55 UTC 2020


commit 6998e76495d4dedbc5dc11db8e0cf39b590fd674
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 17 23:06:26 2020 +0200

    DocBook: define new arguments in layouts to configure new-line behaviour.
---
 lib/scripts/layout2layout.py |    7 ++-
 src/Floating.cpp             |   35 +++++++----
 src/Floating.h               |   13 +++-
 src/Layout.cpp               |  147 ++++++++++++++++++++++++++++++++++++------
 src/Layout.h                 |   26 +++++++-
 src/TextClass.cpp            |   13 +++-
 6 files changed, 200 insertions(+), 41 deletions(-)

diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 2bb62e3..7cf2332 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 83
+currentFormat = 84
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -284,6 +284,11 @@ currentFormat = 83
 # Incremented to format 83, 2 August 2020 by dourouc05
 # New tags DocBookWrapperMergeWithPrevious and DocBookAbstract
 
+# Incremented to format 84, 17 August 2020 by tcuvelier
+# New tags DocBookTagType, DocBookWrapperTagTagType,
+# DocBookItemWrapperTagTagType, DocBookItemTagTagType,
+# DocBookLabelTag
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
diff --git a/src/Floating.cpp b/src/Floating.cpp
index ebd1e41..d44afc3 100644
--- a/src/Floating.cpp
+++ b/src/Floating.cpp
@@ -31,8 +31,8 @@ Floating::Floating(string const & type, string const & placement,
 		   string const & refPrefix, std::string const & allowedplacement,
 		   string const & htmlTag, string const & htmlAttrib,
 		   docstring const & htmlStyle, string const & docbookTag,
-		   string const & docbookAttr, string const & required,
-		   bool usesfloat, bool ispredefined,
+		   string const & docbookAttr, string const & docbookTagType,
+           string const & required, bool usesfloat, bool ispredefined,
 		   bool allowswide, bool allowssideways)
 	: floattype_(type), placement_(placement), ext_(ext), within_(within),
 	  style_(style), name_(name), listname_(listName), listcommand_(listCmd),
@@ -40,7 +40,8 @@ Floating::Floating(string const & type, string const & placement,
 	  usesfloatpkg_(usesfloat), ispredefined_(ispredefined),
 	  allowswide_(allowswide), allowssideways_(allowssideways),
 	  html_tag_(htmlTag), html_attrib_(htmlAttrib), html_style_(htmlStyle),
-	  docbook_tag_(docbookTag), docbook_attr_(docbookAttr)
+	  docbook_tag_(docbookTag), docbook_attr_(docbookAttr),
+	  docbook_tag_type_(docbookTagType)
 {}
 
 
@@ -90,20 +91,30 @@ string const & Floating::docbookAttr() const
 
 string const & Floating::docbookTag(bool hasTitle) const
 {
-	docbook_tag_ = "";
-	if (floattype_ == "figure") {
-		docbook_tag_ = hasTitle ? "figure" : "informalfigure";
-	} else if (floattype_ == "table") {
-		docbook_tag_ = hasTitle ? "table" : "informaltable";
-	} else if (floattype_ == "algorithm") {
-		// TODO: no good translation for now! Figures are the closest match, as they can contain text.
-		// Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
-		docbook_tag_ = "figure";
+	if (docbook_tag_.empty()) {
+		docbook_tag_ = "";
+		if (floattype_ == "figure") {
+			docbook_tag_ = hasTitle ? "figure" : "informalfigure";
+		} else if (floattype_ == "table") {
+			docbook_tag_ = hasTitle ? "table" : "informaltable";
+		} else if (floattype_ == "algorithm") {
+			// TODO: no good translation for now! Figures are the closest match, as they can contain text.
+			// Solvable as soon as https://github.com/docbook/docbook/issues/157 has a definitive answer.
+			docbook_tag_ = "figure";
+		}
 	}
 	return docbook_tag_;
 }
 
 
+string const & Floating::docbookTagType() const
+{
+	if (docbook_tag_type_ != "block" && docbook_tag_type_ != "paragraph" && docbook_tag_type_ != "inline")
+		docbook_tag_type_ = "block";
+	return docbook_tag_type_;
+}
+
+
 string const & Floating::docbookCaption() const
 {
 	docbook_caption_ = "";
diff --git a/src/Floating.h b/src/Floating.h
index d10694f..5cfea08 100644
--- a/src/Floating.h
+++ b/src/Floating.h
@@ -38,8 +38,9 @@ public:
 		 std::string const & refPrefix, std::string const & allowedplacement,
 		 std::string const & htmlType, std::string const & htmlClass,
 		 docstring const & htmlStyle, std::string const & docbookTag,
-		 std::string const & docbookAttr, std::string const & required,
-		 bool usesfloat, bool isprefined, bool allowswide, bool allowssideways);
+		 std::string const & docbookAttr, std::string const & docbookTagType,
+		 std::string const & required, bool usesfloat, bool isprefined,
+		 bool allowswide, bool allowssideways);
 	///
 	std::string const & floattype() const { return floattype_; }
 	///
@@ -84,6 +85,8 @@ public:
 	///
 	std::string const & docbookAttr() const;
 	///
+	std::string const & docbookTagType() const;
+	///
 	std::string const & docbookCaption() const;
 private:
 	///
@@ -115,9 +118,9 @@ private:
 	///
 	bool ispredefined_;
 	///
-	bool  allowswide_;
+	bool allowswide_;
 	///
-	bool  allowssideways_;
+	bool allowssideways_;
 	///
 	mutable std::string html_tag_;
 	///
@@ -132,6 +135,8 @@ private:
 	mutable std::string docbook_caption_;
 	/// caption tag (mostly, either caption or title)
 	std::string docbook_attr_;
+	/// DocBook tag type (block, paragraph, inline)
+	mutable std::string docbook_tag_type_;
 };
 
 
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 5047506..102410d 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -106,20 +106,26 @@ enum LayoutTags {
 	LT_HTMLFORCECSS,
 	LT_DOCBOOKTAG,
 	LT_DOCBOOKATTR,
+	LT_DOCBOOKTAGTYPE,
 	LT_DOCBOOKININFO,
 	LT_DOCBOOKABSTRACT,
 	LT_DOCBOOKWRAPPERTAG,
 	LT_DOCBOOKWRAPPERATTR,
+	LT_DOCBOOKWRAPPERTAGTYPE,
 	LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS,
 	LT_DOCBOOKSECTIONTAG,
 	LT_DOCBOOKITEMWRAPPERTAG,
 	LT_DOCBOOKITEMWRAPPERATTR,
+	LT_DOCBOOKITEMWRAPPERTAGTYPE,
 	LT_DOCBOOKITEMTAG,
 	LT_DOCBOOKITEMATTR,
+	LT_DOCBOOKITEMTAGTYPE,
 	LT_DOCBOOKITEMLABELTAG,
 	LT_DOCBOOKITEMLABELATTR,
+	LT_DOCBOOKITEMLABELTAGTYPE,
 	LT_DOCBOOKITEMINNERTAG,
 	LT_DOCBOOKITEMINNERATTR,
+	LT_DOCBOOKITEMINNERTAGTYPE,
 	LT_DOCBOOKFORCEABSTRACTTAG,
 	LT_INPREAMBLE,
 	LT_HTMLTITLE,
@@ -223,23 +229,29 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 		{ "commanddepth",   LT_COMMANDDEPTH },
 		{ "copystyle",      LT_COPYSTYLE },
 		{ "dependson",      LT_DEPENDSON },
-		{ "docbookabstract",         LT_DOCBOOKABSTRACT },
-		{ "docbookattr",             LT_DOCBOOKATTR },
-		{ "docbookforceabstracttag", LT_DOCBOOKFORCEABSTRACTTAG },
-		{ "docbookininfo",           LT_DOCBOOKININFO },
-		{ "docbookitemattr",         LT_DOCBOOKITEMATTR },
-		{ "docbookiteminnerattr",    LT_DOCBOOKITEMINNERATTR },
-		{ "docbookiteminnertag",     LT_DOCBOOKITEMINNERTAG },
-		{ "docbookitemlabelattr",    LT_DOCBOOKITEMLABELATTR },
-		{ "docbookitemlabeltag",     LT_DOCBOOKITEMLABELTAG },
-		{ "docbookitemtag",          LT_DOCBOOKITEMTAG },
-		{ "docbookitemwrapperattr",  LT_DOCBOOKITEMWRAPPERATTR },
-		{ "docbookitemwrappertag",   LT_DOCBOOKITEMWRAPPERTAG },
-		{ "docbooksectiontag",       LT_DOCBOOKSECTIONTAG },
-		{ "docbooktag",              LT_DOCBOOKTAG },
-		{ "docbookwrapperattr",      LT_DOCBOOKWRAPPERATTR },
+		{ "docbookabstract",           LT_DOCBOOKABSTRACT },
+		{ "docbookattr",               LT_DOCBOOKATTR },
+		{ "docbookforceabstracttag",   LT_DOCBOOKFORCEABSTRACTTAG },
+		{ "docbookininfo",             LT_DOCBOOKININFO },
+		{ "docbookitemattr",           LT_DOCBOOKITEMATTR },
+		{ "docbookiteminnerattr",      LT_DOCBOOKITEMINNERATTR },
+		{ "docbookiteminnertag",       LT_DOCBOOKITEMINNERTAG },
+		{ "docbookiteminnertagtype",   LT_DOCBOOKITEMINNERTAGTYPE },
+		{ "docbookitemlabelattr",      LT_DOCBOOKITEMLABELATTR },
+		{ "docbookitemlabeltag",       LT_DOCBOOKITEMLABELTAG },
+		{ "docbookitemlabeltagtype",   LT_DOCBOOKITEMLABELTAGTYPE },
+		{ "docbookitemtag",            LT_DOCBOOKITEMTAG },
+		{ "docbookitemtagtype",        LT_DOCBOOKITEMTAGTYPE },
+		{ "docbookitemwrapperattr",    LT_DOCBOOKITEMWRAPPERATTR },
+		{ "docbookitemwrappertag",     LT_DOCBOOKITEMWRAPPERTAG },
+		{ "docbookitemwrappertagtype", LT_DOCBOOKITEMWRAPPERTAGTYPE },
+		{ "docbooksectiontag",         LT_DOCBOOKSECTIONTAG },
+		{ "docbooktag",                LT_DOCBOOKTAG },
+		{ "docbooktagtype",            LT_DOCBOOKTAGTYPE },
+		{ "docbookwrapperattr",        LT_DOCBOOKWRAPPERATTR },
 		{ "docbookwrappermergewithprevious", LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS },
-		{ "docbookwrappertag",       LT_DOCBOOKWRAPPERTAG },
+		{ "docbookwrappertag",         LT_DOCBOOKWRAPPERTAG },
+		{ "docbookwrappertagtype",     LT_DOCBOOKWRAPPERTAGTYPE },
 		{ "end",            LT_END },
 		{ "endlabelstring", LT_ENDLABELSTRING },
 		{ "endlabeltype",   LT_ENDLABELTYPE },
@@ -733,6 +745,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookattr_;
 			break;
 
+		case LT_DOCBOOKTAGTYPE:
+			lex >> docbooktagtype_;
+			break;
+
 		case LT_DOCBOOKFORCEABSTRACTTAG:
 			lex >> docbookforceabstracttag_;
 			break;
@@ -753,6 +769,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookwrapperattr_;
 			break;
 
+		case LT_DOCBOOKWRAPPERTAGTYPE:
+			lex >> docbookwrappertagtype_;
+			break;
+
 		case LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS:
 			lex >> docbookwrappermergewithprevious_;
 			break;
@@ -769,6 +789,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookitemwrapperattr_;
 			break;
 
+		case LT_DOCBOOKITEMWRAPPERTAGTYPE:
+			lex >> docbookitemwrappertagtype_;
+			break;
+
 		case LT_DOCBOOKITEMTAG:
 			lex >> docbookitemtag_;
 			break;
@@ -777,6 +801,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookitemattr_;
 			break;
 
+		case LT_DOCBOOKITEMTAGTYPE:
+			lex >> docbookitemtagtype_;
+			break;
+
 		case LT_DOCBOOKITEMLABELTAG:
 			lex >> docbookitemlabeltag_;
 			break;
@@ -785,6 +813,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookitemlabelattr_;
 			break;
 
+		case LT_DOCBOOKITEMLABELTAGTYPE:
+			lex >> docbookitemlabeltagtype_;
+			break;
+
 		case LT_DOCBOOKITEMINNERTAG:
 			lex >> docbookiteminnertag_;
 			break;
@@ -793,6 +825,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookiteminnerattr_;
 			break;
 
+		case LT_DOCBOOKITEMINNERTAGTYPE:
+			lex >> docbookiteminnertagtype_;
+			break;
+
 		case LT_SPELLCHECK:
 			lex >> spellcheck;
 			break;
@@ -1608,6 +1644,8 @@ void Layout::write(ostream & os) const
 		os << "\tDocBookTag " << docbooktag_ << '\n';
 	if(!docbookattr_.empty())
 		os << "\tDocBookAttr " << docbookattr_ << '\n';
+	if(!docbooktagtype_.empty())
+		os << "\tDocBookTagType " << docbooktagtype_ << '\n';
 	if(!docbookininfo_.empty())
 		os << "\tDocBookInInfo " << docbookininfo_ << '\n';
 	os << "\tDocBookAbstract " << docbookabstract_ << '\n';
@@ -1615,25 +1653,35 @@ void Layout::write(ostream & os) const
 		os << "\tDocBookWrapperTag " << docbookwrappertag_ << '\n';
 	if(!docbookwrapperattr_.empty())
 		os << "\tDocBookWrapperAttr " << docbookwrapperattr_ << '\n';
+	if(!docbookwrappertagtype_.empty())
+		os << "\tDocBookWrapperTagType " << docbookwrappertagtype_ << '\n';
 	if(!docbooksectiontag_.empty())
 		os << "\tDocBookSectionTag " << docbooksectiontag_ << '\n';
 	if(!docbookitemtag_.empty())
 		os << "\tDocBookItemTag " << docbookitemtag_ << '\n';
 	if(!docbookitemattr_.empty())
 		os << "\tDocBookItemAttr " << docbookitemattr_ << '\n';
+	if(!docbookitemtagtype_.empty())
+		os << "\tDocBookItemTagType " << docbookitemtagtype_ << '\n';
 	if(!docbookitemwrappertag_.empty())
 		os << "\tDocBookItemWrapperTag " << docbookitemwrappertag_ << '\n';
 	if(!docbookitemwrapperattr_.empty())
 		os << "\tDocBookItemWrapperAttr " << docbookitemwrapperattr_ << '\n';
+	if(!docbookitemwrappertagtype_.empty())
+		os << "\tDocBookItemWrapperTagType " << docbookitemwrappertagtype_ << '\n';
 	os << "\tDocBookItemWrapperMergeWithPrevious " << docbookwrappermergewithprevious_ << '\n';
 	if(!docbookitemlabeltag_.empty())
 		os << "\tDocBookItemLabelTag " << docbookitemlabeltag_ << '\n';
 	if(!docbookitemlabelattr_.empty())
 		os << "\tDocBookItemLabelAttr " << docbookitemlabelattr_ << '\n';
+	if(!docbookitemlabeltagtype_.empty())
+		os << "\tDocBookItemLabelTagType " << docbookitemlabeltagtype_ << '\n';
 	if(!docbookiteminnertag_.empty())
 		os << "\tDocBookItemInnerTag " << docbookiteminnertag_ << '\n';
 	if(!docbookiteminnerattr_.empty())
 		os << "\tDocBookItemInnerAttr " << docbookiteminnerattr_ << '\n';
+	if(!docbookiteminnertagtype_.empty())
+		os << "\tDocBookItemInnerTagType " << docbookiteminnertagtype_ << '\n';
 	if(!docbookforceabstracttag_.empty())
 		os << "\tDocBookForceAbstractTag " << docbookforceabstracttag_ << '\n';
 	os << "\tSpellcheck " << spellcheck << "\n"
@@ -1786,9 +1834,12 @@ string Layout::defaultCSSClass() const
 
 string const & Layout::docbooktag() const
 {
-	// No sensible default value, unhappily...
-	if (docbooktag_.empty())
-		docbooktag_ = to_utf8(name_);
+	if (docbooktag_.empty()) {
+		if (to_ascii(name_) == "Plain Layout")
+			docbooktag_ = "para";
+		else // No sensible default value, unhappily...
+			docbooktag_ = to_utf8(name_);
+	}
 	return docbooktag_;
 }
 
@@ -1800,6 +1851,20 @@ string const & Layout::docbookattr() const
 }
 
 
+bool isValidTagType(std::string type)
+{
+	return !(type.empty() || (type != "block" && type != "paragraph" && type != "inline"));
+}
+
+
+string const & Layout::docbooktagtype() const
+{
+	if (!isValidTagType(docbooktagtype_))
+		docbooktagtype_ = "block";
+	return docbooktagtype_;
+}
+
+
 string const & Layout::docbookininfo() const
 {
 	// Indeed, a trilean. Only titles should be "maybe": otherwise, metadata is "always", content is "never". 
@@ -1823,6 +1888,14 @@ string const & Layout::docbookwrapperattr() const
 }
 
 
+string const & Layout::docbookwrappertagtype() const
+{
+	if (!isValidTagType(docbookwrappertagtype_))
+		docbookwrappertagtype_ = "block";
+	return docbookwrappertagtype_;
+}
+
+
 string const & Layout::docbooksectiontag() const
 {
 	if (docbooksectiontag_.empty())
@@ -1845,9 +1918,19 @@ string const & Layout::docbookitemwrapperattr() const
 }
 
 
+string const & Layout::docbookitemwrappertagtype() const
+{
+	if (!isValidTagType(docbookitemwrappertagtype_))
+		docbookitemwrappertagtype_ = "block";
+	return docbookitemwrappertagtype_;
+}
+
+
 string const & Layout::docbookitemtag() const
 {
-    return docbookitemtag_;
+	if (docbookitemtag_.empty())
+		docbookitemtag_ = "NONE";
+	return docbookitemtag_;
 }
 
 
@@ -1857,6 +1940,14 @@ string const & Layout::docbookitemattr() const
 }
 
 
+string const & Layout::docbookitemtagtype() const
+{
+	if (!isValidTagType(docbookitemtagtype_))
+		docbookitemtagtype_ = "block";
+	return docbookitemtagtype_;
+}
+
+
 string const & Layout::docbookitemlabeltag() const
 {
 	if (docbookitemlabeltag_.empty())
@@ -1871,6 +1962,14 @@ string const & Layout::docbookitemlabelattr() const
 }
 
 
+string const & Layout::docbookitemlabeltagtype() const
+{
+	if (!isValidTagType(docbookitemlabeltagtype_))
+		docbookitemlabeltagtype_ = "block";
+	return docbookitemlabeltagtype_;
+}
+
+
 string const & Layout::docbookiteminnertag() const
 {
 	if (docbookiteminnertag_.empty())
@@ -1885,6 +1984,14 @@ string const & Layout::docbookiteminnerattr() const
 }
 
 
+string const & Layout::docbookiteminnertagtype() const
+{
+	if (!isValidTagType(docbookiteminnertagtype_))
+		docbookiteminnertagtype_ = "block";
+	return docbookiteminnertagtype_;
+}
+
+
 std::string const & Layout::docbookforceabstracttag() const
 {
 	if (docbookforceabstracttag_.empty())
diff --git a/src/Layout.h b/src/Layout.h
index a894142..14784a2 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -197,6 +197,8 @@ public:
 	///
 	std::string const & docbookattr() const;
 	///
+	std::string const & docbooktagtype() const;
+	///
 	std::string const & docbookininfo() const;
 	///
 	bool docbookabstract() const { return docbookabstract_; }
@@ -205,6 +207,8 @@ public:
 	///
 	std::string const & docbookwrapperattr() const;
 	///
+	std::string const & docbookwrappertagtype() const;
+	///
 	bool docbookwrappermergewithprevious() const { return docbookwrappermergewithprevious_; }
 	///
 	std::string const & docbooksectiontag() const;
@@ -213,18 +217,26 @@ public:
 	///
 	std::string const & docbookitemwrapperattr() const;
 	///
+	std::string const & docbookitemwrappertagtype() const;
+	///
 	std::string const & docbookitemlabeltag() const;
 	///
 	std::string const & docbookitemlabelattr() const;
 	///
+	std::string const & docbookitemlabeltagtype() const;
+	///
 	std::string const & docbookiteminnertag() const;
 	///
 	std::string const & docbookiteminnerattr() const;
 	///
+	std::string const & docbookiteminnertagtype() const;
+	///
 	std::string const & docbookitemtag() const;
 	///
 	std::string const & docbookitemattr() const;
 	///
+	std::string const & docbookitemtagtype() const;
+	///
 	std::string const & docbookforceabstracttag() const;
 	///
 	bool isParagraph() const { return latextype == LATEX_PARAGRAPH; }
@@ -495,27 +507,39 @@ private:
 	mutable std::string docbooktag_;
 	/// Roles to add to docbooktag_, if any (default: none).
 	mutable std::string docbookattr_;
+	/// DocBook tag type corresponding to this layout (block, paragraph, or inline; default: block).
+	mutable std::string docbooktagtype_;
 	/// DocBook tag corresponding to this item (mainly for lists).
 	mutable std::string docbookitemtag_;
 	/// Roles to add to docbookitemtag_, if any (default: none).
 	mutable std::string docbookitemattr_;
+	/// DocBook tag type corresponding to this item (block, paragraph, or inline; default: block).
+	mutable std::string docbookitemtagtype_;
 	/// DocBook tag corresponding to the wrapper around an item (mainly for lists).
 	mutable std::string docbookitemwrappertag_;
 	/// Roles to add to docbookitemwrappertag_, if any (default: none).
 	mutable std::string docbookitemwrapperattr_;
-	/// DocBook tag corresponding to this label (only for description lists;
+	/// DocBook tag type corresponding to the wrapper around an item (block, paragraph, or inline; default: block).
+	mutable std::string docbookitemwrappertagtype_;
+	/// DocBook tag corresponding to this label (mostly for description lists;
 	/// labels in the common sense do not exist with DocBook).
 	mutable std::string docbookitemlabeltag_;
 	/// Roles to add to docbooklabeltag_, if any (default: none).
 	mutable std::string docbookitemlabelattr_;
+	/// DocBook tag corresponding to this label (block, paragraph, or inline; default: block).
+	mutable std::string docbookitemlabeltagtype_;
 	/// DocBook tag to add within the item, around its direct content (mainly for lists).
 	mutable std::string docbookiteminnertag_;
 	/// Roles to add to docbookiteminnertag_, if any (default: none).
 	mutable std::string docbookiteminnerattr_;
+	/// DocBook tag to add within the item, around its direct content (block, paragraph, or inline; default: block).
+	mutable std::string docbookiteminnertagtype_;
 	/// DocBook tag corresponding to this wrapper around the main tag.
 	mutable std::string docbookwrappertag_;
 	/// Roles to add to docbookwrappertag_, if any (default: none).
 	mutable std::string docbookwrapperattr_;
+	/// DocBook tag corresponding to this wrapper around the main tag (block, paragraph, or inline; default: block).
+	mutable std::string docbookwrappertagtype_;
 	/// Whether this wrapper tag may be merged with the previously opened wrapper tag.
 	bool docbookwrappermergewithprevious_;
 	/// Outer tag for this section, only if this layout represent a sectionning item, including chapters
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 469cfaf..900d6b2 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -62,7 +62,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 83; // tcuvelier: DocBookWrapperMergeWithPrevious.
+int const LAYOUT_FORMAT = 84; // tcuvelier: DocBook*TagType.
 
 
 // Layout format for the current lyx file format. Controls which format is
@@ -1378,6 +1378,7 @@ bool TextClass::readFloat(Lexer & lexrc)
 		FT_HTMLTAG,
 		FT_DOCBOOKATTR,
 		FT_DOCBOOKTAG,
+		FT_DOCBOOKTAGTYPE,
 		FT_LISTCOMMAND,
 		FT_REFPREFIX,
 		FT_ALLOWED_PLACEMENT,
@@ -1393,6 +1394,7 @@ bool TextClass::readFloat(Lexer & lexrc)
 		{ "allowswide", FT_ALLOWS_WIDE },
 		{ "docbookattr", FT_DOCBOOKATTR },
 		{ "docbooktag", FT_DOCBOOKTAG },
+		{ "docbooktagtype", FT_DOCBOOKTAGTYPE },
 		{ "end", FT_END },
 		{ "extension", FT_EXT },
 		{ "guiname", FT_NAME },
@@ -1419,6 +1421,7 @@ bool TextClass::readFloat(Lexer & lexrc)
 	string htmltag;
 	string docbookattr;
 	string docbooktag;
+	string docbooktagtype;
 	string listname;
 	string listcommand;
 	string name;
@@ -1540,6 +1543,10 @@ bool TextClass::readFloat(Lexer & lexrc)
 			lexrc.next();
 			docbooktag = lexrc.getString();
 			break;
+		case FT_DOCBOOKTAGTYPE:
+			lexrc.next();
+			docbooktagtype = lexrc.getString();
+			break;
 		case FT_END:
 			getout = true;
 			break;
@@ -1568,8 +1575,8 @@ bool TextClass::readFloat(Lexer & lexrc)
 		Floating fl(type, placement, ext, within, style, name,
 			listname, listcommand, refprefix, allowed_placement,
 			htmltag, htmlattr, htmlstyle, docbooktag, docbookattr,
-			required, usesfloat, ispredefined, allowswide,
-			allowssideways);
+			docbooktagtype, required, usesfloat, ispredefined,
+	        allowswide, allowssideways);
 		floatlist_.newFloat(fl);
 		// each float has its own counter
 		counters_.newCounter(from_ascii(type), from_ascii(within),


More information about the lyx-cvs mailing list