X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetInclude.cpp;h=7c0d6ce5505a3f86d7b1cc15f2b9ed4cdf662b03;hb=7986ac2f322aeb9c764d1c518cedd159d62f32d7;hp=89f2533111a99f04cc6f9551c5577750c6cf5de5;hpb=7c614cc6b723bbdd5a65a5eb6dab8c400b2ec017;p=lyx.git diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 89f2533111..7c0d6ce550 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -165,6 +165,23 @@ InsetLabel * createLabel(Buffer * buf, docstring const & label_str) return new InsetLabel(buf, icp); } + +char_type replaceCommaInBraces(docstring & params) +{ + // Code point from private use area + char_type private_char = 0xE000; + int count = 0; + for (char_type & c : params) { + if (c == '{') + ++count; + else if (c == '}') + --count; + else if (c == ',' && count) + c = private_char; + } + return private_char; +} + } // namespace @@ -617,12 +634,18 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const docstring label; docstring placement; bool isfloat = lstparams.isFloat(); + // We are going to split parameters at commas, so + // replace commas that are not parameter separators + // with a code point from the private use area + char_type comma = replaceCommaInBraces(parameters); // Get float placement, language, caption, and // label, then remove the relative options if minted. vector opts = getVectorFromString(parameters, from_ascii(","), false); vector latexed_opts; for (size_t i = 0; i < opts.size(); ++i) { + // Restore replaced commas + opts[i] = subst(opts[i], comma, ','); if (use_minted && prefixIs(opts[i], from_ascii("float"))) { if (prefixIs(opts[i], from_ascii("float="))) placement = opts[i].substr(6); @@ -762,7 +785,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const "uses module `%2$s'\n" "which is not used in parent file."), included_file.displayName(), from_utf8(module)); - Alert::warning(_("Module not found"), text); + Alert::warning(_("Module not found"), text, true); } } }