[LyX/master] BiblioInfo: Add citestyle conditional

Juergen Spitzmueller spitz at lyx.org
Thu Jul 11 05:42:40 UTC 2024


commit a1e57a8fe543e3688df54625ab68a9c04e9de643
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Jul 11 07:41:47 2024 +0200

    BiblioInfo: Add citestyle conditional
---
 lib/doc/Customization.lyx    | 45 ++++++++++++++++++++++++++++++++++++++++++++
 lib/doc/de/Customization.lyx | 42 +++++++++++++++++++++++++++++++++++++++++
 src/BiblioInfo.cpp           | 11 +++++++++++
 3 files changed, 98 insertions(+)

diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index ee422b4bff..4fb1e37268 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -25725,6 +25725,51 @@ Biblatex
 \family default
  format for multi-reference citations),
  the false part if this is not the case.
+\change_inserted -712698321 1720625677
+
+\end_layout
+
+\begin_layout Itemize
+
+\change_inserted -712698321 1720628578
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1720628557
+{%ifstyle:<styles>%[[true]][[false]]}
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+:
+ process the 
+\begin_inset Quotes eld
+\end_inset
+
+true
+\begin_inset Quotes erd
+\end_inset
+
+ if the current biblatex citation style matches a style in the comma-separated list of 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1720628580
+<styles>
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+,
+ else the false part.
 \end_layout
 
 \begin_layout Standard
diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx
index 42c3e8fd84..efdbaaff48 100644
--- a/lib/doc/de/Customization.lyx
+++ b/lib/doc/de/Customization.lyx
@@ -24692,6 +24692,48 @@ Falsch
 -Teil.
 \end_layout
 
+\begin_layout Itemize
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+{%ifstyle:<styles>%[[wahr]][[falsch]]}
+\end_layout
+
+\end_inset
+
+:
+ führt den 
+\begin_inset Quotes gld
+\end_inset
+
+Wahr
+\begin_inset Quotes grd
+\end_inset
+
+-Teil aus,
+ wenn der aktuelle Biblatex-Zitierstil einer der Stile in der komma-separierten Liste 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+<styles>
+\end_layout
+
+\end_inset
+
+ ist,
+ sonst den 
+\begin_inset Quotes gld
+\end_inset
+
+Falsch
+\begin_inset Quotes grd
+\end_inset
+
+-Teil.
+\end_layout
+
 \begin_layout Standard
 Wir haben oben gesagt,
  dass 
diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 01f8d36ffa..5d4ded9996 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -1171,6 +1171,17 @@ docstring BibTeXInfo::getValueForKey(string const & oldkey, Buffer const & buf,
 			ret = modifier_;
 		else if (key == "numericallabel")
 			ret = cite_number_;
+		else if (prefixIs(key, "ifstyle:")) {
+			// Return whether we use a particular cite style
+			vector<string> const stls = getVectorFromString(to_ascii(subtype));
+			string const cs = buf.masterParams().biblatex_citestyle;
+			for (auto const & s : stls) {
+				if (cs == s) {
+					ret = from_ascii("x"); // any non-empty string will do
+					break;
+				}
+			}
+		}
 		else if (prefixIs(key, "ifmultiple:")) {
 			// Return whether we have multiple authors
 			docstring const kind = operator[](subtype);


More information about the lyx-cvs mailing list