+CitationStyle InsetCitation::getCitationStyle(BufferParams const & bp, string const & input,
+ vector<CitationStyle> const & valid_styles) const
+{
+ CitationStyle cs = valid_styles[0];
+ cs.forceUpperCase = false;
+ cs.hasStarredVersion = false;
+
+ string normalized_input = input;
+ string::size_type const n = input.size() - 1;
+ if (isUpperCase(input[0]))
+ normalized_input[0] = lowercase(input[0]);
+ if (input[n] == '*')
+ normalized_input = normalized_input.substr(0, n);
+
+ string const alias = bp.getCiteAlias(normalized_input);
+ if (!alias.empty())
+ normalized_input = alias;
+
+ vector<CitationStyle>::const_iterator it = valid_styles.begin();
+ vector<CitationStyle>::const_iterator end = valid_styles.end();
+ for (; it != end; ++it) {
+ CitationStyle this_cs = *it;
+ if (this_cs.name == normalized_input) {
+ cs = *it;
+ break;
+ }
+ }
+
+ return cs;
+}
+
+