# style@LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
#
# * style: A (comma-separated) list of citestyles to which
-# this command is specific.
+# this command is specific. If preceeded by '!',
+# the list indicates citestyles for which the command
+# is _not_ supported.
# * LyXName: The LyX name as output in the LyX file. For
# portability reasons, we try to use the same
# name for same-formatted commands in the
# style@LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
#
# * style: A (comma-separated) list of citestyles to which
-# this command is specific.
+# this command is specific. If preceeded by '!',
+# the list indicates citestyles for which the command
+# is _not_ supported.
# * LyXName: The LyX name as output in the LyX file. For
# portability reasons, we try to use the same
# name for same-formatted commands in the
Footcite$[][]=smartcite
Autocite$[][]
citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
- fullcite[][]
+ !mla,mla-strict,mla-new,mla7@fullcite[][]
footfullcite[][]
nocite
keyonly
# style@LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd
#
# * style: A (comma-separated) list of citestyles to which
-# this command is specific.
+# this command is specific. If preceeded by '!',
+# the list indicates citestyles for which the command
+# is _not_ supported.
# * LyXName: The LyX name as output in the LyX file. For
# portability reasons, we try to use the same
# name for same-formatted commands in the
#
CiteEngine authoryear
Cite$|citealt,citealp[][]
- Citet$[][]=textcite
+ !mla,mla-strict,mla-new,mla7@Citet$[][]=textcite
Citep$[][]=parencite
apa,apa6@nptextcite$[][]
Citeauthor*<!_citeauthorstar!_citeauthorstartooltip>[][]
Footcite$[][]=smartcite
Autocite$[][]
citetitle*<!_citetitlestar!_citetitlestartooltip>[][]
- fullcite[][]
+ !mla,mla-strict,mla-new,mla7@fullcite[][]
footfullcite[][]
nocite
keyonly
\begin_layout Itemize
-\change_inserted -712698321 1720682930
+\change_inserted -712698321 1720883627
\begin_inset Flex Code
status collapsed
apa
\emph default
citation style can be defined.
+ If the list is prepended by an exclamation mark (
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1720883593
+!
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+),
+ the meaning is reversed:
+ it means that the style is used in all
+\emph on
+but
+\emph default
+ the listed styles.
\end_layout
\begin_layout Itemize
apa
\emph default
verfügbar ist.
+ Wenn der Liste ein Ausrufezeichen (
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+!
+\end_layout
+
+\end_inset
+
+) vorangestellt ist,
+ ist die Bedeutung umgekehrt:
+ der Befehl gilt dann in allen
+\emph on
+außer
+\emph default
+ den aufgelisteten Stilen.
\end_layout
\begin_layout Itemize
if (empty())
return vector<pair<docstring,docstring>>();
+ vector<CitationStyle> realStyles;
+ for (size_t i = 0; i != styles.size(); ++i) {
+ // exclude variants that are not supported in the current style
+ if (buf.masterParams().isActiveBiblatexCiteStyle(styles[i]))
+ realStyles.push_back(styles[i]);
+ }
+
string style;
- CiteStringMap csm(styles.size());
+ CiteStringMap csm(realStyles.size());
for (size_t i = 0; i != csm.size(); ++i) {
- 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;
+ style = realStyles[i].name;
csm[i] = make_pair(from_ascii(style), getLabel(keys, buf, style, ci));
}
}
+bool BufferParams::isActiveBiblatexCiteStyle(CitationStyle const & cs) const
+{
+ if (!useBiblatex())
+ return false;
+
+ if (cs.styles.empty() && cs.nostyles.empty())
+ // no restrictions
+ return true;
+
+ // exclude variants that are excluded in the current style
+ for (string const & s: cs.nostyles) {
+ if (s == biblatex_citestyle)
+ // explicitly excluded style
+ return false;
+ }
+ if (cs.styles.empty())
+ // not excluded
+ return true;
+
+ // only include variants that are supported in the current style
+ for (string const & s: cs.styles) {
+ if (s == biblatex_citestyle)
+ return true;
+ }
+ return false;
+}
+
string const BufferParams::getBibtexCommand(string const cmd, bool const warn) const
{
// split from options
std::vector<std::string> citeCommands() const;
/// the available citation styles
std::vector<CitationStyle> citeStyles() const;
+ /// is the biblatex citestyle active in the current context?
+ bool isActiveBiblatexCiteStyle(CitationStyle const & cs) const;
/// Return the actual bibtex command (lyxrc or buffer param)
std::string const bibtexCommand(bool const warn = false) const;
std::string startooltip;
/// Styles that supports the command
std::vector <std::string> styles;
+ /// Styles that do not supports the command
+ std::vector <std::string> nostyles;
/// upper casing author prefixes (van -> Van)
bool forceUpperCase;
/// starred version (full author list by default)
// split off style prefix if there
if (contains(lyx_cmd, '@')) {
lyx_cmd = split(lyx_cmd, style, '@');
- cs.styles = getVectorFromString(style);
+ // a '!' prefix indicates nostyle
+ if (prefixIs(style, "!")) {
+ style = style.substr(1);
+ cs.nostyles = getVectorFromString(style);
+ } else
+ cs.styles = getVectorFromString(style);
}
char fchar = lyx_cmd[0];
if (isUpperCase(fchar)) {
bool GuiCitation::initialiseParams(string const & sdata)
{
InsetCommand::string2params(sdata, params_);
- citeCmds_ = documentBuffer().params().citeCommands();
- citeStyles_ = documentBuffer().params().citeStyles();
+ citeStyles_.clear();
+ citeCmds_.clear();
+ vector<string> const cmds = documentBuffer().params().citeCommands();
+ vector<CitationStyle> const styles = documentBuffer().params().citeStyles();
+ for (size_t i = 0; i != styles.size(); ++i) {
+ // only include variants that are supported in the current style
+ if (documentBuffer().params().isActiveBiblatexCiteStyle(styles[i])) {
+ citeStyles_.push_back(styles[i]);
+ citeCmds_.push_back(cmds[i]);
+ }
+ }
init();
return true;
}
for (int ii = 1; cit != end; ++cit, ++ii) {
docstring label = cit->second;
CitationStyle ccs = citeStyleList[ii - 1];
- 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;
- }
+ while (!bp.isActiveBiblatexCiteStyle(ccs)) {
+ ++ii;
+ ccs = citeStyleList[ii - 1];
}
- if (!ccs.styles.empty() && !ours)
- continue;
ccs.forceUpperCase &= force;
ccs.hasStarredVersion &= star;
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
for (; it != end; ++it) {
CitationStyle this_cs = *it;
if (this_cs.name == normalized_input) {
- 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) {
+ if (!bp.isActiveBiblatexCiteStyle(this_cs)) {
// citation not supported with current style
// reset to \cite
normalized_input = "cite";