From 0b4d9d8d4af31c9374133b25934b655c87e0eeb8 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 3 Jan 2017 10:17:09 +0100 Subject: [PATCH] Generalize uppercase test Biblatex has \Textcite and friends. --- src/BiblioInfo.cpp | 4 ++-- src/TextClass.cpp | 4 ++-- src/frontends/qt4/Menus.cpp | 2 +- src/insets/InsetCitation.cpp | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 243f78c59f..406d0e2ae5 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -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; diff --git a/src/TextClass.cpp b/src/TextClass.cpp index b6a5ad72b3..2a82cc970a 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -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(); diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index 81ce5764ae..624becc24c 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -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 const keys = getVectorFromString(key); diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 13fddd7802..7063cae1fa 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -167,7 +167,7 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const vector keys = getVectorFromString(key); if (keys.size() == 1) - return bi.getInfo(keys[0], buffer(), true); + return bi.getInfo(keys[0], buffer(), true); docstring tip; tip += "
    "; @@ -195,8 +195,8 @@ CitationStyle asValidLatexCommand(string const & input, vector 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 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);