html::htmlize(content, XHTMLStream::ESCAPE_ALL) + "</a>";
}
+
+docstring protectArgument(docstring & arg)
+{
+ if (contains(arg, '[') || contains(arg, ']'))
+ // protect brackets
+ arg = '{' + arg + '}';
+ return arg;
+}
+
} // anonymous namespace
docstring InsetCitation::generateLabel(bool for_xhtml) const
os << "\\" << cite_str;
- docstring const & before = getParam("before");
- docstring const & after = getParam("after");
+ docstring before = getParam("before");
+ docstring after = getParam("after");
if (!before.empty() && cs.textBefore)
- os << '[' << before << "][" << after << ']';
+ os << '[' << protectArgument(before)
+ << "][" << protectArgument(after) << ']';
else if (!after.empty() && cs.textAfter)
- os << '[' << after << ']';
+ os << '[' << protectArgument(after) << ']';
if (!bi.isBibtex(getParam("key")))
// escape chars with bibitems
- Fix mathtools, amsmath and amssymb not loading automatically for some
symbols (bug 10467)
+- Protect citation arguments (pre and post text) which contain brackets
+ (part of bug 2751).
+
+
* LYX2LYX
- Do not convert "--" to "\twohyphens" in formula macros.