From 6c8c6758d99831da6117001c8b1f0888846c9597 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 26 Aug 2020 21:07:25 -0700 Subject: [PATCH] doc: wikiparser: Format text inside admonitions properly Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- doc/scripts/wikiparser.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/scripts/wikiparser.py b/doc/scripts/wikiparser.py index ffceef246..eae4831e3 100644 --- a/doc/scripts/wikiparser.py +++ b/doc/scripts/wikiparser.py @@ -878,21 +878,16 @@ def parse_multiline_wiki_admonition(starting_line, pending_lines, context): if starting_line.strip().startswith('{{{') and '}}}' not in starting_line: admonition = re.match(r'{{{#!wiki\s(.*)', starting_line) if admonition: - content = [] - paragraph = Paragraph([]) - br = '<
>' + lines = [] while pending_lines: line = pending_lines.pop(0) if line == '}}}': break - paragraph.add_content(parse_text(line.rstrip(br), context)) - if br in line: - content.append(paragraph) - paragraph = Paragraph([]) + lines.append(line) style = admonition.group(1) - content.append(paragraph) + content = parse_wiki('\n'.join(lines), context) return Admonition(style, content), pending_lines return None, pending_lines @@ -1057,7 +1052,7 @@ from="## BEGIN_INCLUDE", to="## END_INCLUDE")>>') [CodeText('nmcli connection')] >>> parse_wiki("{{{#!wiki caution\\nDon't overuse admonitions\\n}}}") [Admonition('caution', [Paragraph(\ -[PlainText("Don't overuse admonitions")])])] +[PlainText("Don't overuse admonitions ")])])] >>> parse_wiki('a\\n\\n## END_INCLUDE\\n\\nb', \ None, None, '## END_INCLUDE') @@ -1077,7 +1072,7 @@ typing https://myfreedombox.rocks/plinth/ into the browser. <
>\\n\ as the home page, you can only navigate to the FreedomBox Service (Plinth) by \ typing '), Url('https://myfreedombox.rocks/plinth/'), PlainText(' into the \ browser. ')]), Paragraph([PlainText('/freedombox can also be used as an alias \ -to /plinth')])])] +to /plinth ')])])] >>> parse_wiki('{{{\\nmulti-line\\n\ preformatted text (source code)\\n}}}''')