From 201a8d29cdb2f856f7f889f9a75d3a463e3491ef Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Fri, 18 Dec 2020 10:27:52 -0300 Subject: [PATCH] doc: scripts: fix parsing directive inside literal This expands the current directive matching regex in the extract_content script to also allow "`" as an ending character along with spaces; it fixes issues when directives are added inside a literal ("``"), when they are used as examples that are not to be interpreted by the docutils state-machine, but are "accepted" by extract_content. Technically this is not correct, a directive must always end in space-like characters, but a proper parser knows that it is inside a literal and accept the contents without interpretation; short of implementing a proper rST parser this "band-aid" fix should work with no side-effects. Signed-off-by: Fabio Utzig --- doc/scripts/extract_content.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/scripts/extract_content.py b/doc/scripts/extract_content.py index d638e8a987f..73611bcf58c 100755 --- a/doc/scripts/extract_content.py +++ b/doc/scripts/extract_content.py @@ -83,7 +83,7 @@ def src_deps(zephyr_base, src_file, dest, src_root): # argument, which is a (relative) path to the additional # dependency file. directives = "|".join(DIRECTIVES) - pattern = re.compile(r"\.\.\s+(?P%s)::\s+(?P[^\s]+)" % + pattern = re.compile(r"\.\.\s+(?P%s)::\s+(?P[^\s`]+)" % directives) deps = [] for m in pattern.finditer(content):