]> git.lyx.org Git - lyx.git/commitdiff
Provide optional trimmed version of Lexer::getString and getDocString
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 19 May 2015 08:15:34 +0000 (10:15 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 19 May 2015 08:15:34 +0000 (10:15 +0200)
Prerequisite to fix #9518

src/Lexer.cpp
src/Lexer.h

index c4b738f119bcf13fe903d8a74df6e53e1514bc28..fa9ffc71e8155040ff9c0b01dd802eee3f520a3d 100644 (file)
@@ -695,23 +695,23 @@ double Lexer::getFloat() const
 }
 
 
-string const Lexer::getString() const
+string const Lexer::getString(bool trim) const
 {
        lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
 
        if (lastReadOk_)
-       return pimpl_->getString();
+               return trim ? support::trim(pimpl_->getString(), "\t ") : pimpl_->getString();
 
        return string();
 }
 
 
-docstring const Lexer::getDocString() const
+docstring const Lexer::getDocString(bool trim) const
 {
        lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
 
        if (lastReadOk_)
-               return pimpl_->getDocString();
+               return trim ? support::trim(pimpl_->getDocString(), "\t ") : pimpl_->getDocString();
 
        return docstring();
 }
index dc56a4a70af47781471837b000aa5e98e5db2742..5e87ebc78b546bfca08c10bb9ae2ce14d05d6769 100644 (file)
@@ -137,9 +137,9 @@ public:
        ///
        double getFloat() const;
        ///
-       std::string const getString() const;
+       std::string const getString(bool trim = false) const;
        ///
-       docstring const getDocString() const;
+       docstring const getDocString(bool trim = false) const;
        /** Get a long string, ended by the tag `endtag'.
            This string can span several lines. The first line
            serves as a template for how many spaces the lines