[LyX/master] DocBook: fix delimitation of bibliographies.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Aug 2 01:38:48 UTC 2020


commit 8d115413c1165c917337db5d840896d330b5df64
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 2 03:14:16 2020 +0200

    DocBook: fix delimitation of bibliographies.
---
 .../docbook/bibliography_precooked_aastex.xml      |   11 +++++------
 lib/layouts/aastex6.layout                         |    4 ++--
 lib/layouts/aastex62.layout                        |    3 ++-
 src/output_docbook.cpp                             |   14 +++++++++++---
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index baadbc0..bc10168 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -948,7 +948,7 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
  </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>
-<Software>IRAF, AIPS, Astropy, ...</Software>
+<para><application>IRAF, AIPS, Astropy, ...</application></para>
 <Appendix></Appendix>
 <bibliography>
 <bibliomixed xml:id='aur82'>Aurière, M. 1982, <!-- \aap -->, 109, 301 </bibliomixed>
@@ -966,9 +966,10 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
 <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>
-<bibliomixed>
-</bibliomixed>
-<bibliomixed><table xml:id="tbl-2">
+</bibliography>
+<para>
+</para>
+<table xml:id="tbl-2">
 <caption>Terribly relevant tabular information.</caption>
 
 <tbody>
@@ -1208,10 +1209,8 @@ v(p,\lambda)_{\pm} & = & \pm\lambda(E\mp\lambda|{\textbf{p}}|)^{1/2}\chi
 <TableComments>We can also attach a long-ish paragraph of explanatory material to a table. Use \tablerefs to append a list of references. The following references were from a different table: I've patched them in here to show how they look, but don't take them too seriously—I certainly have not.</TableComments>
 <TableRefs>(1) Barbuy, Spite, & Spite 1985; (2) Bond 1980; (3) Carbon et al. 1987; (4) Hobbs & Duncan 1987; (5) Gilroy et al. 1988: (6) Gratton & Ortolani 1986; (7) Gratton & Sneden 1987; (8) Gratton & Sneden (1988); (9) Gratton & Sneden 1991; (10) Kraft et al. 1982; (11) LCL, or Laird, 1990; (12) Leep & Wallerstein 1981; (13) Luck & Bond 1981; (14) Luck & Bond 1985; (15) Magain 1987; (16) Magain 1989; (17) Peterson 1981; (18) Peterson, Kurucz, & Carney 1990; (19) RMB; (20) Schuster & Nissen 1988; (21) Schuster & Nissen 1989b; (22) Spite et al. 1984; (23) Spite & Spite 1986; (24) Hobbs & Thorburn 1991; (25) Hobbs et al. 1991; (26) Olsen 1983.</TableRefs>
 </table>
-</bibliomixed>
 
 
-</bibliography>
 </section>
 
 </article>
\ No newline at end of file
diff --git a/lib/layouts/aastex6.layout b/lib/layouts/aastex6.layout
index 52c38be..03d585e 100644
--- a/lib/layouts/aastex6.layout
+++ b/lib/layouts/aastex6.layout
@@ -67,8 +67,8 @@ Style Software
 	LabelFont
 	  Shape		Italic
 	EndFont
-	DocBookWrapperTag  para
-	DocBookTag         application
+	DocBookWrapperTag   para
+	DocBookTag          application
 End
 
 # other new commands are mainly for the user preamble
diff --git a/lib/layouts/aastex62.layout b/lib/layouts/aastex62.layout
index 16173d4..3eb7dcc 100644
--- a/lib/layouts/aastex62.layout
+++ b/lib/layouts/aastex62.layout
@@ -78,7 +78,8 @@ Style Software
 	LabelFont
 		Shape           Italic
 	EndFont
-	
+	DocBookWrapperTag   para
+	DocBookTag          application
 End
 
 # other new commands are mainly for the user preamble
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 1a2bb41..94aac87 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -274,6 +274,14 @@ ParagraphList::const_iterator findLastParagraph(
 	return p;
 }
 
+ParagraphList::const_iterator findLastBibliographyParagraph(
+		ParagraphList::const_iterator p,
+		ParagraphList::const_iterator const & pend) {
+	for (++p; p != pend && p->layout().latextype == LATEX_BIB_ENVIRONMENT; ++p);
+
+	return p;
+}
+
 
 ParagraphList::const_iterator findEndOfEnvironment(
 		ParagraphList::const_iterator const & pstart,
@@ -339,7 +347,7 @@ ParagraphList::const_iterator makeParagraphBibliography(
 		xs << xml::CR();
 	}
 
-	// Generate the required paragraphs.
+	// Generate the required paragraphs, but only if they are .
 	for (; par != pend; ++par) {
 		// Start the precooked bibliography entry. This is very much like opening a paragraph tag.
 		// Don't forget the citation ID!
@@ -628,7 +636,7 @@ ParagraphList::const_iterator makeEnvironment(
 			par = makeParagraphs(buf, xs, runparams, text, par, send);
 			break;
 		case LATEX_BIB_ENVIRONMENT:
-			send = findLastParagraph(par, pend);
+			send = findLastBibliographyParagraph(par, pend);
 			par = makeParagraphBibliography(buf, xs, runparams, text, par, send);
 			break;
 		case LATEX_COMMAND:
@@ -705,7 +713,7 @@ pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
 			break;
 		}
 		case LATEX_BIB_ENVIRONMENT: {
-			send = findLastParagraph(par, pend);
+			send = findLastBibliographyParagraph(par, pend);
 			par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
 			break;
 		}


More information about the lyx-cvs mailing list