[LyX features/feature/docbook] DocBook: fix a crash in bibliography paragraphs.

Thibaut Cuvelier tcuvelier at lyx.org
Fri Sep 11 23:21:47 UTC 2020


The branch, feature/docbook, has been updated.

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

commit 42b869118c0821b6fdaaebc0da14134990358de9
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Sep 12 01:43:57 2020 +0200

    DocBook: fix a crash in bibliography paragraphs.

diff --git a/autotests/export/docbook/SciPoster.lyx b/autotests/export/docbook/SciPoster.lyx
new file mode 100644
index 0000000..1bd3b51
--- /dev/null
+++ b/autotests/export/docbook/SciPoster.lyx
@@ -0,0 +1,867 @@
+#LyX 2.3 created this file. For more info see http://www.lyx.org/
+\lyxformat 544
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin /systemlyxdir/templates/Posters/
+\textclass sciposter
+\begin_preamble
+%% Comment this out and adapt if you want a poster background
+%\usepackage{wallpaper}
+%\CenterWallPaper{1.1}{poster-background}
+
+% Set all margins to 1cm
+\setmargins[1cm]
+
+% Set up column layout
+\setlength\columnseprule{0pt}
+\setlength\columnsep{4.5pc}
+
+% Color settings:
+\usepackage{sectionbox}
+% a.) background color
+%\definecolor{mainCol}{RGB}{255,237,208}
+% b.) text color (mainly subsection headers)
+\definecolor{TextCol}{RGB}{128,0,0}
+% c.) section header color
+\definecolor{SectionCol}{RGB}{0,0,255}
+% d.) color of section boxes
+\definecolor{sectboxfillcol}{RGB}{255,220,168}
+\definecolor{subsectboxfillcol}{RGB}{255,245,198}
+
+% Large section titles
+\renewcommand{\sectionsize}{\Large}
+\end_preamble
+\options landscape,a0,largefonts,plainsections
+\use_default_options false
+\begin_modules
+multicol
+sectionbox
+\end_modules
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding utf8
+\fontencoding global
+\font_roman "default" "default"
+\font_sans "default" "default"
+\font_typewriter "default" "default"
+\font_math "auto" "auto"
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100 100
+\font_tt_scale 100 100
+\use_microtype false
+\use_dash_ligatures false
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\spacing single
+\use_hyperref 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 natbib
+\cite_engine_type numerical
+\biblio_style plainnat
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\justification true
+\use_refstyle 0
+\use_minted 0
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 0
+\tocdepth -1
+\paragraph_separation indent
+\paragraph_indentation default
+\is_math_indent 0
+\math_numbering_side default
+\quotes_style english
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Title
+Poster Title
+\end_layout
+
+\begin_layout Author
+Author One and Author Two
+\end_layout
+
+\begin_layout Institute
+The University, Some address, Postal Code
+\end_layout
+
+\begin_layout E-Mail
+author1 at somewhere and author2 at elsewhere
+\end_layout
+
+\begin_layout Conference
+The Conference
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+appears in footer
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status open
+
+\begin_layout Section*
+Some advices
+\end_layout
+
+\begin_layout Subsubsection*
+Appearance
+\end_layout
+
+\begin_layout Itemize
+See 
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+\SpecialChar LaTeX
+ Preamble
+\family default
+ for some possibilities to adjust the appearance of your poster.
+ Also check 
+\family sans
+Document\SpecialChar menuseparator
+Settings\SpecialChar menuseparator
+Document Class\SpecialChar menuseparator
+Class Options
+\family default
+ for some general settings.
+ Please refer to the 
+\family sans
+sciposter
+\family default
+ manual for possible values.
+\end_layout
+
+\begin_layout Subsubsection*
+Logo
+\end_layout
+
+\begin_layout Itemize
+You can use the 
+\family sans
+LeftLogo
+\family default
+ and 
+\family sans
+RightLogo
+\family default
+ style to insert graphic logos in the header of your poster.
+ The logos need to be given as file names (with our without extension) and
+ with full path, if the files are not in the TEXMF directory.
+\end_layout
+
+\begin_layout Itemize
+Note that the logos only appear if you do not specify a 
+\begin_inset Quotes eld
+\end_inset
+
+Conference
+\begin_inset Quotes erd
+\end_inset
+
+ (i.
+\begin_inset space \thinspace{}
+\end_inset
+
+e., no foot line).
+\end_layout
+
+\begin_layout Subsubsection*
+Columns and Boxes
+\end_layout
+
+\begin_layout Itemize
+The 
+\family sans
+Columns
+\family default
+ and 
+\family sans
+(Section) Box
+\family default
+ insets can be found at 
+\family sans
+Insert\SpecialChar menuseparator
+Custom Insets.
+\end_layout
+
+\begin_layout Itemize
+Instead of the Section Boxes, you can also use the differently looking Color
+ Boxes via the 
+\begin_inset Quotes eld
+\end_inset
+
+Color Boxes
+\begin_inset Quotes erd
+\end_inset
+
+ module.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex Multiple Columns
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+
+3
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Abstract
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size small
+\emph on
+This is my special abstract This is my special abstract This is my special
+ abstract This is my special abstract This is my special abstract This is
+ my special abstract This is my special abstract This is my special abstract
+ This is my special abstract This is my special abstract.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Background
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+ This is the background and our hypothesis.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size small
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "One/Two(2010)"
+key "key-1"
+literal "true"
+
+\end_inset
+
+Author One & Author Two (2010): Our Great Book.
+ Somewhere.
+\end_layout
+
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+label "Two/One(2011)"
+key "key-2"
+literal "true"
+
+\end_inset
+
+Author Two & Author One (2011): Our Even Greater Book.
+ Somewhere.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+columnbreak
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Findings
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Some evidence
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+point one
+\end_layout
+
+\begin_layout Itemize
+point two
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+More evidence
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+point three
+\end_layout
+
+\begin_layout Itemize
+point four
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SubsectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Other issues
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+Really have to fill in this
+\end_layout
+
+\begin_layout Itemize
+Really have to fill in this
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+columnbreak
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Experiment
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ This is the experiment.
+ 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Results
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+result
+\end_layout
+
+\begin_layout Itemize
+result
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Conclusions
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Enumerate
+first conclusion
+\end_layout
+
+\begin_layout Enumerate
+second conclusion
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Flex SectionBox
+status open
+
+\begin_layout Plain Layout
+\begin_inset Argument 2
+status collapsed
+
+\begin_layout Plain Layout
+Available font size (and corresponding 
+\begin_inset ERT
+status collapsed
+
+\begin_layout Plain Layout
+
+
+\backslash
+LaTeX
+\backslash
+
+\end_layout
+
+\end_inset
+
+ commands)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\paragraph_spacing single
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+The extra sizes (
+\begin_inset Quotes eld
+\end_inset
+
+Giant
+\begin_inset Quotes erd
+\end_inset
+
+ etc.) are available at 
+\family sans
+Insert\SpecialChar menuseparator
+Custom Insets
+\family default
+.
+ For small inline snippets, there are variants at 
+\family sans
+Edit\SpecialChar menuseparator
+Text Style.
+\end_layout
+
+\begin_layout Plain Layout
+Note that for some paper sizes and font settings, 
+\begin_inset Quotes eld
+\end_inset
+
+More Giant
+\begin_inset Quotes erd
+\end_inset
+
+ and 
+\begin_inset Quotes eld
+\end_inset
+
+Most Giant
+\begin_inset Quotes erd
+\end_inset
+
+ are equal.
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+
+\size tiny
+Tiny (
+\family typewriter
+
+\backslash
+tiny
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size scriptsize
+Smallest (
+\family typewriter
+
+\backslash
+scriptsize
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size footnotesize
+Smaller (
+\family typewriter
+
+\backslash
+footnotesize
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size normal
+Normal (
+\family typewriter
+\size default
+
+\backslash
+normalsize
+\family default
+\size normal
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size large
+Large (
+\family typewriter
+
+\backslash
+large
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size larger
+Larger (
+\family typewriter
+
+\backslash
+Large
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size largest
+Largest (
+\family typewriter
+
+\backslash
+LARGE
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size huge
+Huge (
+\family typewriter
+
+\backslash
+huge
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+
+\size giant
+Huger (
+\family typewriter
+
+\backslash
+Huge
+\family default
+)
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex Giant
+status open
+
+\begin_layout Plain Layout
+Giant (
+\family typewriter
+
+\backslash
+veryHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex More Giant
+status open
+
+\begin_layout Plain Layout
+More Giant (
+\family typewriter
+
+\backslash
+VeryHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Plain Layout
+\begin_inset Flex Most Giant
+status open
+
+\begin_layout Plain Layout
+Most Giant (
+\family typewriter
+
+\backslash
+VERYHuge
+\family default
+)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/SciPoster.xml b/autotests/export/docbook/SciPoster.xml
new file mode 100644
index 0000000..abd919b
--- /dev/null
+++ b/autotests/export/docbook/SciPoster.xml
@@ -0,0 +1,65 @@
+<?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.2">
+<info>
+<title>Poster Title</title>
+<author>
+<personname>Author One and Author Two</personname>
+</author><author>
+<personname>The University, Some address, Postal Code</personname>
+</author><author>
+<personname>author1 at somewhere and author2 at elsewhere</personname>
+</author><author>
+<personname>The Conference</personname>
+</author>
+</info>
+<para>This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract This is my special abstract.This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis. This is the background and our hypothesis.<bibliography>
+<bibliomixed xml:id='key-1'>Author One & Author Two (2010): Our Great Book. Somewhere.</bibliomixed>
+<bibliomixed xml:id='key-2'>Author Two & Author One (2011): Our Even Greater Book. Somewhere.</bibliomixed>
+</bibliography>
+<!-- \columnbreak -->
+<itemizedlist>
+<listitem>
+<para>point one</para>
+</listitem>
+<listitem>
+<para>point two</para>
+</listitem>
+</itemizedlist>
+<itemizedlist>
+<listitem>
+<para>point three</para>
+</listitem>
+<listitem>
+<para>point four</para>
+</listitem>
+</itemizedlist>
+<itemizedlist>
+<listitem>
+<para>Really have to fill in this</para>
+</listitem>
+<listitem>
+<para>Really have to fill in this</para>
+</listitem>
+</itemizedlist>
+<!-- \columnbreak -->
+This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. This is the experiment. <itemizedlist>
+<listitem>
+<para>result</para>
+</listitem>
+<listitem>
+<para>result</para>
+</listitem>
+</itemizedlist>
+<orderedlist>
+<listitem>
+<para>first conclusion</para>
+</listitem>
+<listitem>
+<para>second conclusion</para>
+</listitem>
+</orderedlist>
+</para>
+<para>Tiny (\tiny)Smallest (\scriptsize)Smaller (\footnotesize)Normal (\normalsize)Large (\large)Larger (\Large)Largest (\LARGE)Huge (\huge)Huger (\Huge)Giant (\veryHuge)More Giant (\VeryHuge)Most Giant (\VERYHuge)</para>
+</article>
\ No newline at end of file
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 1e804ee..ee829e5 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -362,8 +362,8 @@ void makeBibliography(
 		ParagraphList::const_iterator const & par)
 {
 	// If this is the first paragraph in a bibliography, open the bibliography tag.
-	auto pbegin_before = text.paragraphs().getParagraphBefore(par);
-	if (pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT) {
+	auto const * pbegin_before = text.paragraphs().getParagraphBefore(par);
+	if (pbegin_before == nullptr || (pbegin_before && pbegin_before->layout().latextype != LATEX_BIB_ENVIRONMENT)) {
 		xs << xml::StartTag("bibliography");
 		xs << xml::CR();
 	}

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

Summary of changes:
 .../export/docbook}/SciPoster.lyx                  |    0
 autotests/export/docbook/SciPoster.xml             |   65 ++++++++++++++++++++
 src/output_docbook.cpp                             |    4 +-
 3 files changed, 67 insertions(+), 2 deletions(-)
 copy {lib/templates/Posters => autotests/export/docbook}/SciPoster.lyx (100%)
 create mode 100644 autotests/export/docbook/SciPoster.xml


hooks/post-receive
-- 
Repository for new features


More information about the lyx-cvs mailing list