[LyX/master] DocBook: bug fixing with several bibliographic references at once.

Thibaut Cuvelier tcuvelier at lyx.org
Sat Aug 1 01:26:18 UTC 2020


commit fed71fa8c29b78de08f1678b31569e9348bbfeb7
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sat Aug 1 03:51:14 2020 +0200

    DocBook: bug fixing with several bibliographic references at once.
---
 .../docbook/bibliography_precooked_aastex.xml      |    4 ++--
 src/insets/InsetCitation.cpp                       |    9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/autotests/export/docbook/bibliography_precooked_aastex.xml b/autotests/export/docbook/bibliography_precooked_aastex.xml
index 33310b8..cba8d88 100644
--- a/autotests/export/docbook/bibliography_precooked_aastex.xml
+++ b/autotests/export/docbook/bibliography_precooked_aastex.xml
@@ -6,7 +6,7 @@
 </info>
 <section>
 <title>Introduction</title>
-<Standard>A focal problem today in the dynamics of globular clusters is core collapse. It has been predicted by theory for decades <biblioref endterm="hen61.lyn68.spi85-0" />, but observation has been less alert to the phenomenon. For many years the central brightness peak in M15 <biblioref endterm="kin75.new78-1" /> 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" />. </Standard>
+<Standard>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" />. </Standard>
 </section>
 <section>
 <title>Observations</title>
@@ -65,7 +65,7 @@
  <m:mrow><m:mi>B</m:mi>
  </m:mrow>
  </m:math></inlineequation>. All four cameras had scales of the order of 0.4 arcsec/pixel, and our field sizes were around 3 arcmin.</Standard>
-<Standard>The CCD images are unfortunately not always suitable, for very poor clusters or for clusters with large cores. Since the latter are easily studied by other means, we augmented our own CCD profiles by collecting from the literature a number of star-count profiles <biblioref endterm="kin68.pet76.har84.ort85-2" />, as well as photoelectric profiles <biblioref endterm="kin66.kin75-3" /> and electronographic profiles <biblioref endterm="kro84" />. In a few cases we judged normality by eye estimates on one of the Sky Surveys.</Standard>
+<Standard>The CCD images are unfortunately not always suitable, for very poor clusters or for clusters with large cores. Since the latter are easily studied by other means, we augmented our own CCD profiles by collecting from the literature a number of star-count profiles <biblioref endterm="kin68" />, <biblioref endterm="pet76" />, <biblioref endterm="har84" />, <biblioref endterm="ort85" />, as well as photoelectric profiles <biblioref endterm="kin66" />, <biblioref endterm="kin75" /> and electronographic profiles <biblioref endterm="kro84" />. In a few cases we judged normality by eye estimates on one of the Sky Surveys.</Standard>
 </section>
 <section>
 <title>Helicity Amplitudes</title>
diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 760c1da..830648d 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -552,14 +552,15 @@ void InsetCitation::docbook(XMLStream & xs, OutputParams const &) const
 		return;
 
 	// Split the different citations (on ","), so that one tag can be output for each of them.
-	string citations = to_utf8(xml::cleanID(getParam("key")));
+	// DocBook does not support having multiple citations in one tag, so that we have to deal with formatting here.
+	docstring citations = getParam("key");
 	if (citations.find(',') == string::npos) {
-		xs << xml::CompTag("biblioref", "endterm=\"" + citations + "\"");
+		xs << xml::CompTag("biblioref", "endterm=\"" + to_utf8(xml::cleanID(citations)) + "\"");
 	} else {
 		size_t pos = 0;
 		while (pos != string::npos) {
 			pos = citations.find(',');
-			xs << xml::CompTag("biblioref", "endterm=\"" + citations.substr(0, pos) + "\"");
+			xs << xml::CompTag("biblioref", "endterm=\"" + to_utf8(xml::cleanID(citations.substr(0, pos))) + "\"");
 			citations.erase(0, pos + 1);
 
 			if (pos != string::npos) {
@@ -627,7 +628,7 @@ void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const
 	// check if we have to do a qualified list
 	vector<docstring> keys = getVectorFromString(cleanupWhitespace(key));
 	bool const qualified = cs.hasQualifiedList
-		&& (!getParam("pretextlist").empty()
+		&& (!getParam("F").empty()
 		    || !getParam("posttextlist").empty());
 
 	if (runparams.inulemcmd > 0)


More information about the lyx-cvs mailing list