[LyX/master] DocBook: restore the old DocBook support.

Thibaut Cuvelier tcuvelier at lyx.org
Wed Oct 7 03:08:26 UTC 2020


commit 1a054e45711f30dfdf197a4d2ead4b3365318208
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Wed Oct 7 05:33:56 2020 +0200

    DocBook: restore the old DocBook support.
---
 autotests/export/docbook/olddb_article.lyx |   33 ++++++++---
 autotests/export/docbook/olddb_article.xml |   31 ++++------
 autotests/export/docbook/olddb_book.lyx    |   37 +++++++++---
 autotests/export/docbook/olddb_book.xml    |   35 +++++------
 lib/layouts/db_stdclass.inc                |   39 ++++++++++++
 lib/layouts/db_stdstruct.inc               |   21 +++++++
 lib/layouts/db_stdtitle.inc                |   88 ++++++++++++++++++++++++++++
 lib/layouts/docbook-book.layout            |    3 +
 lib/layouts/docbook-chapter.layout         |    4 +-
 lib/layouts/docbook-section.layout         |    4 +-
 lib/layouts/docbook.layout                 |   14 +++++
 11 files changed, 249 insertions(+), 60 deletions(-)

diff --git a/autotests/export/docbook/olddb_article.lyx b/autotests/export/docbook/olddb_article.lyx
index 174a226..892cbe1 100644
--- a/autotests/export/docbook/olddb_article.lyx
+++ b/autotests/export/docbook/olddb_article.lyx
@@ -1,16 +1,16 @@
-#LyX 2.4 created this file. For more info see http://www.lyx.org/
-\lyxformat 544
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
 \begin_document
 \begin_header
 \save_transient_properties true
 \origin unavailable
 \textclass docbook
 \use_default_options true
-\maintain_unincluded_children false
+\maintain_unincluded_children no
 \language english
 \language_package default
-\inputencoding auto
-\fontencoding global
+\inputencoding auto-legacy
+\fontencoding auto
 \font_roman "default" "default"
 \font_sans "default" "default"
 \font_typewriter "default" "default"
@@ -18,7 +18,9 @@
 \font_default_family default
 \use_non_tex_fonts false
 \font_sc false
-\font_osf false
+\font_roman_osf false
+\font_sans_osf false
+\font_typewriter_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
 \use_microtype false
@@ -53,6 +55,7 @@
 \justification true
 \use_refstyle 1
 \use_minted 0
+\use_lineno 0
 \index Index
 \shortcut idx
 \color #008000
@@ -68,11 +71,15 @@
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
+\tablestyle default
 \tracking_changes false
 \output_changes false
+\change_bars false
+\postpone_fragile_content false
 \html_math_output 0
 \html_css_as_file 0
 \html_be_strict false
+\docbook_table_output 0
 \end_header
 
 \begin_body
@@ -98,6 +105,10 @@ Article abstract.
  
 \end_layout
 
+\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
 \begin_layout RevisionHistory
 Article revision history.
  
@@ -113,9 +124,13 @@ Article revision remark.
  
 \end_layout
 
-\begin_layout Verse
-Literal.
- 
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Content.
 \end_layout
 
 \end_body
diff --git a/autotests/export/docbook/olddb_article.xml b/autotests/export/docbook/olddb_article.xml
index 7cd3de3..8ebaba6 100644
--- a/autotests/export/docbook/olddb_article.xml
+++ b/autotests/export/docbook/olddb_article.xml
@@ -1,25 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This DocBook file was created by LyX 2.4.0dev
   See http://www.lyx.org/ for more information -->
-<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.1">
-
-<info><title>Article title</title>
-
-<author><personname>Article author
-</personname></author>
-
-<author><personname>Article author group
-</personname></author>
+<article xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
+<info>
+<title>Article title</title>
+<author>
+<personname>Article author</personname>
+</author>
+<authorgroup>
+<author>Article author group</author>
+</authorgroup>
 <date>Article date</date>
-
-<abstract><para>Article abstract. </para>
+<abstract>
+<para>Article abstract. </para>
 </abstract>
-</info>
-<RevisionHistory>Article revision history. </RevisionHistory>
-<Revision>Article revision. </Revision>
-<RevisionRemark>Article revision remark. </RevisionRemark>
-
-<literallayout><para>Literal. </para>
-</literallayout>
 
+</info>
+<para>Content.</para>
 </article>
\ No newline at end of file
diff --git a/autotests/export/docbook/olddb_book.lyx b/autotests/export/docbook/olddb_book.lyx
index 801086e..0f8e659 100644
--- a/autotests/export/docbook/olddb_book.lyx
+++ b/autotests/export/docbook/olddb_book.lyx
@@ -1,16 +1,16 @@
-#LyX 2.4 created this file. For more info see http://www.lyx.org/
-\lyxformat 544
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 598
 \begin_document
 \begin_header
 \save_transient_properties true
 \origin unavailable
 \textclass docbook-book
 \use_default_options true
-\maintain_unincluded_children false
+\maintain_unincluded_children no
 \language english
 \language_package default
-\inputencoding auto
-\fontencoding global
+\inputencoding auto-legacy
+\fontencoding auto
 \font_roman "default" "default"
 \font_sans "default" "default"
 \font_typewriter "default" "default"
@@ -18,7 +18,9 @@
 \font_default_family default
 \use_non_tex_fonts false
 \font_sc false
-\font_osf false
+\font_roman_osf false
+\font_sans_osf false
+\font_typewriter_osf false
 \font_sf_scale 100 100
 \font_tt_scale 100 100
 \use_microtype false
@@ -53,6 +55,7 @@
 \justification true
 \use_refstyle 1
 \use_minted 0
+\use_lineno 0
 \index Index
 \shortcut idx
 \color #008000
@@ -68,11 +71,15 @@
 \papercolumns 1
 \papersides 1
 \paperpagestyle default
+\tablestyle default
 \tracking_changes false
 \output_changes false
+\change_bars false
+\postpone_fragile_content false
 \html_math_output 0
 \html_css_as_file 0
 \html_be_strict false
+\docbook_table_output 0
 \end_header
 
 \begin_body
@@ -98,6 +105,10 @@ Book abstract.
  
 \end_layout
 
+\begin_layout Standard
+\begin_inset Note Note
+status collapsed
+
 \begin_layout RevisionHistory
 Book revision history.
  
@@ -113,9 +124,17 @@ Book revision remark.
  
 \end_layout
 
-\begin_layout Verse
-Literal.
- 
+\end_inset
+
+
+\end_layout
+
+\begin_layout Chapter
+Chapter
+\end_layout
+
+\begin_layout Standard
+Content.
 \end_layout
 
 \end_body
diff --git a/autotests/export/docbook/olddb_book.xml b/autotests/export/docbook/olddb_book.xml
index 5debd71..71befec 100644
--- a/autotests/export/docbook/olddb_book.xml
+++ b/autotests/export/docbook/olddb_book.xml
@@ -1,28 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This DocBook file was created by LyX 2.4.0dev
   See http://www.lyx.org/ for more information -->
-<book xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.1">
-
-<info><title>Book title</title>
-
-<author><personname>Book author
-</personname></author>
-
-<author><personname>Book author group
-</personname></author>
+<book xml:lang="en_US" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.2">
+<info>
+<title>Book title</title>
+<author>
+<personname>Book author</personname>
+</author>
+<authorgroup>
+<author>Book author group</author>
+</authorgroup>
 <date>Book date</date>
-
-<abstract><para>Book abstract. </para>
+<abstract>
+<para>Book abstract. </para>
 </abstract>
 
-<abstract><RevisionHistory>Book revision history. </RevisionHistory>
-</abstract>
 </info>
-<Revision>Book revision. </Revision>
-<RevisionRemark>Book revision remark. </RevisionRemark>
-
-
-<info><literallayout><para>Literal. </para>
-</literallayout>
-
+<chapter>
+<title>Chapter</title>
+<para>Content.</para>
+</chapter>
 </book>
\ No newline at end of file
diff --git a/lib/layouts/db_stdclass.inc b/lib/layouts/db_stdclass.inc
new file mode 100644
index 0000000..446af07
--- /dev/null
+++ b/lib/layouts/db_stdclass.inc
@@ -0,0 +1,39 @@
+# Textclass definition file for docbook.
+# Author : José Abílio Oliveira Matos <jamatos at lyx.org>
+
+# This file is the counterpart of stdclass.inc
+# It is desirable, as far as possible, to have the same look and feel for
+# related layouts in latex and docbook.
+
+Format 84
+
+Columns                 1
+Sides                   1
+SecNumDepth             3
+TocDepth                3
+DefaultStyle            Standard
+
+Style Standard
+	Category              MainText
+	Margin                Static
+	LatexType             Paragraph
+	LatexName             para
+	ParIndent             MM
+	ParSkip               0.4
+	Align                 Block
+	LabelType             No_Label
+	DocBookTag            para
+End
+
+Input stdinsets.inc
+Input db_stdcharstyles.inc
+# Input db_stdlists.inc
+# Input db_stdsections.inc
+Input db_stdstarsections.inc
+Input db_stdtitle.inc
+Input db_stdstruct.inc
+# Input db_lyxmacros.inc
+# Input db_stdlayouts.inc
+Input stdcounters.inc
+# Input db_stdcounters.inc
+Input stdfloats.inc
diff --git a/lib/layouts/db_stdstruct.inc b/lib/layouts/db_stdstruct.inc
new file mode 100644
index 0000000..b42f09a
--- /dev/null
+++ b/lib/layouts/db_stdstruct.inc
@@ -0,0 +1,21 @@
+# Textclass definition file for docbook.
+# Author : José Abílio Oliveira Matos <jamatos at lyx.org>
+
+# This file is the counterpart of stdstruct.inc
+# It is desirable, as far as possible, to have the same look and feel for
+# related layouts in latex and docbook.
+
+Format 84
+Input stdstruct.inc
+
+Style Abstract
+	LatexType             Environment
+	LatexName             abstract
+	DocBookAbstract       true
+	DocBookInInfo         always
+	DocBookWrapperTag     abstract
+	DocBookWrapperMergeWithPrevious    true
+	DocBookTag            para
+End
+
+NoStyle Bibliography
diff --git a/lib/layouts/db_stdtitle.inc b/lib/layouts/db_stdtitle.inc
new file mode 100644
index 0000000..9adc1bb
--- /dev/null
+++ b/lib/layouts/db_stdtitle.inc
@@ -0,0 +1,88 @@
+# Textclass definition file for docbook.
+# Author : José Abílio Oliveira Matos <jamatos at lyx.org>
+# Modified Martin Vermeer <martin.vermeer at hut.fi>
+#
+# This file is the counterpart of stdstyle.inc
+# It is desirable, as far as possible, to have the same look and feel for
+# related layouts in latex and docbook.
+
+Format 84
+Input stdtitle.inc
+
+
+Style Authorgroup
+	CopyStyle             Author
+	LatexType             Environment
+	LatexName             authorgroup
+	# TODO: missing a DocBookInnerTag to be valid (authorgroup > author > personname). 
+	DocBookTag            author
+	DocBookTagType        paragraph
+	DocBookWrapperTag     authorgroup
+	DocBookWrapperTagType paragraph
+End
+
+
+Style RevisionHistory
+	Margin                Static
+	LatexType             Command
+	LatexName             revhistory
+	CommandDepth          3
+	InnerTag              "!-- --"
+	LeftMargin            MMM
+	RightMargin           MMM
+	ParIndent             MM
+	TopSep                0.7
+	BottomSep             0
+	ParSep                0
+	Align                 Block
+	KeepEmpty             1
+	LabelType             Centered
+	LabelString           "Revision History"
+	LabelBottomSep        0.5
+	DocBookTag            revhistory
+	DocBookTagType        paragraph
+End
+
+
+Style Revision
+	Margin                Dynamic
+	LatexType             Command
+	LatexName             revision
+	CommandDepth          4
+	InnerTag              revnumber
+	LabelSep              xxx
+	ParSkip               0.4
+	TopSep                0.9
+	BottomSep             0.5
+	ParSep                0.5
+	Align                 Block
+	DocBookTag            revision
+	DocBookTagType        paragraph
+End
+
+
+Style RevisionRemark
+	Margin                Static
+	LatexType             Paragraph
+	InTitle               1
+	LatexName             revremark
+	LabelSep              xxx
+	ParIndent             MM
+	ParSkip               0.0
+	TopSep                0.0
+	BottomSep             0.0
+	ParSep                1
+	Align                 Block
+	LabelType             No_Label
+	DocBookTag            revremark
+	DocBookTagType        paragraph
+End
+
+
+Style FirstName
+	ObsoletedBy   Standard
+End
+
+Style Surname
+	ObsoletedBy   Standard
+End
diff --git a/lib/layouts/docbook-book.layout b/lib/layouts/docbook-book.layout
index 525bddb..4b1c9d4 100644
--- a/lib/layouts/docbook-book.layout
+++ b/lib/layouts/docbook-book.layout
@@ -1,4 +1,7 @@
 #% Do not delete the line below; configure depends on this
+#  \DeclareLaTeXClass[docbook5_book]{DocBook Book (XML)}
+#  \DeclareCategory{Books}
+#% Do not delete the line below; configure depends on this
 #  \DeclareDocBookClass[book]{DocBook Book (XML)}
 #  \DeclareCategory{Books (DocBook)}
 # DocBook textclass definition file.
diff --git a/lib/layouts/docbook-chapter.layout b/lib/layouts/docbook-chapter.layout
index 2940592..dd47572 100644
--- a/lib/layouts/docbook-chapter.layout
+++ b/lib/layouts/docbook-chapter.layout
@@ -1,6 +1,6 @@
 #% Do not delete the line below; configure depends on this
-#  \DeclareDocBookClass[chapter]{DocBook Chapter (XML)}
-#  \DeclareCategory{Books (DocBook)}
+#  \DeclareLaTeXClass[docbook5_chapter]{DocBook Chapter (XML)}
+#  \DeclareCategory{Books}
 # DocBook textclass definition file.
 # Author : Jose' Matos <jamatos at lyx.org>
 
diff --git a/lib/layouts/docbook-section.layout b/lib/layouts/docbook-section.layout
index 4107a19..5aab795 100644
--- a/lib/layouts/docbook-section.layout
+++ b/lib/layouts/docbook-section.layout
@@ -1,6 +1,6 @@
 #% Do not delete the line below; configure depends on this
-#  \DeclareDocBookClass[section]{DocBook Section (XML)}
-#  \DeclareCategory{Books (DocBook)}
+#  \DeclareLaTeXClass[docbook5_section]{DocBook Section (XML)}
+#  \DeclareCategory{Books}
 # DocBook textclass definition file.
 # Author : Jose' Matos <jamatos at lyx.org>
 
diff --git a/lib/layouts/docbook.layout b/lib/layouts/docbook.layout
new file mode 100644
index 0000000..c8adf18
--- /dev/null
+++ b/lib/layouts/docbook.layout
@@ -0,0 +1,14 @@
+#% Do not delete the line below; configure depends on this
+#  \DeclareLaTeXClass[docbook]{DocBook Article (XML)}
+#  \DeclareCategory{Articles}
+# DocBook textclass definition file.
+# Author : Jose' Matos <jamatos at lyx.org>
+
+Format 84 
+Input db_stdclass.inc
+
+# Exclude higher, or equal, sections:
+NoStyle Part
+NoCounter part
+NoStyle Chapter
+NoCounter chapter


More information about the lyx-cvs mailing list