mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 08:58:54 +02:00
gdbus-codegen: preserve relative indentation in doc comments
This commit also changes the generators for rst, xml and dockbook to preserve indentation. Closes #3032
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
# Author: David Zeuthen <davidz@redhat.com>
|
||||
|
||||
import re
|
||||
import textwrap
|
||||
from os import path
|
||||
|
||||
from . import utils
|
||||
@@ -340,12 +341,12 @@ class DocbookCodeGenerator:
|
||||
return s
|
||||
|
||||
def expand_paras(self, s, expandParamsAndConstants):
|
||||
s = self.expand(s, expandParamsAndConstants).strip()
|
||||
s = textwrap.dedent(self.expand(s, expandParamsAndConstants)).rstrip()
|
||||
res = []
|
||||
if not s.startswith("<para>"):
|
||||
res.append("<para>")
|
||||
for line in s.split("\n"):
|
||||
line = line.strip()
|
||||
line = line.rstrip()
|
||||
if not line:
|
||||
line = "</para><para>"
|
||||
res.append(line)
|
||||
|
Reference in New Issue
Block a user