[LyX/master] Revert "DocBook: allow empty paragraphs before the <info> section."

Thibaut Cuvelier tcuvelier at lyx.org
Mon Aug 3 20:33:03 UTC 2020


commit 348297520f8d1c235db66f97f5125e6002dd55f8
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Aug 3 22:58:15 2020 +0200

    Revert "DocBook: allow empty paragraphs before the <info> section."
    
    This reverts commit c6937cece975ddfbe6b30f1cc85f3aa891d07dad.
---
 .../docbook/bibliography_precooked_aastex.xml      |   17 --------------
 src/output_docbook.cpp                             |   23 +------------------
 2 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 37dada8..89b1714 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -3,23 +3,6 @@
   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></author>
-<author><affiliation>Astronomy Department, University of California, Berkeley, CA 94720</affiliation></author>
-<author><affiliation role="alternate">Visiting Astronomer Cerro Tololo Inter-American Observatory.CTIO is operated by AURA Inc. under contract to the National Science Foundation.</affiliation></author>
-<author><affiliation role="alternate">Society of Fellows, Harvard University.</affiliation></author>
-<author><affiliation role="alternate">present address: Center for Astrophysics60 Garden Street, Cambridge, MA 02138</affiliation></author>
-<author><personname>C. D. Biemesderfer</personname></author>
-<author><affiliation>National Optical Astronomy Observatories, Tucson, AZ 85719</affiliation></author>
-<author><affiliation role="alternate">Visiting Programmer, Space Telescope Science Institute</affiliation></author>
-<author><affiliation role="alternate">Patron, Alonso's Bar and Grill</affiliation></author>
-<author><email>aastex-help at aas.org</email></author>
-<author><personname>R. J. Hanisch</personname></author>
-<author><affiliation>Space Telescope Science Institute, Baltimore, MD 21218</affiliation></author>
-<author><affiliation role="alternate">Patron, Alonso's Bar and Grill</affiliation></author>
-<abstract>
-<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>
-</abstract>
 </info>
 <section>
 <title>Introduction</title>
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 2199239..5e15edc 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -764,34 +764,15 @@ DocBookDocumentSectioning hasDocumentSectioning(ParagraphList const &paragraphs,
 }
 
 
-bool hasOnlyNotes(Paragraph const & par)
-{
-	for (int i = 0; i < par.size(); ++i)
-		if (!par.isInset(i) || !dynamic_cast<InsetNote *>(par.insetList().get(i)))
-			return false;
-	return true;
-}
-
-
-DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs, pit_type bpit, pit_type const epit) {
+DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs, pit_type const bpit, pit_type const epit) {
 	set<pit_type> shouldBeInInfo;
 	set<pit_type> mustBeInInfo;
 
-	// Find the first non empty paragraph by mutating bpit.
-	while (bpit < epit) {
-		Paragraph const &par = paragraphs[bpit];
-		if (par.empty() || hasOnlyNotes(par))
-			bpit += 1;
-		else
-			break;
-	}
-
-	// Find the last info-like paragraph.
 	pit_type cpit = bpit;
 	while (cpit < epit) {
 		// Skip paragraphs only containing one note.
 		Paragraph const &par = paragraphs[cpit];
-		if (hasOnlyNotes(par)) {
+		if (par.size() == 1 && dynamic_cast<InsetNote*>(paragraphs[cpit].insetList().get(0))) {
 			cpit += 1;
 			continue;
 		}


More information about the lyx-cvs mailing list