[LyX/master] XML: use the new mechanisms for CR detection with errors.
Thibaut Cuvelier
tcuvelier at lyx.org
Sat Sep 19 18:18:55 UTC 2020
commit bfc67c59b44415f2dea7ad068a8ac86e2b19f488
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date: Sat Aug 29 02:43:30 2020 +0200
XML: use the new mechanisms for CR detection with errors.
This helps tracking down line problems even in the presence of errors.
---
src/xml.cpp | 12 ++++++++----
src/xml.h | 8 ++++++--
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/xml.cpp b/src/xml.cpp
index b4004af..2f49667 100644
--- a/src/xml.cpp
+++ b/src/xml.cpp
@@ -167,17 +167,21 @@ bool FontTag::operator==(StartTag const & tag) const
} // namespace xml
-void XMLStream::writeError(std::string const &s) const
+void XMLStream::writeError(std::string const &s)
{
LYXERR0(s);
- os_ << from_utf8("<!-- Output Error: " + s + " -->\n");
+ *this << ESCAPE_NONE << from_utf8("<!-- Output Error: " + s + " -->");
+ *this << xml::CR();
}
-void XMLStream::writeError(docstring const &s) const
+void XMLStream::writeError(docstring const &s)
{
LYXERR0(s);
- os_ << from_utf8("<!-- Output Error: ") << s << from_utf8(" -->\n");
+ *this << ESCAPE_NONE << from_utf8("<!-- Output Error: ");
+ *this << s;
+ *this << ESCAPE_NONE << from_utf8(" -->");
+ *this << xml::CR();
}
diff --git a/src/xml.h b/src/xml.h
index 9a7cf17..45c62ab 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -103,9 +103,13 @@ public:
/// that simplifies the logic using this code.
bool isLastTagCR() const { return is_last_tag_cr_; };
///
- void writeError(std::string const &) const;
+ void writeError(std::string const &);
///
- void writeError(docstring const &) const;
+ void writeError(docstring const &);
+ ///
+ typedef std::shared_ptr<xml::StartTag> TagPtr;
+ /// Returns the last element on the tag stack. XMLStream keeps ownership of the item.
+ TagPtr getLastStackTag();
private:
///
void clearTagDeque();
More information about the lyx-cvs
mailing list