mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Make macro xhtml export more secure
Actually I wanted to do that in cc87f8100
but forgot to adjust the original
solution completely. Now we do not search for an arbitrary latexkeys instance
which just happens to have the same name as the macro, but we only use the
symbol that was explicitly set for global macros.
This commit is contained in:
parent
b0361fb3c5
commit
33b059bd9d
@ -119,6 +119,20 @@ string const MacroData::requires() const
|
||||
}
|
||||
|
||||
|
||||
docstring const MacroData::xmlname() const
|
||||
{
|
||||
if (sym_)
|
||||
return sym_->xmlname;
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
char const * MacroData::MathMLtype() const
|
||||
{
|
||||
return sym_ ? sym_->MathMLtype() : 0;
|
||||
}
|
||||
|
||||
|
||||
void MacroData::unlock() const
|
||||
{
|
||||
--lockCount_;
|
||||
|
@ -62,6 +62,10 @@ public:
|
||||
///
|
||||
std::string const requires() const;
|
||||
///
|
||||
docstring const xmlname() const;
|
||||
///
|
||||
char const * MathMLtype() const;
|
||||
///
|
||||
void setSymbol(latexkeys const * sym) { sym_ = sym; }
|
||||
|
||||
/// lock while being drawn to avoid recursions
|
||||
|
@ -793,12 +793,11 @@ void MathMacro::maple(MapleStream & os) const
|
||||
|
||||
void MathMacro::mathmlize(MathStream & os) const
|
||||
{
|
||||
MathWordList const & words = mathedWordList();
|
||||
MathWordList::const_iterator it = words.find(name());
|
||||
if (it != words.end()) {
|
||||
docstring const xmlname = it->second.xmlname;
|
||||
LATTEST(macro_);
|
||||
if (macro_) {
|
||||
docstring const xmlname = macro_->xmlname();
|
||||
if (!xmlname.empty()) {
|
||||
char const * type = it->second.MathMLtype();
|
||||
char const * type = macro_->MathMLtype();
|
||||
os << '<' << type << "> " << xmlname << " /<"
|
||||
<< type << '>';
|
||||
return;
|
||||
@ -815,10 +814,9 @@ void MathMacro::mathmlize(MathStream & os) const
|
||||
|
||||
void MathMacro::htmlize(HtmlStream & os) const
|
||||
{
|
||||
MathWordList const & words = mathedWordList();
|
||||
MathWordList::const_iterator it = words.find(name());
|
||||
if (it != words.end()) {
|
||||
docstring const xmlname = it->second.xmlname;
|
||||
LATTEST(macro_);
|
||||
if (macro_) {
|
||||
docstring const xmlname = macro_->xmlname();
|
||||
if (!xmlname.empty()) {
|
||||
os << ' ' << xmlname << ' ';
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user