From 1f94ac4bcecf64444db04bf52687fade8c03c500 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 24 Aug 2020 15:30:15 -0700 Subject: [PATCH] doc: wikiparser: Handle more paragraph breakers Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- doc/scripts/wikiparser.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/scripts/wikiparser.py b/doc/scripts/wikiparser.py index 95ec1086f..f3314a368 100644 --- a/doc/scripts/wikiparser.py +++ b/doc/scripts/wikiparser.py @@ -1017,6 +1017,9 @@ digits with zero to find your home network, like so: XXX.XXX.XXX.0/24') ip/netmask with the one the router uses)'), Paragraph([PlainText('In \ most cases you can look at your current IP address, and change the last \ digits with zero to find your home network, like so: XXX.XXX.XXX.0/24')])] + >>> parse_wiki('text to introduce \\n----\\n<>') + [Paragraph([PlainText('text to introduce')]), \ +HorizontalRule(4), TableOfContents()] >>> parse_wiki(' If this command shows an error such as ''new key but \ contains no user ID - skipped'', then use a different keyserver to download \ @@ -1402,8 +1405,12 @@ PlainText('dialog.')])])])] if end_marker and lines[0].strip().startswith(end_marker): break - # start of multi-line CodeText - if lines[0].strip().startswith('{{{'): + # If any of the syntax that ends a paragraph + paragraph_breakers = ['{{{', '##', '----', '||'] + if any([ + True for breaker in paragraph_breakers + if lines[0].strip().startswith(breaker) + ]): break if re.match(r'\s+(\*|\.|\d\.|I\.|A\.)\s+.*', lines[0]):