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;
string cmd = command;
if (cmd[0] == 'C') {
if (isUpperCase(cmd[0])) {
cs.forceUpperCase = true;
cmd[0] = 'c';
cmd[0] = lowercase(cmd[0]);
}
size_t const n = cmd.size() - 1;

View File

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

View File

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

View File

@ -167,7 +167,7 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
vector<docstring> keys = getVectorFromString(key);
if (keys.size() == 1)
return bi.getInfo(keys[0], buffer(), true);
return bi.getInfo(keys[0], buffer(), true);
docstring tip;
tip += "<ol>";
@ -195,8 +195,8 @@ CitationStyle asValidLatexCommand(string const & input, vector<CitationStyle> co
string normalized_input = input;
string::size_type const n = input.size() - 1;
if (input[0] == 'C')
normalized_input[0] = 'c';
if (isUpperCase(input[0]))
normalized_input[0] = lowercase(input[0]);
if (input[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] == '*';
return cs;
@ -260,9 +260,9 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
// We don't currently use the full or forceUCase fields.
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
cite_type = string(1, 'c') + cite_type.substr(1);
cite_type[0] = lowercase(cite_type[0]);
if (cite_type[cite_type.size() - 1] == '*')
// and this would mean FULL
cite_type = cite_type.substr(0, cite_type.size() - 1);