XML: use the new mechanisms for CR detection with errors.

This helps tracking down line problems even in the presence of errors.
This commit is contained in:
Thibaut Cuvelier 2020-08-29 02:43:30 +02:00
parent 52b2d3f683
commit bfc67c59b4
2 changed files with 14 additions and 6 deletions

View File

@ -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();
}

View File

@ -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();