+bool TextClass::readCiteEngine(Lexer & lexrc)
+{
+ int const type = readCiteEngineType(lexrc);
+ if (type & ENGINE_TYPE_AUTHORYEAR)
+ cite_styles_[ENGINE_TYPE_AUTHORYEAR].clear();
+ if (type & ENGINE_TYPE_NUMERICAL)
+ cite_styles_[ENGINE_TYPE_NUMERICAL].clear();
+ string def;
+ bool getout = false;
+ while (!getout && lexrc.isOK()) {
+ lexrc.eatLine();
+ def = lexrc.getString();
+ def = subst(def, " ", "");
+ def = subst(def, "\t", "");
+ if (compare_ascii_no_case(def, "end") == 0) {
+ getout = true;
+ continue;
+ }
+ string cmd;
+ CitationStyle cs;
+ char ichar = def[0];
+ if (ichar == '#')
+ continue;
+ if (ichar == 'C') {
+ cs.forceUpperCase = true;
+ def[0] = 'c';
+ }
+
+ size_t const n = def.size();
+ for (size_t i = 0; i != n; ++i) {
+ ichar = def[i];
+ if (ichar == '*')
+ cs.fullAuthorList = true;
+ else if (ichar == '[' && cs.textAfter)
+ cs.textBefore = true;
+ else if (ichar == '[')
+ cs.textAfter = true;
+ else if (ichar != ']')
+ cmd += ichar;
+ }
+
+ cs.cmd = cmd;
+ if (type & ENGINE_TYPE_AUTHORYEAR)
+ cite_styles_[ENGINE_TYPE_AUTHORYEAR].push_back(cs);
+ if (type & ENGINE_TYPE_NUMERICAL)
+ cite_styles_[ENGINE_TYPE_NUMERICAL].push_back(cs);
+ }
+ return getout;
+}
+
+
+int TextClass::readCiteEngineType(Lexer & lexrc) const
+{
+ int const ENGINE_TYPE_DEFAULT =
+ ENGINE_TYPE_AUTHORYEAR | ENGINE_TYPE_NUMERICAL;
+ if (!lexrc.next()) {
+ lexrc.printError("No cite engine type given for token: `$$Token'.");
+ return ENGINE_TYPE_DEFAULT;
+ }
+ string const type = rtrim(lexrc.getString());
+ if (compare_ascii_no_case(type, "authoryear") == 0)
+ return ENGINE_TYPE_AUTHORYEAR;
+ else if (compare_ascii_no_case(type, "numerical") == 0)
+ return ENGINE_TYPE_NUMERICAL;
+ else if (compare_ascii_no_case(type, "default") != 0) {
+ string const s = "Unknown cite engine type `" + type
+ + "' given for token: `$$Token',";
+ lexrc.printError(s);
+ }
+ return ENGINE_TYPE_DEFAULT;
+}
+
+
+bool TextClass::readCiteFormat(Lexer & lexrc)
+{
+ int const type = readCiteEngineType(lexrc);
+ string etype;
+ string definition;
+ while (lexrc.isOK()) {
+ lexrc.next();
+ etype = lexrc.getString();
+ if (compare_ascii_no_case(etype, "end") == 0)
+ break;
+ if (!lexrc.isOK())
+ return false;
+ lexrc.eatLine();
+ definition = lexrc.getString();
+ char initchar = etype[0];
+ if (initchar == '#')
+ continue;
+ if (initchar == '!' || initchar == '_') {
+ if (type & ENGINE_TYPE_AUTHORYEAR)
+ cite_macros_[ENGINE_TYPE_AUTHORYEAR][etype] = definition;
+ if (type & ENGINE_TYPE_NUMERICAL)
+ cite_macros_[ENGINE_TYPE_NUMERICAL][etype] = definition;
+ } else {
+ if (type & ENGINE_TYPE_AUTHORYEAR)
+ cite_formats_[ENGINE_TYPE_AUTHORYEAR][etype] = definition;
+ if (type & ENGINE_TYPE_NUMERICAL)
+ cite_formats_[ENGINE_TYPE_NUMERICAL][etype] = definition;
+ }
+ }
+ return true;
+}
+
+
+bool TextClass::readFloat(Lexer & lexrc)