The branch, feature/docbook, has been updated.
  discards  94ccc79a6fdf15320fe3bf6ad5a4e72e20faf05f (commit)
  discards  eeedeb8a20e5bfd062943f794f10814b6c6f78b5 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (94ccc79a6fdf15320fe3bf6ad5a4e72e20faf05f)
            \
             N -- N -- N (cd27ab8e4568f37414d89c0eeeea086a1fcb6553)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

- Log -----------------------------------------------------------------

commit cd27ab8e4568f37414d89c0eeeea086a1fcb6553
Author: Thibaut Cuvelier <[email protected]>
Date:   Thu Sep 3 01:23:20 2020 +0200

    DocBook: avoid using isspace in StartTag::writeTag.
    
    This is the cause of crashes (on both Windows and Linux).

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index addf24a..ce7e641 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -429,16 +429,6 @@ void makeBibliography(
 }
 
 
-bool isNotOnlySpace(docstring const & str)
-{
-       for (auto const & c: str) {
-               if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != 
'\f' && c != '\r')
-                       return true;
-       }
-       return false;
-}
-
-
 void makeParagraph(
                Text const & text,
                Buffer const & buf,
@@ -531,7 +521,7 @@ void makeParagraph(
        ++nextpar;
        auto pars = par->simpleDocBookOnePar(buf, runparams, 
text.outerFont(distance(begin, par)), 0, nextpar == end, special_case);
        for (docstring const & parXML : pars) {
-               if (isNotOnlySpace(parXML)) {
+               if (xml::isNotOnlySpace(parXML)) {
                        if (open_par)
                                openParTag(xs, &*par, prevpar);
 
diff --git a/src/xml.cpp b/src/xml.cpp
index dd9790f..478f961 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -108,12 +108,9 @@ docstring StartTag::writeTag() const
 {
        docstring output = '<' + tag_;
        if (!attr_.empty()) {
-               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()) {
+               docstring attributes = xml::trimLeft(xml::escapeString(attr_, 
XMLStream::ESCAPE_NONE));
+               if (!attributes.empty())
                        output += ' ' + attributes;
-               }
        }
        output += ">";
        return output;
@@ -601,6 +598,39 @@ docstring xml::uniqueID(docstring const & label)
 }
 
 
+bool xml::isNotOnlySpace(docstring const & str)
+{
+       for (auto const & c: str) {
+               if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != 
'\f' && c != '\r')
+               return true;
+       }
+       return false;
+}
+
+
+docstring xml::removeSpace(docstring const & str)
+{
+       odocstringstream ss;
+       for (auto const & c: str) {
+               if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != 
'\f' && c != '\r')
+                       ss << c;
+       }
+       return ss.str();
+}
+
+
+docstring xml::trimLeft(docstring const & str)
+{
+       size_t i = 0;
+       for (auto const & c: str) {
+               if (c != ' ' && c != '\t' && c != '\n' && c != '\v' && c != 
'\f' && c != '\r')
+                       return str.substr(i, docstring::npos);
+               i++;
+       }
+       return str;
+}
+
+
 docstring xml::cleanID(docstring const & orig)
 {
        // The standard xml:id only allows letters, digits, '-' and '.' in a 
name.
diff --git a/src/xml.h b/src/xml.h
index ebb8b8e..568c5e5 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -162,6 +162,15 @@ docstring cleanID(docstring const &orig);
 /// returns a unique numeric ID
 docstring uniqueID(docstring const & label);
 
+/// determines whether a string only contains space characters
+bool isNotOnlySpace(docstring const & str);
+
+///
+docstring removeSpace(docstring const & str);
+
+///
+docstring trimLeft(docstring const & str);
+
 struct FontTag;
 struct EndFontTag;
 

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
Repository for new features
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to