commit 30572880baebd4022c7d5e5b7fed89042ebb501f
Author: Thibaut Cuvelier <[email protected]>
Date:   Mon Oct 26 04:19:11 2020 +0100

    DocBook: fix an issue where parts of list in abstract were duplicated.
    
    Excerpt from 
export/latex/lyxbugs-resolved/9633-languagenesting_enumerate_and_lyxcode.
---
 autotests/export/docbook/abstract_list.lyx |  437 ++++++++++++++++++++++++++++
 autotests/export/docbook/abstract_list.xml |   26 ++
 src/output_docbook.cpp                     |   21 ++-
 3 files changed, 482 insertions(+), 2 deletions(-)

diff --git a/autotests/export/docbook/abstract_list.lyx 
b/autotests/export/docbook/abstract_list.lyx
new file mode 100644
index 0000000..4cc706f
--- /dev/null
+++ b/autotests/export/docbook/abstract_list.lyx
@@ -0,0 +1,437 @@
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
+\lyxformat 599
+\begin_document
+\begin_header
+\save_transient_properties true
+\origin unavailable
+\textclass article
+\begin_preamble
+% Präambel nicht verändern!!!
+%
+% Die Präambel stellt sicher, dass das Benutzerhandbuch korrekt
+% in die Formate pdf, ps und dvi exportiert werden kann.
+% Wenn Probleme beim Exportieren auftreten, können Sie sich
+% an das LyX-Dokumentationsteam wenden.
+% EMail: [email protected]
+
+% Setzt den Link für Spruenge zu Gleitabbildungen
+% auf den Anfang des Gelitobjekts und nicht aufs Ende
+\usepackage[figure]{hypcap}
+
+% Die Seiten des Inhaltsverzeichnisses werden römisch numeriert,
+% ein PDF-Lesezeichen für das Inhaltsverzeichnis wird hinzugefügt
+\let\myTOC\tableofcontents
+\renewcommand\tableofcontents{%
+  \frontmatter
+  \pdfbookmark[1]{\contentsname}{}
+  \myTOC
+  \mainmatter }
+
+\@ifpackageloaded{babel}{
+ % Linkfläche für Querverweise vergrößern und automatisch benennen,
+ \AtBeginDocument{\renewcommand{\ref}[1]{\mbox{\autoref{#1}}}}
+ \addto\extrasngerman{%
+  \renewcommand*{\equationautorefname}[1]{}%
+  \renewcommand{\sectionautorefname}{Kap.\negthinspace}%
+  \renewcommand{\subsectionautorefname}{Kap.\negthinspace}%
+  \renewcommand{\subsubsectionautorefname}{Kap.\negthinspace}%
+ }
+}{}
+\end_preamble
+\options 
bibliography=totoc,index=totoc,BCOR7.5mm,titlepage,captions=tableheading
+\use_default_options false
+\begin_modules
+logicalmkup
+\end_modules
+\maintain_unincluded_children no
+\language ngerman
+\language_package default
+\inputencoding utf8
+\fontencoding auto
+\font_roman "lmodern" "FreeSerif"
+\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 default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\float_placement class
+\float_alignment class
+\paperfontsize 12
+\spacing single
+\use_hyperref true
+\pdf_title "LyX-Anpassung: Möglichkeiten für fortgeschrittene Benutzer"
+\pdf_author "LyX Team, deutsche Übersetzung: Peter Sütterlin, Leif Albers und 
Hartmut Haase"
+\pdf_subject "LyX-Dokumentation, Anpassung"
+\pdf_keywords "LyX, Dokumentation"
+\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 0
+\use_package amssymb 0
+\use_package cancel 0
+\use_package esint 0
+\use_package mathdots 0
+\use_package mathtools 0
+\use_package mhchem 0
+\use_package stackrel 0
+\use_package stmaryrd 0
+\use_package undertilde 0
+\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
+\branch OutDated
+\selected 0
+\filename_suffix 0
+\color #faf0e6
+\end_branch
+\index Stichwortverzeichnis
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\is_math_indent 1
+\math_indentation default
+\math_numbering_side default
+\quotes_style german
+\dynamic_quotes 0
+\papercolumns 1
+\papersides 2
+\paperpagestyle headings
+\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
+-Anpassung:
+\begin_inset Newline newline
+\end_inset
+
+Möglichkeiten für fortgeschrittene Benutzer
+\end_layout
+
+\begin_layout Enumerate
+Das Layout für eine flexible Einfügung wird definiert.
+ In diesem Fall muss 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+<Typ>
+\end_layout
+
+\end_inset
+
+ in der Form 
+\lang english
+
+\begin_inset Quotes gld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Flex:<Name>
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes grd
+\end_inset
+
+
+\lang ngerman
+ sein, wobei 
+\lang english
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Name
+\end_layout
+
+\end_inset
+
+
+\lang ngerman
+ ein beliebiger gültiger Bezeichner sein kann, der in keiner anderen 
existierend
+en Einfügung benutzt wird.
+ Der Bezeichner darf Leerzeichen enthalten, dann muss aber der komplette
+ Typ in Anführungszeichen gesetzt werden.
+ Beachten Sie, dass die Definition einer flexiblen Einfügung 
+\emph on
+auch
+\emph default
+ einen 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+LyXType
+\end_layout
+
+\end_inset
+
+-Eintrag enthalten muss, der festlegt welcher Einfügungstyp definiert wird.
+\end_layout
+
+\begin_layout Enumerate
+
+\lang english
+The layout for user specific branch is being defined.
+ In this case, 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+<Typ>
+\end_layout
+
+\end_inset
+
+ must be of the form
+\lang ngerman
+ 
+\begin_inset Quotes gld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Branch:<Name>
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes grd
+\end_inset
+
+, 
+\lang english
+where 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+name
+\end_layout
+
+\end_inset
+
+ may be be any valid identifier of branch defined in user's document.
+ The identifier may include spaces, but in that case the whole thing must
+ be wrapped in quotes.
+ The main purpose of this feature is to allow \SpecialChar LaTeX
+ wrapping around specific
+ branches as user needs.
+\end_layout
+
+\begin_layout Enumerate
+
+\lang english
+The layout of a user (or class) specific caption is being defined.
+ In this case, 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+<Typ>
+\end_layout
+
+\end_inset
+
+ must be of the form
+\lang ngerman
+ 
+\begin_inset Quotes gld
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+Caption:<Name>
+\end_layout
+
+\end_inset
+
+
+\begin_inset Quotes grd
+\end_inset
+
+, 
+\lang english
+where 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+name
+\end_layout
+
+\end_inset
+
+ specifies the name of the caption as it appears in the menu.
+ Have a look at the standard caption (
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+Caption:Standard
+\end_layout
+
+\end_inset
+
+), the specific captions of the KOMA-Script classes (
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+Caption:Above
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+Caption:Below
+\end_layout
+
+\end_inset
+
+) oder das Modul 
+\family sans
+Multilingual
+\begin_inset space ~
+\end_inset
+
+Captions
+\family default
+ (
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+Caption:Bicaption
+\end_layout
+
+\end_inset
+
+) for applications.
+\end_layout
+
+\begin_layout Standard
+Die 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+InsetLayout
+\end_layout
+
+\end_inset
+
+-Definition kann folgende Einträge enthalten:
+\end_layout
+
+\begin_layout Subsection
+
+\lang english
+Paragraph styles
+\end_layout
+
+\begin_layout Standard
+
+\lang english
+The sort of XHTML \SpecialChar LyX
+ outputs for a paragraph depends upon whether we are dealing
+ with a normal paragraph, a command, or an environment, where this is itself
+ determined by the contents of the corresponding 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\lang english
+\SpecialChar LaTeX
+Type
+\end_layout
+
+\end_inset
+
+ tag.
+ 
+\end_layout
+
+\end_body
+\end_document
diff --git a/autotests/export/docbook/abstract_list.xml 
b/autotests/export/docbook/abstract_list.xml
new file mode 100644
index 0000000..03a81d0
--- /dev/null
+++ b/autotests/export/docbook/abstract_list.xml
@@ -0,0 +1,26 @@
+<?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="de_DE" 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>LyX-Anpassung:<emphasis role='size_largest'>Möglichkeiten für 
fortgeschrittene Benutzer</emphasis></title>
+<abstract>
+<orderedlist>
+<listitem>
+<para>Das Layout für eine flexible Einfügung wird definiert. In diesem Fall 
muss <code>&lt;Typ&gt;</code> in der Form 
&#8222;<code>Flex:&lt;Name&gt;</code>&#8220; sein, wobei <code>Name</code> ein 
beliebiger gültiger Bezeichner sein kann, der in keiner anderen existierenden 
Einfügung benutzt wird. Der Bezeichner darf Leerzeichen enthalten, dann muss 
aber der komplette Typ in Anführungszeichen gesetzt werden. Beachten Sie, dass 
die Definition einer flexiblen Einfügung <emphasis>auch</emphasis> einen 
<code>LyXType</code>-Eintrag enthalten muss, der festlegt welcher Einfügungstyp 
definiert wird.</para>
+</listitem>
+<listitem>
+<para>The layout for user specific branch is being defined. In this case, 
<code>&lt;Typ&gt;</code> must be of the form 
&#8222;<code>Branch:&lt;Name&gt;</code>&#8220;, where <code>name</code> may be 
be any valid identifier of branch defined in user's document. The identifier 
may include spaces, but in that case the whole thing must be wrapped in quotes. 
The main purpose of this feature is to allow LaTeX wrapping around specific 
branches as user needs.</para>
+</listitem>
+<listitem>
+<para>The layout of a user (or class) specific caption is being defined. In 
this case, <code>&lt;Typ&gt;</code> must be of the form 
&#8222;<code>Caption:&lt;Name&gt;</code>&#8220;, where <code>name</code> 
specifies the name of the caption as it appears in the menu. Have a look at the 
standard caption (<code>Caption:Standard</code>), the specific captions of the 
KOMA-Script classes (<code>Caption:Above</code>, <code>Caption:Below</code>) 
oder das Modul <emphasis role='sans'>Multilingual&#xA0;Captions</emphasis> 
(<code>Caption:Bicaption</code>) for applications.</para>
+</listitem>
+</orderedlist>
+<para>Die <code>InsetLayout</code>-Definition kann folgende Einträge 
enthalten:</para>
+</abstract>
+</info>
+<section>
+<title>Paragraph styles</title>
+<para>The sort of XHTML LyX outputs for a paragraph depends upon whether we 
are dealing with a normal paragraph, a command, or an environment, where this 
is itself determined by the contents of the corresponding 
<code>LaTeXType</code> tag. </para>
+</section>
+</article>
\ No newline at end of file
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index a0316ba..5b30336 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -909,10 +909,27 @@ void outputDocBookInfo(
        docstring abstract;
        if (hasAbstract) {
                // Generate the abstract XML into a string before further 
checks.
+               // Usually, makeAny only generates one paragraph at a time. 
However, for the specific case of lists, it might
+               // generate more than one paragraph, as indicated in the return 
value.
                odocstringstream os2;
                XMLStream xs2(os2);
-               for (auto const & p : info.abstract)
-                       makeAny(text, buf, xs2, runparams, 
paragraphs.iterator_at(p));
+
+               set<pit_type> doneParas;
+               for (auto const & p : info.abstract) {
+                       if (doneParas.find(p) == doneParas.end()) {
+                               auto oldPar = paragraphs.iterator_at(p);
+                               auto newPar = makeAny(text, buf, xs2, 
runparams, oldPar);
+
+                               // Insert the indices of all the paragraphs 
that were just generated (typically, one).
+                               // **Make the hypothesis that, when an abstract 
has a list, all its items are consecutive.**
+                               pit_type id = p;
+                               while (oldPar != newPar) {
+                                       doneParas.emplace(id);
+                                       ++oldPar;
+                                       ++id;
+                               }
+                       }
+               }
 
                // Actually output the abstract if there is something to do. 
Don't count line feeds or spaces in this,
                // even though they must be properly output if there is some 
abstract.
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to