[LyX features/feature/docbook] DocBook: in configure.py, DeclareDocBookClass doesn't need to be checked anymore.

Thibaut Cuvelier tcuvelier at lyx.org
Fri Sep 11 00:30:47 UTC 2020


The branch, feature/docbook, has been updated.
  discards  dcaaa5970efc34562a7f90a2fd438b30f38b1bfd (commit)
  discards  e32b7760ed8ff7617116c87b806b09a0632e3500 (commit)
  discards  d2ef4a20122e3b1a59f0b19b1a13c407b43693df (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (dcaaa5970efc34562a7f90a2fd438b30f38b1bfd)
            \
             N -- N -- N (d4101fc1960a8ab185913762e8995709881abac0)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

- Log -----------------------------------------------------------------

commit d4101fc1960a8ab185913762e8995709881abac0
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 01:51:33 2020 +0200

    DocBook: in configure.py, DeclareDocBookClass doesn't need to be checked anymore.

diff --git a/lib/configure.py b/lib/configure.py
index 2247c78..55d9a43 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1339,7 +1339,7 @@ def processLayoutFile(file):
     '''
     classname = file.split(os.sep)[-1].split('.')[0]
     # return ('LaTeX', '[a,b]', 'a', ',b,c', 'article') for \DeclareLaTeXClass[a,b,c]{article}
-    p = re.compile('\s*#\s*\\\\Declare(LaTeX|DocBook)Class\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
+    p = re.compile('\s*#\s*\\\\DeclareLaTeXClass\s*(\[([^,]*)(,.*)*\])*\s*{(.*)}\s*$')
     q = re.compile('\s*#\s*\\\\DeclareCategory{(.*)}\s*$')
     classdeclaration = ""
     categorydeclaration = '""'
@@ -1434,7 +1434,7 @@ def checkLatexConfig(check_config):
     # Construct the list of classes to test for.
     # build the list of available layout files and convert it to commands
     # for chkconfig.ltx
-    declare = re.compile('\\s*#\\s*\\\\Declare(LaTeX|DocBook)Class\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
+    declare = re.compile('\\s*#\\s*\\\\DeclareLaTeXClass\\s*(\[([^,]*)(,.*)*\])*\\s*{(.*)}\\s*$')
     category = re.compile('\\s*#\\s*\\\\DeclareCategory{(.*)}\\s*$')
     empty = re.compile('\\s*$')
     testclasses = list()

commit a697043327812868b26c84e3d30fa1a4b23d8786
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 01:50:26 2020 +0200

    DocBook: remove now useless function in configure.py.

diff --git a/lib/configure.py b/lib/configure.py
index 1547000..2247c78 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1265,26 +1265,6 @@ def checkConverterEntries():
 ''')
 
 
-def checkDocBook():
-    ''' Check docbook '''
-    path, DOCBOOK = checkProg('SGML-tools 2.x (DocBook), db2x scripts or xsltproc', ['sgmltools', 'db2dvi', 'xsltproc'],
-        rc_entry = [
-            r'''\converter docbook    dvi        "sgmltools -b dvi $$i"	""
-\converter docbook    html       "sgmltools -b html $$i"	""
-\converter docbook    ps         "sgmltools -b ps $$i"	""''',
-            r'''\converter docbook    dvi        "db2dvi $$i"	""
-\converter docbook    html       "db2html $$i"	""''',
-            r'''\converter docbook    dvi        ""	""
-\converter docbook    html       "" ""''',
-            r'''\converter docbook    dvi        ""	""
-\converter docbook    html       ""	""'''])
-    #
-    if DOCBOOK:
-        return ('yes', 'true', '\\def\\hasdocbook{yes}')
-    else:
-        return ('no', 'false', '')
-
-
 def checkOtherEntries():
     ''' entries other than Format and Converter '''
     checkProg('ChkTeX', ['chktex -n1 -n3 -n6 -n9 -n22 -n25 -n30 -n38'],

commit 7587ee25bf4fdef280f3392657d488cbed8271d1
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Sep 11 01:28:59 2020 +0200

    DocBook: fix handling of new lines and fonts.
    
    Only the font variable was restored to the right state, not fs.

diff --git a/autotests/export/docbook/fonts_EmbeddedObjects.lyx b/autotests/export/docbook/fonts_EmbeddedObjects.lyx
new file mode 100644
index 0000000..9ea1ff1
--- /dev/null
+++ b/autotests/export/docbook/fonts_EmbeddedObjects.lyx
@@ -0,0 +1,288 @@
+#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 scrbook
+\begin_preamble
+% that links to image floats jumps
+% to the beginning of the float and 
+% not to its caption
+\usepackage[figure]{hypcap}
+
+% the pages of the TOC are numbered roman
+% and a PDF-bookmark for the TOC is added
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+  \frontmatter
+  \pdfbookmark[1]{\contentsname}{}
+  \myTOC
+  \mainmatter }
+
+% provides caption formatting
+\usepackage[labelfont={bf,sf}]{caption}[2004/07/16]
+
+% provides commands to set caption
+% beside tables/images
+\newcommand{\TabBesBeg}[1][1.0]{%
+ \let\MyTable\table
+ \let\MyEndtable\endtable
+ \renewenvironment{table}[1]{\begin{SCtable}[#1]##1}{\end{SCtable}}}
+
+\newcommand{\TabBesEnd}{%
+ \let\table\MyTable
+ \let\endtable\MyEndtable}
+
+\newcommand{\FigBesBeg}[1][1.0]{%
+ \let\MyFigure\figure
+ \let\MyEndfigure\endfigure
+ \renewenvironment{figure}[1]{\begin{SCfigure}[#1]##1}{\end{SCfigure}}}
+
+\newcommand{\FigBesEnd}{%
+ \let\figure\MyFigure
+ \let\endfigure\MyEndfigure}
+
+% enables calculation of values,
+\usepackage{calc}
+
+% increase the bottom float placement fraction
+\renewcommand{\bottomfraction}{0.5}
+
+% avoids that floats are placed before their
+% corresponding section starts
+\let\mySection\section\renewcommand{\section}{\suppressfloats[t]\mySection}
+
+% speed up the longtable calculation
+\setcounter{LTchunksize}{100}
+
+% used for colored tables
+\@ifundefined{textcolor}
+ {\usepackage{color}}{}
+\definecolor{darkgreen}{cmyk}{0.5, 0, 1, 0.5}
+\definecolor{lightgrey}{gray}{0.8}
+
+% check for package colortbl
+% used for colored table cells
+\newboolean{colortbl}
+\IfFileExists{colortbl.sty}
+ {\usepackage{colortbl}
+  \setboolean{colortbl}{true}}
+ {\setboolean{colortbl}{false}}
+
+% used to have extra space in table cells
+\@ifundefined{extrarowheight}
+ {\usepackage{array}}{}
+\setlength{\extrarowheight}{2pt}
+
+% used for customized tables
+% ---
+\newcolumntype{M}[1]
+ {>{\centering\hspace{0pt}}m{#1}}
+
+\newcolumntype{S}[2]
+ {>{\centering\hspace{0pt}}m{(#1+(2\tabcolsep+\arrayrulewidth)*(1-#2))/#2}}
+
+\newcolumntype{K}[1]
+ {>{\columncolor{#1}\hspace{0pt}}c}
+
+\newcolumntype{V}{!{\vrule width 1.5pt}}
+
+\newcolumntype{W}{!{\color{green}\vline}}
+% ---
+
+% insert additional vertical space of
+% 1.5 mm between footnotes
+\let\myFoot\footnote
+\renewcommand{\footnote}[1]{\myFoot{#1\vspace{1.5mm}}}
+
+% number algorithm floats within chapters
+\numberwithin{algorithm}{chapter}
+
+% ------------------------------------
+% used to check for needed LaTeX packages
+\usepackage{ifthen}
+
+% check for package arydshln
+% used for tables with dashed lines
+\newboolean{arydshln}
+\IfFileExists{arydshln.sty}
+ {\usepackage{arydshln}
+  \setboolean{arydshln}{true}}
+ {\setboolean{arydshln}{false}}
+
+% check for package marginnote
+% used for margin notes
+\newboolean{marginnote}
+\IfFileExists{marginnote.sty}
+ {\usepackage{marginnote}
+  \let\marginpar\marginnote
+  \setboolean{marginnote}{true}}
+ {\setboolean{marginnote}{false}}
+
+% check for package sidecap
+% used for captions on the side
+\newboolean{sidecap}
+\IfFileExists{sidecap.sty}
+ {\usepackage{sidecap}
+  \setboolean{sidecap}{true}}
+ {\setboolean{sidecap}{false}}
+
+% check for picinpar
+% used for surrounded fixed objects
+\newboolean{picinpar}
+\IfFileExists{picinpar.sty}
+ {\usepackage{picinpar}
+  \setboolean{picinpar}{true}}
+ {\setboolean{picinpar}{false}}
+
+% check for lettrine
+\newboolean{lettrine}
+\IfFileExists{lettrine.sty}
+ {\usepackage{lettrine}
+  \setboolean{lettrine}{true}}
+ {\setboolean{lettrine}{false}}
+
+% check for diagbox
+\newboolean{diagbox}
+\IfFileExists{diagbox.sty}
+ {\usepackage{diagbox}
+  \setboolean{diagbox}{true}}
+ {\setboolean{diagbox}{false}}
+% Added by lyx2lyx
+\setlength{\parskip}{\medskipamount}
+\setlength{\parindent}{0pt}
+\end_preamble
+\options bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading,dvipsnames,table
+\use_default_options false
+\begin_modules
+initials
+graphicboxes
+varwidth
+\end_modules
+\maintain_unincluded_children no
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "lmodern" "default"
+\font_sans "lmss" "default"
+\font_typewriter "lmtt" "default"
+\font_math "auto" "auto"
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc 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
+\use_dash_ligatures true
+\graphics default
+\default_output_format pdf2
+\output_sync 0
+\bibtex_command default
+\index_command makeindex
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX's Figure, Table, Floats, Notes, and Boxes manual"
+\pdf_author "LyX Team, Uwe Stöhr"
+\pdf_subject "LyX-documentation about figures, tables, floats, notes, and boxes"
+\pdf_keywords "LyX, Tables, Figures, Floats, Boxes, Notes"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen true
+\pdf_bookmarksopenlevel 1
+\pdf_breaklinks false
+\pdf_pdfborder false
+\pdf_colorlinks true
+\pdf_backref false
+\pdf_pdfusetitle false
+\pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
+\papersize default
+\use_geometry false
+\use_package amsmath 1
+\use_package amssymb 1
+\use_package cancel 1
+\use_package esint 1
+\use_package mathdots 1
+\use_package mathtools 1
+\use_package mhchem 1
+\use_package stackrel 1
+\use_package stmaryrd 1
+\use_package undertilde 1
+\cite_engine basic
+\cite_engine_type default
+\biblio_style plain
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\use_minted 0
+\use_lineno 0
+\notefontcolor #0000ff
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\is_math_indent 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 2
+\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
+
+\begin_layout Title
+\SpecialChar LyX
+'s detailed Figure, Table, Floats, Notes, Boxes and External Material manual
+\end_layout
+
+\begin_layout Chapter
+Floats
+\end_layout
+
+\begin_layout Standard
+can be created using these commands in the document preamble:
+\end_layout
+
+\begin_layout Standard
+
+\series bold
+
+\backslash
+usepackage[tableposition=top]{caption}
+\series default
+
+\begin_inset Newline newline
+\end_inset
+
+
+\series bold
+
+\backslash
+captionsetup[figure]{labelfont={tt}, textfont=it, indention=1cm,%
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/fonts_EmbeddedObjects.xml b/autotests/export/docbook/fonts_EmbeddedObjects.xml
new file mode 100644
index 0000000..7ce65a1
--- /dev/null
+++ b/autotests/export/docbook/fonts_EmbeddedObjects.xml
@@ -0,0 +1,12 @@
+<?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.2">
+<title>LyX's detailed Figure, Table, Floats, Notes, Boxes and External Material manual</title>
+<chapter>
+<title>Floats</title>
+<para>can be created using these commands in the document preamble:</para>
+<para><emphasis role='bold'>\usepackage[tableposition=top]{caption}</emphasis></para>
+<para><emphasis role='bold'>\captionsetup[figure]{labelfont={tt}, textfont=it, indention=1cm,%</emphasis></para>
+</chapter>
+</book>
\ No newline at end of file
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index a409d20..8da67e3 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -3350,6 +3350,7 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 	vector<xml::EndFontTag> tagsToClose;
 
 	std::vector<docstring> generatedParagraphs;
+	DocBookFontState old_fs = fs;
 	odocstringstream os;
 	auto * xs = new XMLStream(os); // XMLStream has no copy constructor: to create a new object, the only solution
 	// is to hold a pointer to the XMLStream (xs = XMLStream(os) is not allowed once the first object is built).
@@ -3369,8 +3370,10 @@ std::vector<docstring> Paragraph::simpleDocBookOnePar(Buffer const & buf,
 			os = odocstringstream();
 			delete xs;
 			xs = new XMLStream(os);
-			if (!ignore_fonts)
+			if (!ignore_fonts) {
 				font_old = outerfont.fontInfo();
+				fs = old_fs;
+			}
 		}
 
 		// Determine which tags should be opened or closed regarding fonts.

-----------------------------------------------------------------------

Summary of changes:
 ...beddedObjects.lyx => fonts_EmbeddedObjects.lyx} |    0
 ...beddedObjects.xml => fonts_EmbeddedObjects.xml} |    0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename autotests/export/docbook/{EmbeddedObjects.lyx => fonts_EmbeddedObjects.lyx} (100%)
 rename autotests/export/docbook/{EmbeddedObjects.xml => fonts_EmbeddedObjects.xml} (100%)


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list