- // parse an options string, which must appear at the start of the
- // format parameter. puts the parsed bits in optkey, ifpart, and
- // elsepart and returns what's left after the option is removed.
- // if there's an error, it returns format itself.
- string parseOptions(string const & format, string & optkey,
- string & ifpart, string & elsepart)
- {
- LASSERT(format[0] == '{' && format[1] == '%', return format);
- // strip '{%'
- string fmt = format.substr(2);
- size_t pos = fmt.find('%'); // end of key
- if (pos == string::npos) {
- LYXERR0("Error parsing `" << format <<"'. Can't find end of key.");
- return format;
- }
- optkey = fmt.substr(0,pos);
- fmt = fmt.substr(pos + 1);
- // [[format]] should be next
- if (fmt[0] != '[' || fmt[1] != '[') {
- LYXERR0("Error parsing `" << format <<"'. Can't find '[[' after key.");
- return format;
- }
+// parse an options string, which must appear at the start of the
+// format parameter. puts the parsed bits in optkey, ifpart, and
+// elsepart and returns what's left after the option is removed.
+// if there's an error, it returns format itself.
+string parseOptions(string const & format, string & optkey,
+ string & ifpart, string & elsepart)
+{
+ LASSERT(format[0] == '{' && format[1] == '%', return format);
+ // strip '{%'
+ string fmt = format.substr(2);
+ size_t pos = fmt.find('%'); // end of key
+ if (pos == string::npos) {
+ LYXERR0("Error parsing `" << format <<"'. Can't find end of key.");
+ return format;
+ }
+ optkey = fmt.substr(0,pos);
+ fmt = fmt.substr(pos + 1);
+ // [[format]] should be next
+ if (fmt[0] != '[' || fmt[1] != '[') {
+ LYXERR0("Error parsing `" << format <<"'. Can't find '[[' after key.");
+ return format;
+ }