]> git.lyx.org Git - features.git/blobdiff - src/xml.cpp
Improved character count statistics for letter based insets (e.g. the LyX logo).
[features.git] / src / xml.cpp
index 0816bf8918bd9ae94d5225c150c44f4abb2d542e..e16a7840b6db099e1a8048da629bad979bff6b1c 100644 (file)
@@ -75,7 +75,7 @@ docstring escapeChar(char c, XMLStream::EscapeSettings e)
 }
 
 
-docstring xml::escapeString(docstring const & raw, XMLStream::EscapeSettings e)
+docstring escapeString(docstring const & raw, XMLStream::EscapeSettings e)
 {
        docstring bin;
        bin.reserve(raw.size() * 2); // crude approximation is sufficient
@@ -91,13 +91,6 @@ docstring xml::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 newname;
@@ -115,7 +108,7 @@ docstring StartTag::writeTag() const
 {
        docstring output = '<' + tag_;
        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(),
                                                           [](int c) {return !std::isspace(c);}));
                if (!attributes.empty()) {
@@ -151,7 +144,7 @@ docstring CompTag::writeTag() const
        if (!attr_.empty()) {
                // Erase the beginning of the attributes if it contains space characters: this function deals with that
                // 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(),
                                                           [](int c) {return !std::isspace(c);}));
                if (!attributes.empty()) {
@@ -298,7 +291,7 @@ void XMLStream::clearTagDeque()
 XMLStream &XMLStream::operator<<(docstring const &d)
 {
        clearTagDeque();
-       os_ << xml::xmlize(d, escape_);
+       os_ << xml::escapeString(d, escape_);
        escape_ = ESCAPE_ALL;
        return *this;
 }
@@ -308,7 +301,7 @@ XMLStream &XMLStream::operator<<(const char *s)
 {
        clearTagDeque();
        docstring const d = from_ascii(s);
-       os_ << xml::xmlize(d, escape_);
+       os_ << xml::escapeString(d, escape_);
        escape_ = ESCAPE_ALL;
        return *this;
 }
@@ -483,7 +476,7 @@ XMLStream &XMLStream::operator<<(xml::EndTag const &etag)
                string estr = "Closing tag `" + to_utf8(etag.tag_)
                                          + "' when other tags are pending. Discarded pending tags:\n";
                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);
                // clear the pending tags...
                pending_tags_.clear();