[glib/ebassi/gdbus-codegen-rst: 1/3] codegen: Do not add extra paragraph elements while parsing




commit f30e606bde0837c4a57e06c7646a5b62e6b880ab
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Jan 20 15:15:49 2022 +0000

    codegen: Do not add extra paragraph elements while parsing
    
    When parsing a comment we're adding <para> elements ourselves, but the
    DocBook generator already wraps any block of text that does not start
    with a <para> element with one.

 gio/gdbus-2.0/codegen/parser.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/parser.py b/gio/gdbus-2.0/codegen/parser.py
index 45226d540..02bd47e87 100644
--- a/gio/gdbus-2.0/codegen/parser.py
+++ b/gio/gdbus-2.0/codegen/parser.py
@@ -85,7 +85,7 @@ class DBusXMLParser:
                         symbol = line[0:colon_index]
                         rest_of_line = line[colon_index + 2 :].strip()
                         if len(rest_of_line) > 0:
-                            body += "<para>" + rest_of_line + "</para>"
+                            body += rest_of_line
                         comment_state = DBusXMLParser.COMMENT_STATE_PARAMS
             elif comment_state == DBusXMLParser.COMMENT_STATE_PARAMS:
                 if line.startswith("@"):
@@ -93,7 +93,7 @@ class DBusXMLParser:
                     if colon_index == -1:
                         comment_state = DBusXMLParser.COMMENT_STATE_BODY
                         if not in_para:
-                            body += "<para>"
+                            body += "\n"
                             in_para = True
                         body += orig_line + "\n"
                     else:
@@ -104,21 +104,21 @@ class DBusXMLParser:
                     comment_state = DBusXMLParser.COMMENT_STATE_BODY
                     if len(line) > 0:
                         if not in_para:
-                            body += "<para>"
+                            body += "\n"
                             in_para = True
                         body += orig_line + "\n"
             elif comment_state == DBusXMLParser.COMMENT_STATE_BODY:
                 if len(line) > 0:
                     if not in_para:
-                        body += "<para>"
+                        body += "\n"
                         in_para = True
                     body += orig_line + "\n"
                 else:
                     if in_para:
-                        body += "</para>"
+                        body += "\n"
                         in_para = False
         if in_para:
-            body += "</para>"
+            body += "\n"
 
         if symbol != "":
             self.doc_comment_last_symbol = symbol


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]