]> git.lyx.org Git - lyx.git/commitdiff
Rename-XHTMLStream-to-XMLStream #3.
authorPavel Sanda <sanda@lyx.org>
Thu, 18 Jun 2020 13:58:48 +0000 (15:58 +0200)
committerPavel Sanda <sanda@lyx.org>
Thu, 18 Jun 2020 14:05:15 +0000 (16:05 +0200)
Fix paragraph id in xHTML output to the pre-refactoring status.
Tested on math manual (plus minus nonessential newlines).

Slightly modified patch from Thibaut Cuvelier.

src/output_xhtml.cpp
src/xml.h

index 428e6c7f72608186c6728d84a0dc4d6aa0acc4d8..3f8c0a43b1c7e484ec4fb241dea12616abfba9dd 100644 (file)
@@ -161,15 +161,18 @@ namespace {
 // convenience functions
 
 inline void openParTag(XMLStream & xs, Layout const & lay,
-                       std::string parlabel)
+                       const std::string & parlabel)
 {
-       xs << xml::ParTag(lay.htmltag(), lay.htmlattr(), parlabel);
+       string attrs = lay.htmlattr();
+       if (!parlabel.empty())
+               attrs += " id='" + parlabel + "'";
+       xs << xml::ParTag(lay.htmltag(), attrs);
 }
 
 
 void openParTag(XMLStream & xs, Layout const & lay,
                 ParagraphParameters const & params,
-                std::string parlabel)
+                const std::string & parlabel)
 {
        // FIXME Are there other things we should handle here?
        string const align = alignmentToCSS(params.align());
@@ -178,7 +181,9 @@ void openParTag(XMLStream & xs, Layout const & lay,
                return;
        }
        string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
-       xs << xml::ParTag(lay.htmltag(), attrs, parlabel);
+       if (!parlabel.empty())
+               attrs += " id='" + parlabel + "'";
+       xs << xml::ParTag(lay.htmltag(), attrs);
 }
 
 
index 45fb52f0cdaeb6bcacff7d286397df9511411ac8..b4339ba7ffaa9782aec8ff7270f6029a8f995e91 100644 (file)
--- a/src/xml.h
+++ b/src/xml.h
@@ -247,15 +247,12 @@ struct CompTag
 
 
 /// A special case of StartTag, used exclusively for tags that wrap paragraphs.
-/// parid is only used for HTML output; XML is supposed to use attr for this. TODO: REMOVE PARID.
+/// parid is only used for HTML output; XML is supposed to use attr for this.
 struct ParTag : public StartTag
 {
     ///
     explicit ParTag(std::string const & tag, const std::string & attr): StartTag(tag, from_utf8(attr)) {}
     ///
-    explicit ParTag(std::string const & tag, const std::string & attr, const std::string & parid):
-            StartTag(tag, from_utf8(attr + (parid.empty() ? (" id='" + parid + "'") : ""))) {}
-    ///
     ~ParTag() {}
 };