]> git.lyx.org Git - lyx.git/commitdiff
Allow to pass several styles for style-specific cite commands
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 11 Jul 2024 08:09:26 +0000 (10:09 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 11 Jul 2024 08:09:26 +0000 (10:09 +0200)
lib/doc/Customization.lyx
lib/doc/de/Customization.lyx
src/BiblioInfo.cpp
src/Citation.h
src/TextClass.cpp
src/frontends/qt/Menus.cpp
src/insets/InsetCitation.cpp

index 4fb1e372684bc7a2af6b80ddf1d09e34be1806b7..238404bc3b67433ff50ee5c06f307d0fe80e37ef 100644 (file)
@@ -24612,7 +24612,7 @@ LyXName|alias$*<!_stardesc!_stardesctooltip>[][]=latexcmd
 
 \begin_layout Itemize
 
-\change_inserted -712698321 1720623254
+\change_inserted -712698321 1720682930
 \begin_inset Flex Code
 status collapsed
 
@@ -24627,8 +24627,7 @@ style
 \end_inset
 
 :
- If this is given,
- the command is specific to this (biblatex) citation style.
+ a (comma-separated) list of biblatex citation styles to which this command is specific.
  E.
 \begin_inset space \thinspace{}
 \end_inset
index efdbaaff4829ac2dd3210c05d17ed1ab45339170..162aa3dd8b6214b98810474d8f920a486f2252de 100644 (file)
@@ -23470,8 +23470,8 @@ style
 \end_inset
 
 :
Wenn dies angegeben wird,
wird der Befehl als spezifisch für einen (Biblatex-)Zitierstil markiert.
eine (kommaseparierter) Liste von (Biblatex-)Zitierstilen,
für die der Befehl spezifisch ist.
  Mit 
 \begin_inset Flex Code
 status collapsed
index 04235e424a4b11a8c0b445fbd32337dcb71d8ad8..2db4041bc6d764dfe411d8595b57ea286ebc4cf9 100644 (file)
@@ -1603,7 +1603,15 @@ BiblioInfo::CiteStringMap const BiblioInfo::getCiteStrings(
        string style;
        CiteStringMap csm(styles.size());
        for (size_t i = 0; i != csm.size(); ++i) {
-               if (!styles[i].style.empty() && styles[i].style != buf.masterParams().biblatex_citestyle)
+               bool ours = false;
+               // exclude variants that are not supported in the current style
+               for (string const & s: styles[i].styles) {
+                       if (s == buf.masterParams().biblatex_citestyle) {
+                               ours = true;
+                               break;
+                       }
+               }
+               if (!styles[i].styles.empty() && !ours)
                        continue;
                style = styles[i].name;
                csm[i] = make_pair(from_ascii(style), getLabel(keys, buf, style, ci));
index 8ed64a764694fa7f35f00aee6d9a8c4c1c388f18..02e8d4ba3c7d356f04917852de23a47a3715fbdb 100644 (file)
@@ -43,8 +43,8 @@ public:
        std::string stardesc;
        /// Optional tooltip for the starred version
        std::string startooltip;
-       /// Style that supports the command
-       std::string style;
+       /// Styles that supports the command
+       std::vector <std::string> styles;
        /// upper casing author prefixes (van -> Van)
        bool forceUpperCase;
        /// starred version (full author list by default)
index eacb41c7cc03eb5bd723efdddfb8ab06c2095ef5..43731e14cc2bd8ef2b319fb9be6d607ad49d074b 100644 (file)
@@ -1228,7 +1228,7 @@ bool TextClass::readCiteEngine(Lexer & lexrc, ReadType rt, bool const add)
                // split off style prefix if there
                if (contains(lyx_cmd, '@')) {
                        lyx_cmd = split(lyx_cmd, style, '@');
-                       cs.style = style;
+                       cs.styles = getVectorFromString(style);
                }
                cs.name = lyx_cmd;
                cs.cmd = latex_cmd.empty() ? lyx_cmd : latex_cmd;
index f1ad6fefc5ef74dbce3837e443280526c7619e66..16466b564e32c87c8c956960b4f4e6d9a52bb3f1 100644 (file)
@@ -1749,7 +1749,15 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
        for (int ii = 1; cit != end; ++cit, ++ii) {
                docstring label = cit->second;
                CitationStyle ccs = citeStyleList[ii - 1];
-               if (!ccs.style.empty() && ccs.style != bp.biblatex_citestyle)
+               bool ours = false;
+               // exclude variants that are not supported in the current style
+               for (string const & s: ccs.styles) {
+                       if (s == bp.biblatex_citestyle) {
+                               ours = true;
+                               break;
+                       }
+               }
+               if (!ccs.styles.empty() && !ours)
                        continue;
                ccs.forceUpperCase &= force;
                ccs.hasStarredVersion &= star;
index 120786245ca6c1486ab90e87552671a222cdd30c..c7933b8850a3f103d0f46204dbb138ec83217eab 100644 (file)
@@ -380,7 +380,15 @@ CitationStyle asValidLatexCommand(BufferParams const & bp, string const & input,
        for (; it != end; ++it) {
                CitationStyle this_cs = *it;
                if (this_cs.name == normalized_input) {
-                       if (!this_cs.style.empty() && this_cs.style != bp.biblatex_citestyle) {
+                       bool ours = false;
+                       // exclude variants that are not supported in the current style
+                       for (string const & s: this_cs.styles) {
+                               if (s == bp.biblatex_citestyle) {
+                                       ours = true;
+                                       break;
+                               }
+                       }
+                       if (!this_cs.styles.empty() && !ours) {
                                // citation not supported with current style
                                // reset to \cite
                                normalized_input = "cite";