The branch, xhtml/bugs/8280, has been updated. - Log -----------------------------------------------------------------
commit f7fdd4bf321de7f59ac44913bf34382f85e289b6 Author: Josh Hieronymus <[email protected]> Date: Fri Jun 7 00:28:41 2013 -0400 Render multicharacter delims properly to MathML and XHTML (Fix bug #8280) diff --git a/src/mathed/InsetMathDelim.cpp b/src/mathed/InsetMathDelim.cpp index 0653e88..975eeb5 100644 --- a/src/mathed/InsetMathDelim.cpp +++ b/src/mathed/InsetMathDelim.cpp @@ -40,6 +40,31 @@ static docstring convertDelimToLatexName(docstring const & name) return '\\' + name + ' '; } +static docstring convertDelimToXMLEscape(docstring const & name) +{ + if (name.size() == 1) { + char_type const c = name[0]; + if (c == '(' || c == '[' || c == '.' || c == ')' + || c == ']' || c == '/' || c == '|') { + return name; + } + if (c == '<') { + return from_ascii("<"); + } + if (c == '>') { + return from_ascii(">"); + } + } + MathWordList const & words = mathedWordList(); + MathWordList::const_iterator it = words.find(name); + if (it != words.end()) + { + docstring const escape = it->second.xmlname; + return escape; + } + + return '\\' + name + ' '; +} InsetMathDelim::InsetMathDelim(Buffer * buf, docstring const & l, docstring const & r) @@ -190,14 +215,16 @@ void InsetMathDelim::mathematica(MathematicaStream & os) const void InsetMathDelim::mathmlize(MathStream & os) const { - os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" << left_ << "</mo>" - << cell(0) << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" << right_ << "</mo>"; + os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>" + << convertDelimToXMLEscape(left_) << "</mo>" << cell(0) + << "<mo form='postfix' fence='true' stretchy='true' symmetric='true'>" + << convertDelimToXMLEscape(right_) << "</mo>"; } void InsetMathDelim::htmlize(HtmlStream & os) const { - os << left_ << cell(0) << right_; + os << convertDelimToXMLEscape(left_) << cell(0) << convertDelimToXMLEscape(right_); } ----------------------------------------------------------------------- Summary of changes: src/mathed/InsetMathDelim.cpp | 33 ++++++++++++++++++++++++++++++--- 1 files changed, 30 insertions(+), 3 deletions(-) hooks/post-receive -- Repositories for GSOC work
