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:
André
2023-08-14 23:31:05 -03:00
parent 006e102e04
commit 9a6ca0ef75
5 changed files with 56 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ import os
import re
from . import utils
import textwrap
# Disable line length warnings as wrapping the templates would be hard
# flake8: noqa: E501
@@ -22,8 +23,8 @@ class MdCodeGenerator:
def _expand(self, s, expandParamsAndConstants):
"""Expands parameters and constant literals."""
res = []
for line in s.split("\n"):
line = line.strip()
for line in textwrap.dedent(s).split("\n"):
line = line.rstrip()
if line == "":
res.append("")
continue