From 18d6701a40514764ff08f4a90886f5d073a57c32 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 3 Jan 2017 17:27:51 +0100 Subject: [PATCH] No need to hardcode the possible cite commands We fall back to a sensible default anyway. --- src/insets/InsetCitation.cpp | 47 +++++------------------------------- src/insets/InsetCitation.h | 2 +- 2 files changed, 7 insertions(+), 42 deletions(-) diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 233243bbe4..94a1592ee3 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -61,8 +61,8 @@ InsetCitation::~InsetCitation() ParamInfo const & InsetCitation::findInfo(string const & /* cmdName */) { - // standard cite does only take one argument if jurabib is - // not used, but jurabib extends this to two arguments, so + // standard cite does only take one argument, but biblatex, jurabib + // and natbib extend this to two arguments, so // we have to allow both here. InsetCitation takes care that // LaTeX output is nevertheless correct. if (param_info_.empty()) { @@ -74,44 +74,11 @@ ParamInfo const & InsetCitation::findInfo(string const & /* cmdName */) } -namespace { - -vector const init_possible_cite_commands() +// We allow any command here, since we fall back to cite +// anyway if a command is not allowed by a style +bool InsetCitation::isCompatibleCommand(string const &) { - char const * const possible[] = { - "cite", "nocite", "citet", "citep", "citealt", "citealp", - "citeauthor", "citeyear", "citeyearpar", - "citet*", "citep*", "citealt*", "citealp*", "citeauthor*", - "Citet", "Citep", "Citealt", "Citealp", "Citeauthor", - "Citet*", "Citep*", "Citealt*", "Citealp*", "Citeauthor*", - "fullcite", - "footcite", "footcitet", "footcitep", "footcitealt", - "footcitealp", "footciteauthor", "footciteyear", "footciteyearpar", - "citefield", "citetitle", "cite*" - }; - size_t const size_possible = sizeof(possible) / sizeof(possible[0]); - - return vector(possible, possible + size_possible); -} - - -vector const & possibleCiteCommands() -{ - static vector const possible = init_possible_cite_commands(); - return possible; -} - - -} // anon namespace - - -// FIXME: use the citeCommands provided by the TextClass -// instead of possibleCiteCommands defined in this file. -bool InsetCitation::isCompatibleCommand(string const & cmd) -{ - vector const & possibles = possibleCiteCommands(); - vector::const_iterator const end = possibles.end(); - return find(possibles.begin(), end, cmd) != end; + return true; } @@ -214,8 +181,6 @@ CitationStyle asValidLatexCommand(BufferParams const & bp, string const & input, { CitationStyle cs = valid_styles[0]; cs.forceUpperCase = false; - if (!InsetCitation::isCompatibleCommand(input)) - return cs; cs.hasStarredVersion = false; string normalized_input = input; diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 70022c67ad..40926b310a 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -80,7 +80,7 @@ public: /// static std::string defaultCommand() { return "cite"; } /// - static bool isCompatibleCommand(std::string const & cmd); + static bool isCompatibleCommand(std::string const &); //@} private: