[LyX/master] DocBook: add a layout tag to tell whether an item is the abstract or not.

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


commit dab71087cf2954b77d3d2c0e67b868f9be82fba9
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 3 16:04:26 2020 +0200

    DocBook: add a layout tag to tell whether an item is the abstract or not.
---
 .../docbook/bibliography_precooked_aastex.xml      |  221 ++++++++---------
 lib/layouts/aastex.layout                          |    3 -
 lib/layouts/stdstruct.inc                          |    3 +-
 lib/scripts/layout2layout.py                       |    2 +-
 src/Layout.cpp                                     |    8 +
 src/Layout.h                                       |    9 +-
 src/output_docbook.cpp                             |  265 ++++++++++++--------
 7 files changed, 281 insertions(+), 230 deletions(-)

diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index e15bfdd..fe77b72 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -3,8 +3,8 @@
   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>Collapsed Cores in Globular Clusters,  Gauge-Boson Couplings, and AASTeX Examples</title>
-<author><personname>S. Djorgovski and Ivan R. King</personname>
+<!-- shouldBeInInfo --><title>Collapsed Cores in Globular Clusters,  Gauge-Boson Couplings, and AASTeX Examples</title>
+<!-- mustBeInInfo --><author><personname>S. Djorgovski and Ivan R. King</personname>
 <affiliation><orgname>Astronomy Department, University of California, Berkeley, CA 94720</orgname></affiliation>
 <affiliation role="alternate"><orgname>Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</orgname></affiliation>
 <affiliation role="alternate"><orgname>Society of Fellows, Harvard University.</orgname></affiliation>
@@ -17,16 +17,11 @@
 <author><personname>R. J. Hanisch</personname>
 <affiliation><orgname>Space Telescope Science Institute, Baltimore, MD 21218</orgname></affiliation>
 <affiliation role="alternate"><orgname>Patron, Alonso's Bar and Grill</orgname></affiliation></author>
-<abstract><para>
-<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
-<!-- Output Error: Tried to close `keyword' when tag was not open. Tag discarded. -->
-<!-- Output Error: Tried to close `keywordset' when tag was not open. Tag discarded. -->
-
 <keywordset><keyword>clusters: globular, peanut—bosons: bozos</keyword></keywordset>
-<!-- Output Error: Closing tag `info' when other tags are open, namely: -->
-<!-- Output Error: para -->
-</para><!-- Output Error: abstract -->
-</abstract></info>
+<!-- /info --><!-- abs --><abstract><para>
+<para>This is a preliminary report on surface photometry of the major fraction of known globular clusters, to see which of them show the signs of a collapsed core. We also explore some diversionary mathematics and recreational tables. </para>
+</para></abstract>
+<!-- 15 --><!-- /abs --></info>
 <section>
 <title>Introduction</title>
 <para>A focal problem today in the dynamics of globular clusters is core collapse. It has been predicted by theory for decades <biblioref endterm="hen61" />, <biblioref endterm="lyn68" />, <biblioref endterm="spi85" />, but observation has been less alert to the phenomenon. For many years the central brightness peak in M15 <biblioref endterm="kin75" />, <biblioref endterm="new78" /> seemed a unique anomaly. Then <biblioref endterm="aur82" /> suggested a central peak in NGC 6397, and a limited photographic survey of ours <biblioref endterm="djo84" /> found three more cases, including NGC 6624, whose sharp center had often been remarked on <biblioref endterm="can78" />. </para>
@@ -112,7 +107,7 @@
 </section>
 <section>
 <title>Helicity Amplitudes</title>
-<para>It has been realized that helicity amplitudes provide a convenient means for Feynman diagram<footnote><para>Footnotes can be inserted like this.</para>
+<para>It has been realized that helicity amplitudes provide a convenient means for Feynman diagram<footnote><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><para>Footnotes can be inserted like this.</para>
 </footnote> evaluations. These amplitude-level techniques are particularly convenient for calculations involving many Feynman diagrams, where the usual trace techniques for the amplitude squared becomes unwieldy. Our calculations use the helicity techniques developed by other authors <biblioref endterm="hag86" />; we briefly summarize below.</para>
 <section>
 <title>Formalism</title>
@@ -694,8 +689,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mtable>
  </m:math>
 </informalequation>
-<!-- Output Error: Tried to close `title' when tag was not open. Tag discarded. -->
-
+</MathLetters>
 </section>
 </section>
 <section>
@@ -957,7 +951,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
   </m:msub>
  </m:mrow>
  </m:math>
-</inlineequation>, but the assumption is that the alternate results should be less than 90° out of phase with previous values. We have no observations of <!-- \ion{Ca}{2} -->. Roughly <inlineequation>
+</inlineequation>, but the assumption is that the alternate results should be less than 90° out of phase with previous values. We have no observations of <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \ion{Ca}{2} -->. Roughly <inlineequation>
 <alt role='tex'>\nicefrac{4}{5}</alt>
  <m:math>
  
@@ -971,14 +965,13 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation> of the electronically submitted abstracts for AAS meetings are error-free. </para>
-<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section&#xA0;<xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex">http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
+<acknowledgement><para>We are grateful to V. Barger, T. Han, and R. J. N. Phillips for doing the math in section&#xA0;<xref linkend="bozomath" />. More information on the AASTeX macros package are available at <link xlink:href="http://www.aas.org/publications/aastex"><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->http://www.aas.org/publications/aastex</link> or the <link xlink:href="ftp://www.aas.org/pubs/AAS ftp site">AAS ftp site</link>.</para>
 <application>IRAF, AIPS, Astropy, ...</application><!-- Output Error: Tried to close `para' when tag was not open. Tag discarded. -->
 
-<Appendix></Appendix>
 <bibliography>
 <bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>
 <bibliomixed xml:id='can78'>Canizares, C. R., Grindlay, J. E., Hiltner, W. A., Liller, W., and McClintock, J. E. 1978, <!-- \apj -->, 224, 39 </bibliomixed>
-<bibliomixed xml:id='djo84'>Djorgovski, S., and King, I. R. 1984, <!-- \apjl -->, 277, L49 </bibliomixed>
+<bibliomixed xml:id='djo84'>Djorgovski, S., and King, I. R. 1984, <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \apjl -->, 277, L49 </bibliomixed>
 <bibliomixed xml:id='hag86'>Hagiwara, K., and Zeppenfeld, D. 1986, Nucl.Phys., 274, 1 </bibliomixed>
 <bibliomixed xml:id='har84'>Harris, W. E., and van den Bergh, S. 1984, <!-- \aj -->, 89, 1816 </bibliomixed>
 <bibliomixed xml:id='hen61'>Hénon, M. 1961, Ann.d'Ap., 24, 369 </bibliomixed>
@@ -986,19 +979,19 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
 <bibliomixed xml:id='kin75'>King, I. R. 1975, Dynamics of Stellar Systems, A. Hayli, Dordrecht: Reidel, 1975, 99 </bibliomixed>
 <bibliomixed xml:id='kin68'>King, I. R., Hedemann, E., Hodge, S. M., and White, R. E. 1968, <!-- \aj -->, 73, 456 </bibliomixed>
 <bibliomixed xml:id='kro84'>Kron, G. E., Hewitt, A. V., and Wasserman, L. H. 1984, <!-- \pasp -->, 96, 198 </bibliomixed>
-<bibliomixed xml:id='lyn68'>Lynden-Bell, D., and Wood, R. 1968, <!-- \mnras -->, 138, 495 </bibliomixed>
+<bibliomixed xml:id='lyn68'>Lynden-Bell, D., and Wood, R. 1968, <!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \mnras -->, 138, 495 </bibliomixed>
 <bibliomixed xml:id='new78'>Newell, E. B., and O'Neil, E. J. 1978, <!-- \apjs -->, 37, 27 </bibliomixed>
 <bibliomixed xml:id='ort85'>Ortolani, S., Rosino, L., and Sandage, A. 1985, <!-- \aj -->, 90, 473 </bibliomixed>
 <bibliomixed xml:id='pet76'>Peterson, C. J. 1976, <!-- \aj -->, 81, 617 </bibliomixed>
 <bibliomixed xml:id='spi85'>Spitzer, L. 1985, Dynamics of Star Clusters, J. Goodman and P. Hut, Dordrecht: Reidel, 109 </bibliomixed>
 </bibliography>
 <table xml:id="tbl-2">
-<caption>Terribly relevant tabular information.</caption>
-<tbody>
+<caption><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Terribly relevant tabular information.</caption>
+<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><tbody>
 <tr>
-<td align='center' valign='top'>Star </td>
-<td align='right' valign='top'> Height </td>
-<td align='right' valign='top'> <inlineequation>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Star </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> Height </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>d_{x}</alt>
  <m:math>
  
@@ -1012,7 +1005,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>d_{y}</alt>
  <m:math>
  
@@ -1026,7 +1019,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>n</alt>
  <m:math>
  
@@ -1034,7 +1027,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>\chi^{2}</alt>
  <m:math>
  
@@ -1048,7 +1041,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>R_{maj}</alt>
  <m:math>
  
@@ -1064,7 +1057,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>R_{min}</alt>
  <m:math>
  
@@ -1080,15 +1073,15 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='center' valign='top' colspan='1'><inlineequation>
+<td align='center' valign='top' colspan='1'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><inlineequation>
 <alt role='tex'>P</alt>
  <m:math>
  
  <m:mrow><m:mi>P</m:mi>
  </m:mrow>
  </m:math>
-</inlineequation>a</td>
-<td align='right' valign='top'> <inlineequation>
+</inlineequation><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->a</td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>PR_{maj}</alt>
  <m:math>
  
@@ -1106,7 +1099,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='right' valign='top'> <inlineequation>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> <inlineequation>
 <alt role='tex'>PR_{min}</alt>
  <m:math>
  
@@ -1124,105 +1117,105 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </m:mrow>
  </m:math>
 </inlineequation></td>
-<td align='center' valign='top' colspan='1'><inlineequation>
+<td align='center' valign='top' colspan='1'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><inlineequation>
 <alt role='tex'>\Theta</alt>
  <m:math>
  
  <m:mrow><m:mo>&#x398;</m:mo>
  </m:mrow>
  </m:math>
-</inlineequation>b</td>
-<td align='center' valign='top'>Ref.</td>
+</inlineequation><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->b</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->Ref.</td>
 </tr>
 <tr>
-<td align='center' valign='top'><!-- \tableline\tableline -->1 </td>
-<td align='right' valign='top'>33472.5 </td>
-<td align='right' valign='top'>-0.1 </td>
-<td align='right' valign='top'>0.4 </td>
-<td align='right' valign='top'>53 </td>
-<td align='right' valign='top'>27.4 </td>
-<td align='right' valign='top'>2.065 </td>
-<td align='right' valign='top'>1.940 </td>
-<td align='right' valign='top'>3.900 </td>
-<td align='right' valign='top'>68.3 </td>
-<td align='right' valign='top'>116.2 </td>
-<td align='right' valign='top'>-27.639</td>
-<td align='center' valign='top'>1,2</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --><!-- \tableline\tableline -->1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->33472.5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->53 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->27.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.065 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.940 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.900 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->68.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->116.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-27.639</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1,2</td>
 </tr>
 <tr>
-<td align='center' valign='top'> 2 </td>
-<td align='right' valign='top'>27802.4 </td>
-<td align='right' valign='top'>-0.3 </td>
-<td align='right' valign='top'>-0.2 </td>
-<td align='right' valign='top'>60 </td>
-<td align='right' valign='top'>3.7 </td>
-<td align='right' valign='top'>1.628 </td>
-<td align='right' valign='top'>1.510 </td>
-<td align='right' valign='top'>2.156 </td>
-<td align='right' valign='top'>6.8 </td>
-<td align='right' valign='top'>7.5 </td>
-<td align='right' valign='top'>-26.764</td>
-<td align='center' valign='top'>3</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->27802.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.7 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.628 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.510 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.156 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->6.8 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-26.764</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3</td>
 </tr>
 <tr>
-<td align='center' valign='top'> 3 </td>
-<td align='right' valign='top'>29210.6 </td>
-<td align='right' valign='top'>0.9 </td>
-<td align='right' valign='top'>0.3 </td>
-<td align='right' valign='top'>60 </td>
-<td align='right' valign='top'>3.4 </td>
-<td align='right' valign='top'>1.622 </td>
-<td align='right' valign='top'>1.551 </td>
-<td align='right' valign='top'>2.159 </td>
-<td align='right' valign='top'>6.7 </td>
-<td align='right' valign='top'>7.3 </td>
-<td align='right' valign='top'>-40.272</td>
-<td align='center' valign='top'>4</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->29210.6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.9 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.622 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.551 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.159 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->6.7 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-40.272</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->4</td>
 </tr>
 <tr>
-<td align='center' valign='top'> 4 </td>
-<td align='right' valign='top'>32733.8 </td>
-<td align='right' valign='top'>-1.2c</td>
-<td align='right' valign='top'>-0.5 </td>
-<td align='right' valign='top'>41 </td>
-<td align='right' valign='top'>54.8 </td>
-<td align='right' valign='top'>2.282 </td>
-<td align='right' valign='top'>2.156 </td>
-<td align='right' valign='top'>4.313 </td>
-<td align='right' valign='top'>117.4 </td>
-<td align='right' valign='top'>78.2 </td>
-<td align='right' valign='top'>-35.847</td>
-<td align='center' valign='top'>5,6</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->32733.8 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-1.2<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->c</td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->41 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->54.8 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.282 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.156 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->4.313 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->117.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->78.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-35.847</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->5,6</td>
 </tr>
 <tr>
-<td align='center' valign='top'> 5 </td>
-<td align='right' valign='top'> 9607.4 </td>
-<td align='right' valign='top'>-0.4 </td>
-<td align='right' valign='top'>-0.4 </td>
-<td align='right' valign='top'>60 </td>
-<td align='right' valign='top'>1.4 </td>
-<td align='right' valign='top'>1.669c</td>
-<td align='right' valign='top'>1.574 </td>
-<td align='right' valign='top'>2.343 </td>
-<td align='right' valign='top'>8.0 </td>
-<td align='right' valign='top'>8.9 </td>
-<td align='right' valign='top'>-33.417</td>
-<td align='center' valign='top'>7</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 5 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 9607.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-0.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->60 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.4 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.669<!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->c</td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.574 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->2.343 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8.0 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8.9 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-33.417</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7</td>
 </tr>
 <tr>
-<td align='center' valign='top'> 6 </td>
-<td align='right' valign='top'>31638.6 </td>
-<td align='right' valign='top'>1.6 </td>
-<td align='right' valign='top'>0.1 </td>
-<td align='right' valign='top'>39 </td>
-<td align='right' valign='top'>315.2 </td>
-<td align='right' valign='top'> 3.433 </td>
-<td align='right' valign='top'>3.075 </td>
-<td align='right' valign='top'>7.488 </td>
-<td align='right' valign='top'>92.1 </td>
-<td align='right' valign='top'>25.3 </td>
-<td align='right' valign='top'>-12.052 </td>
-<td align='center' valign='top'>8</td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->31638.6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->1.6 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->0.1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->39 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->315.2 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info --> 3.433 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->3.075 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->7.488 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->92.1 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->25.3 </td>
+<td align='right' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->-12.052 </td>
+<td align='center' valign='top'><!-- shouldBeInInfo --><!-- mustBeInInfo --><!-- /info -->8</td>
 </tr>
 </tbody>
 <Table note>a<!-- }{ -->Sample footnote for table&#xA0;<xref linkend="tbl-2" /> that was generated with the LaTeX table environment</Table note>
diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout
index 97c8b64..74d2ab6 100644
--- a/lib/layouts/aastex.layout
+++ b/lib/layouts/aastex.layout
@@ -282,9 +282,6 @@ Style Abstract
 	  Series	Bold
 	  Size		Normal
 	EndFont
-	DocBookTag            abstract
-	DocBookItemTag        para
-	DocBookInInfo         always
 End
 
 
diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc
index 83d46e9..b02499f 100644
--- a/lib/layouts/stdstruct.inc
+++ b/lib/layouts/stdstruct.inc
@@ -49,9 +49,10 @@ Style Abstract
 			font-weight: bold;
 		}
 	EndHTMLStyle
+	DocBookAbstract       true
+	DocBookInInfo         always
 	DocBookTag            abstract
 	DocBookItemTag        para
-	DocBookInInfo         always
 End
 
 
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index e69deba..2bb62e3 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -282,7 +282,7 @@ currentFormat = 83
 # - Removed tag Element for flex insets
 
 # Incremented to format 83, 2 August 2020 by dourouc05
-# New tag DocBookWrapperMergeWithPrevious
+# New tags DocBookWrapperMergeWithPrevious and DocBookAbstract
 
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
diff --git a/src/Layout.cpp b/src/Layout.cpp
index eeb58d0..5047506 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -107,6 +107,7 @@ enum LayoutTags {
 	LT_DOCBOOKTAG,
 	LT_DOCBOOKATTR,
 	LT_DOCBOOKININFO,
+	LT_DOCBOOKABSTRACT,
 	LT_DOCBOOKWRAPPERTAG,
 	LT_DOCBOOKWRAPPERATTR,
 	LT_DOCBOOKWRAPPERMERGEWITHPREVIOUS,
@@ -177,6 +178,7 @@ Layout::Layout()
 	htmllabelfirst_ = false;
 	htmlforcecss_ = false;
 	htmltitle_ = false;
+	docbookabstract_ = false;
 	docbookwrappermergewithprevious_ = false;
 	spellcheck = true;
 	forcelocal = 0;
@@ -221,6 +223,7 @@ 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 },
@@ -738,6 +741,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
 			lex >> docbookininfo_;
 			break;
 
+		case LT_DOCBOOKABSTRACT:
+			lex >> docbookabstract_;
+			break;
+
 		case LT_DOCBOOKWRAPPERTAG:
 			lex >> docbookwrappertag_;
 			break;
@@ -1603,6 +1610,7 @@ void Layout::write(ostream & os) const
 		os << "\tDocBookAttr " << docbookattr_ << '\n';
 	if(!docbookininfo_.empty())
 		os << "\tDocBookInInfo " << docbookininfo_ << '\n';
+	os << "\tDocBookAbstract " << docbookabstract_ << '\n';
 	if(!docbookwrappertag_.empty())
 		os << "\tDocBookWrapperTag " << docbookwrappertag_ << '\n';
 	if(!docbookwrapperattr_.empty())
diff --git a/src/Layout.h b/src/Layout.h
index d9eb893..a894142 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -199,6 +199,8 @@ public:
 	///
 	std::string const & docbookininfo() const;
 	///
+	bool docbookabstract() const { return docbookabstract_; }
+	///
 	std::string const & docbookwrappertag() const;
 	///
 	std::string const & docbookwrapperattr() const;
@@ -516,11 +518,14 @@ private:
 	mutable std::string docbookwrapperattr_;
 	/// 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 (default: section).
+	/// Outer tag for this section, only if this layout represent a sectionning item, including chapters
+	/// (default: section).
 	mutable std::string docbooksectiontag_;
 	/// Whether this tag must/can/can't go into an <info> tag (default: never, as it only makes sense for metadata).
 	mutable std::string docbookininfo_;
-	/// whether this element (root or not) does not accept text without a section(i.e. the first text that is met
+	/// Wehther this paragraph should be considered as abstract.
+	bool docbookabstract_;
+	/// Whether this element (root or not) does not accept text without a section (i.e. the first text that is met
 	/// in LyX must be considered as the abstract if this is true); this text must be output with the specific tag
 	/// held by this attribute
 	mutable std::string docbookforceabstracttag_;
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index fd38940..4430041 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -219,7 +219,8 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
 	if (tag == "Plain Layout")
 		tag = "para";
 
-	xs << xml::ParTag(tag, lay.docbookattr());
+	if (!xs.isTagOpen(xml::ParTag(tag, lay.docbookattr()), 1)) // Don't nest a paragraph directly in a paragraph.
+		xs << xml::ParTag(tag, lay.docbookattr());
 
 	if (lay.docbookitemtag() != "NONE")
 		xs << xml::StartTag(lay.docbookitemtag(), lay.docbookitemattr());
@@ -554,30 +555,38 @@ ParagraphList::const_iterator makeEnvironment(
 	ParagraphList::const_iterator par = pbegin;
 	depth_type const origdepth = pbegin->params().depth();
 
-	// Find the previous paragraph.
-	auto prevpar = begin;
-	if (prevpar != par) {
-		auto prevpar_next = prevpar;
-		++prevpar_next;
-
-		while (prevpar_next != par) {
+	// Output the opening tag for this environment.
+	{
+		// Find the previous paragraph.
+		auto prevpar = begin;
+		if (prevpar != par) {
+			auto prevpar_next = prevpar;
 			++prevpar_next;
-			++prevpar;
+
+			while (prevpar_next != par) {
+				++prevpar_next;
+				++prevpar;
+			}
 		}
-	}
 
-	// open tag for this environment
-	openParTag(xs, &*par, &*prevpar);
-	xs << xml::CR();
+		// Open tag for this environment.
+		openParTag(xs, &*par, &*prevpar);
+		xs << xml::CR();
+	}
 
 	// we will on occasion need to remember a layout from before.
 	Layout const *lastlay = nullptr;
+	auto prevpar = par;
 
 	while (par != pend) {
 		Layout const & style = par->layout();
 		ParagraphList::const_iterator send;
 
+		auto parnext = par;
+		++parnext;
+
 		// Actual content of this paragraph.
+		prevpar = par;
 		switch (style.latextype) {
 		case LATEX_ENVIRONMENT:
 		case LATEX_LIST_ENVIRONMENT:
@@ -701,15 +710,15 @@ ParagraphList::const_iterator makeEnvironment(
 			break;
 		}
 		case LATEX_PARAGRAPH:
-			send = findLast(par, pend, LATEX_PARAGRAPH);
-			par = makeParagraphs(buf, xs, runparams, text, par, send);
+//			send = findLast(par, pend, LATEX_PARAGRAPH);
+			par = makeParagraphs(buf, xs, runparams, text, par, parnext);
 			break;
 		case LATEX_BIB_ENVIRONMENT:
-			send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
-			par = makeParagraphBibliography(buf, xs, runparams, text, par, send);
+//			send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
+			makeParagraphBibliography(buf, xs, runparams, text, par, parnext);
 			break;
 		case LATEX_COMMAND:
-			++par;
+			par = parnext;
 			break;
 		}
 	}
@@ -721,9 +730,10 @@ ParagraphList::const_iterator makeEnvironment(
 			xs << xml::CR();
 		}
 	}
-	auto nextpar = par;
-	++nextpar;
-	closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
+//	auto nextpar = par;
+//	++nextpar;
+	closeTag(xs, &*prevpar, &*par);
+//	closeTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr);
 	xs << xml::CR();
 	return pend;
 }
@@ -773,43 +783,80 @@ pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
 		ParagraphList::const_iterator send,
 		ParagraphList::const_iterator pend)
 {
-	Layout const & style = par->layout();
-
-	switch (style.latextype) {
-		case LATEX_COMMAND: {
-			// The files with which we are working never have more than
-			// one paragraph in a command structure.
-			// FIXME
-			// if (ourparams.docbook_in_par)
-			//   fix it so we don't get sections inside standard, e.g.
-			// note that we may then need to make runparams not const, so we
-			// can communicate that back.
-			// FIXME Maybe this fix should be in the routines themselves, in case
-			// they are called from elsewhere.
-			makeCommand(buf, xs, ourparams, text, par);
-			++par;
-			break;
-		}
-		case LATEX_ENVIRONMENT:
-		case LATEX_LIST_ENVIRONMENT:
-		case LATEX_ITEM_ENVIRONMENT:
-			// FIXME Same fix here.
-			send = findEndOfEnvironment(par, pend);
-			par = makeEnvironment(buf, xs, ourparams, text, par, send);
-			break;
-		case LATEX_PARAGRAPH:
-			send = findLast(par, pend, LATEX_PARAGRAPH);
-			par = makeParagraphs(buf, xs, ourparams, text, par, send);
-			break;
-		case LATEX_BIB_ENVIRONMENT:
-			send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
-			par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
-			break;
+	switch (par->layout().latextype) {
+	case LATEX_COMMAND: {
+		// The files with which we are working never have more than
+		// one paragraph in a command structure.
+		// FIXME
+		// if (ourparams.docbook_in_par)
+		//   fix it so we don't get sections inside standard, e.g.
+		// note that we may then need to make runparams not const, so we
+		// can communicate that back.
+		// FIXME Maybe this fix should be in the routines themselves, in case
+		// they are called from elsewhere.
+		makeCommand(buf, xs, ourparams, text, par);
+		++par;
+		break;
+	}
+	case LATEX_ENVIRONMENT:
+	case LATEX_LIST_ENVIRONMENT:
+	case LATEX_ITEM_ENVIRONMENT:
+		// FIXME Same fix here.
+		send = findEndOfEnvironment(par, pend);
+		par = makeEnvironment(buf, xs, ourparams, text, par, send);
+		break;
+	case LATEX_PARAGRAPH:
+		send = findLast(par, pend, LATEX_PARAGRAPH);
+		par = makeParagraphs(buf, xs, ourparams, text, par, send);
+		break;
+	case LATEX_BIB_ENVIRONMENT:
+		send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
+		par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
+		break;
 	}
 
 	return make_pair(par, send);
 }
 
+ParagraphList::const_iterator makeAnySimple(
+		Text const &text,
+		Buffer const &buf,
+		XMLStream &xs,
+		OutputParams const &ourparams,
+		ParagraphList::const_iterator par)
+{
+	auto parnext = par;
+	++parnext;
+
+	switch (par->layout().latextype) {
+	case LATEX_COMMAND: {
+		// The files with which we are working never have more than
+		// one paragraph in a command structure.
+		// FIXME
+		// if (ourparams.docbook_in_par)
+		//   fix it so we don't get sections inside standard, e.g.
+		// note that we may then need to make runparams not const, so we
+		// can communicate that back.
+		// FIXME Maybe this fix should be in the routines themselves, in case
+		// they are called from elsewhere.
+		makeCommand(buf, xs, ourparams, text, par);
+		return parnext;
+	}
+	case LATEX_ENVIRONMENT:
+	case LATEX_LIST_ENVIRONMENT:
+	case LATEX_ITEM_ENVIRONMENT:
+		// FIXME Same fix here.
+		return makeEnvironment(buf, xs, ourparams, text, par, parnext);
+	case LATEX_PARAGRAPH:
+		return makeParagraphs(buf, xs, ourparams, text, par, parnext);
+	case LATEX_BIB_ENVIRONMENT:
+		return makeParagraphBibliography(buf, xs, ourparams, text, par, parnext);
+	}
+
+	// This should never happen. Return the next paragraph to avoid an infinite loop.
+	return parnext;
+}
+
 } // end anonymous namespace
 
 
@@ -883,7 +930,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs, pit_type b
 			continue;
 		}
 
-		if (par.layout().name() == from_ascii("Abstract"))
+		if (par.layout().docbookabstract())
 			hasAbstractLayout = true;
 
 		// Based on layout information, store this paragraph in one set: should be in <info>, must be.
@@ -908,7 +955,7 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs, pit_type b
 	if (hasAbstractLayout) {
 		pit_type pit = bpit;
 		while (pit < cpit) { // Don't overshoot the <info> part.
-			if (paragraphs[pit].layout().name() == from_ascii("Abstract"))
+			if (paragraphs[pit].layout().docbookabstract())
 				abstract.emplace(pit);
 			pit++;
 		}
@@ -953,17 +1000,22 @@ pit_type generateDocBookParagraphWithoutSectioning(
 		XMLStream & xs,
 		OutputParams const & runparams,
 		ParagraphList const & paragraphs,
-		pit_type bpit,
-		pit_type epit)
+		DocBookInfoTag const & info)
 {
+	auto bpit = info.bpit;
 	auto par = paragraphs.iterator_at(bpit);
 	auto lastStartedPar = par;
 	ParagraphList::const_iterator send;
 	auto const pend =
-			(epit == (int) paragraphs.size()) ?
-			paragraphs.end() : paragraphs.iterator_at(epit);
+			(info.epit == (int) paragraphs.size()) ?
+			paragraphs.end() : paragraphs.iterator_at(info.epit);
+
+	while (bpit < info.epit) {
+		if (info.abstract.find(bpit) != info.abstract.end()) {
+			bpit += 1;
+			continue;
+		}
 
-	while (bpit < epit) {
 		tie(par, send) = makeAny(text, buf, xs, runparams, par, send, pend);
 		bpit += distance(lastStartedPar, par);
 		lastStartedPar = par;
@@ -988,18 +1040,25 @@ void outputDocBookInfo(
 	bool hasAbstract = !info.abstract.empty();
 	docstring abstract;
 	if (hasAbstract) {
-		pit_type bpitAbstract = *std::min_element(info.abstract.begin(), info.abstract.end());
-		pit_type epitAbstract = *std::max_element(info.abstract.begin(), info.abstract.end());
-
 		odocstringstream os2;
-		XMLStream xs2(os2);
-		generateDocBookParagraphWithoutSectioning(text, buf, xs2, runparams, paragraphs, bpitAbstract, epitAbstract);
+		{
+			XMLStream xs2(os2);
+			auto bpit = *std::min_element(info.abstract.begin(), info.abstract.end());
+			auto epit = 1 + *std::max_element(info.abstract.begin(), info.abstract.end());
+			// info.abstract is inclusive, epit is exclusive, hence +1 for looping.
+
+			while (bpit < epit) {
+				makeAnySimple(text, buf, xs2, runparams, paragraphs.iterator_at(bpit));
+				xs2 << XMLStream::ESCAPE_NONE << from_ascii("<!-- " + to_string(bpit) + " -->");
+				bpit += 1;
+			}
+		}
 
 		// 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.
-		docstring abstractContent = os2.str();
+		abstract = os2.str();
 		static const lyx::regex reg("[ \\r\\n]*");
-		abstractContent = from_utf8(lyx::regex_replace(to_utf8(abstractContent), reg, string("")));
+		docstring abstractContent = from_utf8(lyx::regex_replace(to_utf8(abstract), reg, string("")));
 
 		// Nothing? Then there is no abstract!
 		if (abstractContent.empty())
@@ -1016,19 +1075,29 @@ void outputDocBookInfo(
 		xs << xml::CR();
 	}
 
-	// Output the elements that should go in <info>.
-	generateDocBookParagraphWithoutSectioning(text, buf, xs, runparams, paragraphs, info.bpit, info.epit);
+	// Output the elements that should go in <info>, before and after the abstract.
+	xs << XMLStream::ESCAPE_NONE << "<!-- shouldBeInInfo -->";
+	for (auto pit : info.shouldBeInInfo) // Typically, the title: these elements are so important and ubiquitous
+		// that mandating a wrapper like <info> would repel users.
+		makeAnySimple(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+	xs << XMLStream::ESCAPE_NONE << "<!-- mustBeInInfo -->";
+	for (auto pit : info.mustBeInInfo)
+		if (info.abstract.find(pit) == info.abstract.end()) // The abstract must be in info, but is dealt with after.
+			makeAnySimple(text, buf, xs, runparams, paragraphs.iterator_at(pit));
+	xs << XMLStream::ESCAPE_NONE << "<!-- /info -->";
 
-	if (hasAbstract && !abstract.empty()) { // The second test is probably superfluous.
-		string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
-		if (tag == "NONE")
-			tag = "abstract";
-
-		xs << xml::StartTag(tag);
-		xs << xml::CR();
+	if (hasAbstract) {
+//		string tag = paragraphs[*info.abstract.begin()].layout().docbookforceabstracttag();
+//		if (tag == "NONE")
+//			tag = "abstract";
+//
+//		xs << xml::StartTag(tag);
+//		xs << xml::CR();
+		xs << XMLStream::ESCAPE_NONE << "<!-- abs -->";
 		xs << XMLStream::ESCAPE_NONE << abstract;
-		xs << xml::EndTag(tag);
-		xs << xml::CR();
+		xs << XMLStream::ESCAPE_NONE << "<!-- /abs -->";
+//		xs << xml::EndTag(tag);
+//		xs << xml::CR();
 	}
 
 	// End the <info> tag if it was started.
@@ -1057,23 +1126,14 @@ void docbookFirstParagraphs(
 }
 
 
-bool isParagraphEmpty(const Paragraph &par)
-{
-	InsetList const &insets = par.insetList();
-	size_t insetsLength = distance(insets.begin(), insets.end());
-	bool hasParagraphOnlyNote = insetsLength == 1 && insets.get(0) && insets.get(0)->asInsetCollapsible() &&
-								dynamic_cast<InsetNote *>(insets.get(0));
-	return hasParagraphOnlyNote;
-}
-
-
 void docbookSimpleAllParagraphs(
 		Text const & text,
 		Buffer const & buf,
 		XMLStream & xs,
 		OutputParams const & runparams)
 {
-	// Handle the document, supposing it has no sections (i.e. a "simple" document).
+	// Handle the given text, supposing it has no sections (i.e. a "simple" text). The input may vary in length
+	// between a single paragraph to a whole document.
 
 	// First, the <info> tag.
 	ParagraphList const &paragraphs = text.paragraphs();
@@ -1081,27 +1141,14 @@ void docbookSimpleAllParagraphs(
 	pit_type const epit = runparams.par_end;
 	DocBookInfoTag info = getParagraphsWithInfo(paragraphs, bpit, epit);
 	outputDocBookInfo(text, buf, xs, runparams, paragraphs, info);
-	bpit = info.bpit;
-
-	// Then, the content.
-	ParagraphList::const_iterator const pend =
-			(epit == (int) paragraphs.size()) ?
-			paragraphs.end() : paragraphs.iterator_at(epit);
 
+	// Then, the content. It starts where the <info> ends.
+	bpit = info.epit;
 	while (bpit < epit) {
 		auto par = paragraphs.iterator_at(bpit);
-		ParagraphList::const_iterator const lastStartedPar = par;
-		ParagraphList::const_iterator send;
-
-		if (isParagraphEmpty(*par)) {
-			++par;
-			bpit += distance(lastStartedPar, par);
-			continue;
-		}
-
-		// Generate this paragraph.
-		tie(par, send) = makeAny(text, buf, xs, runparams, par, send, pend);
-		bpit += distance(lastStartedPar, par);
+		if (!hasOnlyNotes(*par))
+			makeAnySimple(text, buf, xs, runparams, par);
+		bpit += 1;
 	}
 }
 
@@ -1155,7 +1202,7 @@ void docbookParagraphs(Text const &text,
 		ParagraphList::const_iterator const lastStartedPar = par;
 		ParagraphList::const_iterator send;
 
-		if (isParagraphEmpty(*par)) {
+		if (hasOnlyNotes(*par)) {
 			++par;
 			bpit += distance(lastStartedPar, par);
 			continue;
@@ -1250,4 +1297,4 @@ void docbookParagraphs(Text const &text,
 	}
 }
 
-} // namespace lyx
+} // namespace lyx
\ No newline at end of file


More information about the lyx-cvs mailing list