mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Get rid of xmlize, bringing no advantage over escapeString.
This commit is contained in:
parent
0be32e3b98
commit
0c0613327c
@ -2230,7 +2230,7 @@ Buffer::ExportStatus Buffer::writeLyXHTMLSource(odocstream & os,
|
|||||||
os << "<title>"
|
os << "<title>"
|
||||||
<< (doctitle.empty() ?
|
<< (doctitle.empty() ?
|
||||||
from_ascii("LyX Document") :
|
from_ascii("LyX Document") :
|
||||||
xml::xmlize(doctitle, XMLStream::ESCAPE_ALL))
|
xml::escapeString(doctitle, XMLStream::ESCAPE_ALL))
|
||||||
<< "</title>\n";
|
<< "</title>\n";
|
||||||
|
|
||||||
docstring styles = features.getTClassHTMLPreamble();
|
docstring styles = features.getTClassHTMLPreamble();
|
||||||
|
@ -324,7 +324,7 @@ inline docstring wrapCitation(docstring const & key,
|
|||||||
// we have to do the escaping here, because we will ultimately
|
// we have to do the escaping here, because we will ultimately
|
||||||
// write this as a raw string, so as not to escape the tags.
|
// write this as a raw string, so as not to escape the tags.
|
||||||
return "<a href='#LyXCite-" + xml::cleanAttr(key) + "'>" +
|
return "<a href='#LyXCite-" + xml::cleanAttr(key) + "'>" +
|
||||||
xml::xmlize(content, XMLStream::ESCAPE_ALL) + "</a>";
|
xml::escapeString(content, XMLStream::ESCAPE_ALL) + "</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@ -224,7 +224,7 @@ void InsetHyperlink::docbook(XMLStream & xs, OutputParams const &) const
|
|||||||
docstring InsetHyperlink::xhtml(XMLStream & xs, OutputParams const &) const
|
docstring InsetHyperlink::xhtml(XMLStream & xs, OutputParams const &) const
|
||||||
{
|
{
|
||||||
docstring const & target =
|
docstring const & target =
|
||||||
xml::xmlize(getParam("target"), XMLStream::ESCAPE_AND);
|
xml::escapeString(getParam("target"), XMLStream::ESCAPE_AND);
|
||||||
docstring const & name = getParam("name");
|
docstring const & name = getParam("name");
|
||||||
xs << xml::StartTag("a", to_utf8("href=\"" + target + "\""));
|
xs << xml::StartTag("a", to_utf8("href=\"" + target + "\""));
|
||||||
xs << (name.empty() ? target : name);
|
xs << (name.empty() ? target : name);
|
||||||
|
17
src/xml.cpp
17
src/xml.cpp
@ -91,13 +91,6 @@ docstring escapeString(docstring const & raw, XMLStream::EscapeSettings e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// escape what needs escaping
|
|
||||||
docstring xmlize(docstring const &str, XMLStream::EscapeSettings e)
|
|
||||||
{
|
|
||||||
return xml::escapeString(str, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
docstring cleanAttr(docstring const & str)
|
docstring cleanAttr(docstring const & str)
|
||||||
{
|
{
|
||||||
docstring newname;
|
docstring newname;
|
||||||
@ -115,7 +108,7 @@ docstring StartTag::writeTag() const
|
|||||||
{
|
{
|
||||||
docstring output = '<' + tag_;
|
docstring output = '<' + tag_;
|
||||||
if (!attr_.empty()) {
|
if (!attr_.empty()) {
|
||||||
docstring attributes = xml::xmlize(attr_, XMLStream::ESCAPE_NONE);
|
docstring attributes = xml::escapeString(attr_, XMLStream::ESCAPE_NONE);
|
||||||
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
|
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
|
||||||
[](int c) {return !std::isspace(c);}));
|
[](int c) {return !std::isspace(c);}));
|
||||||
if (!attributes.empty()) {
|
if (!attributes.empty()) {
|
||||||
@ -151,7 +144,7 @@ docstring CompTag::writeTag() const
|
|||||||
if (!attr_.empty()) {
|
if (!attr_.empty()) {
|
||||||
// Erase the beginning of the attributes if it contains space characters: this function deals with that
|
// Erase the beginning of the attributes if it contains space characters: this function deals with that
|
||||||
// automatically.
|
// automatically.
|
||||||
docstring attributes = xmlize(from_utf8(attr_), XMLStream::ESCAPE_NONE);
|
docstring attributes = escapeString(from_utf8(attr_), XMLStream::ESCAPE_NONE);
|
||||||
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
|
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
|
||||||
[](int c) {return !std::isspace(c);}));
|
[](int c) {return !std::isspace(c);}));
|
||||||
if (!attributes.empty()) {
|
if (!attributes.empty()) {
|
||||||
@ -298,7 +291,7 @@ void XMLStream::clearTagDeque()
|
|||||||
XMLStream &XMLStream::operator<<(docstring const &d)
|
XMLStream &XMLStream::operator<<(docstring const &d)
|
||||||
{
|
{
|
||||||
clearTagDeque();
|
clearTagDeque();
|
||||||
os_ << xml::xmlize(d, escape_);
|
os_ << xml::escapeString(d, escape_);
|
||||||
escape_ = ESCAPE_ALL;
|
escape_ = ESCAPE_ALL;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -308,7 +301,7 @@ XMLStream &XMLStream::operator<<(const char *s)
|
|||||||
{
|
{
|
||||||
clearTagDeque();
|
clearTagDeque();
|
||||||
docstring const d = from_ascii(s);
|
docstring const d = from_ascii(s);
|
||||||
os_ << xml::xmlize(d, escape_);
|
os_ << xml::escapeString(d, escape_);
|
||||||
escape_ = ESCAPE_ALL;
|
escape_ = ESCAPE_ALL;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -483,7 +476,7 @@ XMLStream &XMLStream::operator<<(xml::EndTag const &etag)
|
|||||||
string estr = "Closing tag `" + to_utf8(etag.tag_)
|
string estr = "Closing tag `" + to_utf8(etag.tag_)
|
||||||
+ "' when other tags are pending. Discarded pending tags:\n";
|
+ "' when other tags are pending. Discarded pending tags:\n";
|
||||||
for (dit = pending_tags_.begin(); dit != den; ++dit)
|
for (dit = pending_tags_.begin(); dit != den; ++dit)
|
||||||
estr += to_utf8(xml::xmlize((*dit)->writeTag(), XMLStream::ESCAPE_ALL)) + "\n";
|
estr += to_utf8(xml::escapeString((*dit)->writeTag(), XMLStream::ESCAPE_ALL)) + "\n";
|
||||||
writeError(estr);
|
writeError(estr);
|
||||||
// clear the pending tags...
|
// clear the pending tags...
|
||||||
pending_tags_.clear();
|
pending_tags_.clear();
|
||||||
|
@ -139,9 +139,6 @@ docstring escapeChar(char c, XMLStream::EscapeSettings e);
|
|||||||
/// Escape a word instead of a single character
|
/// Escape a word instead of a single character
|
||||||
docstring escapeString(docstring const & raw, XMLStream::EscapeSettings e=XMLStream::ESCAPE_ALL);
|
docstring escapeString(docstring const & raw, XMLStream::EscapeSettings e=XMLStream::ESCAPE_ALL);
|
||||||
|
|
||||||
/// Converts a string to a form safe for links, etc.
|
|
||||||
docstring xmlize(docstring const &str, XMLStream::EscapeSettings e);
|
|
||||||
|
|
||||||
/// cleans \param str for use as an attribute by replacing all non-altnum by "_"
|
/// cleans \param str for use as an attribute by replacing all non-altnum by "_"
|
||||||
docstring cleanAttr(docstring const & str);
|
docstring cleanAttr(docstring const & str);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user