]> git.lyx.org Git - features.git/commitdiff
We need to check, in closeFontTags(), for the case where we haven't
authorRichard Heck <rgheck@lyx.org>
Sun, 8 Apr 2012 14:02:40 +0000 (10:02 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 8 Apr 2012 14:05:44 +0000 (10:05 -0400)
had any content.

src/output_xhtml.cpp
src/output_xhtml.h

index 9ccc4e3e785b595b07444c5110a67d32709fd862..fbd9f4bc1cff713379136140bb0392aa4cd393a8 100644 (file)
@@ -233,8 +233,15 @@ namespace {
 
 bool XHTMLStream::closeFontTags()
 {
+       if (isTagPending(parsep_tag))
+               // we haven't had any content
+               return true;
+
+       // this may be a useless check, since we ought at least to have
+       // the parsep_tag. but it can't hurt too much to be careful.
        if (tag_stack_.empty())
                return true;
+
        // first, we close any open font tags we can close
        html::StartTag curtag = tag_stack_.back();
        while (html::isFontTag(curtag.tag_)) {
@@ -429,6 +436,17 @@ bool XHTMLStream::isTagOpen(string const & stag) const
 }
 
 
+bool XHTMLStream::isTagPending(string const & stag) const
+{
+       TagStack::const_iterator sit = pending_tags_.begin();
+       TagStack::const_iterator const sen = pending_tags_.end();
+       for (; sit != sen; ++sit)
+               if (sit->tag_ == stag)
+                       return true;
+       return false;
+}
+
+
 // this is complicated, because we want to make sure that
 // everything is properly nested. the code ought to make 
 // sure of that, but we won't assert (yet) if we run into
index e214da87f0eed94e555200eed286da4a8819de40..497ffdbce019f3bbf8dfe0b316d0c701cccc0991 100644 (file)
@@ -146,6 +146,8 @@ private:
        ///
        bool isTagOpen(std::string const &) const;
        ///
+       bool isTagPending(std::string const &) const;
+       ///
        void writeError(std::string const &) const;
        ///
        odocstream & os_;