- if (html::isFontTag(it->tag_)) {
- writeError("Font tag `" + it->tag_ + "' still open in closeFontTags().");
- noFontTags = false;
+ string const tagname = it->tag_;
+ if (tagname == parsep_tag)
+ break;
+ writeError(it->tag_);
+ }
+ return false;
+}
+
+
+void XHTMLStream::startParagraph(bool keep_empty)
+{
+ pending_tags_.push_back(html::StartTag(parsep_tag));
+ if (keep_empty)
+ clearTagDeque();
+}
+
+
+void XHTMLStream::endParagraph()
+{
+ if (isTagPending(parsep_tag)) {
+ // this case is normal. it just means we didn't have content,
+ // so the parsep_tag never got moved onto the tag stack.
+ while (!pending_tags_.empty()) {
+ // clear all pending tags up to and including the parsep tag.
+ // note that we work from the back, because we want to get rid
+ // of everything that hasn't been used.
+ html::StartTag const cur_tag = pending_tags_.back();
+ string const & tag = cur_tag.tag_;
+ pending_tags_.pop_back();
+ if (tag == parsep_tag)
+ break;