Generalize uppercase test

Biblatex has \Textcite and friends.
This commit is contained in:
Juergen Spitzmueller 2017-01-03 10:17:09 +01:00
parent 867cdb0662
commit 0b4d9d8d4a
4 changed files with 11 additions and 11 deletions

View File

@ -1188,9 +1188,9 @@ CitationStyle citationStyleFromString(string const & command)
return cs; return cs;
string cmd = command; string cmd = command;
if (cmd[0] == 'C') { if (isUpperCase(cmd[0])) {
cs.forceUpperCase = true; cs.forceUpperCase = true;
cmd[0] = 'c'; cmd[0] = lowercase(cmd[0]);
} }
size_t const n = cmd.size() - 1; size_t const n = cmd.size() - 1;

View File

@ -1041,9 +1041,9 @@ bool TextClass::readCiteEngine(Lexer & lexrc)
char ichar = def[0]; char ichar = def[0];
if (ichar == '#') if (ichar == '#')
continue; continue;
if (ichar == 'C') { if (isUpperCase(ichar)) {
cs.forceUpperCase = true; cs.forceUpperCase = true;
def[0] = 'c'; def[0] = lowercase(ichar);
} }
size_t const n = def.size(); size_t const n = def.size();

View File

@ -1547,7 +1547,7 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
docstring const & after = citinset->getParam("after"); docstring const & after = citinset->getParam("after");
size_t const n = cmd.size(); size_t const n = cmd.size();
bool const force = cmd[0] == 'C'; bool const force = isUpperCase(cmd[0]);
bool const full = cmd[n] == '*'; bool const full = cmd[n] == '*';
vector<docstring> const keys = getVectorFromString(key); vector<docstring> const keys = getVectorFromString(key);

View File

@ -195,8 +195,8 @@ CitationStyle asValidLatexCommand(string const & input, vector<CitationStyle> co
string normalized_input = input; string normalized_input = input;
string::size_type const n = input.size() - 1; string::size_type const n = input.size() - 1;
if (input[0] == 'C') if (isUpperCase(input[0]))
normalized_input[0] = 'c'; normalized_input[0] = lowercase(input[0]);
if (input[n] == '*') if (input[n] == '*')
normalized_input = normalized_input.substr(0, n); normalized_input = normalized_input.substr(0, n);
@ -210,7 +210,7 @@ CitationStyle asValidLatexCommand(string const & input, vector<CitationStyle> co
} }
} }
cs.forceUpperCase &= input[0] == 'C'; cs.forceUpperCase &= input[0] == uppercase(input[0]);
cs.fullAuthorList &= input[n] == '*'; cs.fullAuthorList &= input[n] == '*';
return cs; return cs;
@ -260,9 +260,9 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
// We don't currently use the full or forceUCase fields. // We don't currently use the full or forceUCase fields.
string cite_type = getCmdName(); string cite_type = getCmdName();
if (cite_type[0] == 'C') if (isUpperCase(cite_type[0]))
// If we were going to use them, this would mean ForceUCase // If we were going to use them, this would mean ForceUCase
cite_type = string(1, 'c') + cite_type.substr(1); cite_type[0] = lowercase(cite_type[0]);
if (cite_type[cite_type.size() - 1] == '*') if (cite_type[cite_type.size() - 1] == '*')
// and this would mean FULL // and this would mean FULL
cite_type = cite_type.substr(0, cite_type.size() - 1); cite_type = cite_type.substr(0, cite_type.size() - 1);