diff options
author | Nícolas F. R. A. Prado <nfraprado@protonmail.com> | 2020-10-13 23:13:17 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-10-15 07:49:38 +0200 |
commit | f66e47f98c1e827a85654a8cfa1ba539bb381a1b (patch) | |
tree | c53095ea23d2ecb9007b4f3cdbfa60e7f54c576d | |
parent | 06dc65b0fa6130aae73927399269bdea1b7658d8 (diff) | |
download | linux-f66e47f98c1e827a85654a8cfa1ba539bb381a1b.tar.bz2 |
docs: automarkup.py: Fix regexes to solve sphinx 3 warnings
With the transition to Sphinx 3, new warnings were generated by
automarkup, exposing bugs in the regexes.
The warnings were caused by the expressions matching words in the
translated versions of the documentation, since any unicode character
was matched.
Fix the regular expression by making the C regexes use ASCII and
ensuring the expressions only match the beginning of words,
in order to avoid warnings like this:
WARNING: Unparseable C cross-reference: '调用debugfs_rename'
That's probably due to the lack of using spaces between words
on Chinese.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | Documentation/sphinx/automarkup.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/automarkup.py index db13fb15cedc..43dd9025fc77 100644 --- a/Documentation/sphinx/automarkup.py +++ b/Documentation/sphinx/automarkup.py @@ -22,12 +22,13 @@ from itertools import chain # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last # bit tries to restrict matches to things that won't create trouble. # -RE_function = re.compile(r'(([\w_][\w\d_]+)\(\))') +RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII) # # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef # -RE_generic_type = re.compile(r'(struct|union|enum|typedef)\s+([\w_][\w\d_]+)') +RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)', + flags=re.ASCII) # # Sphinx 3 uses a different C role for each one of struct, union, enum and @@ -42,7 +43,7 @@ RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=re.ASCII) # Detects a reference to a documentation page of the form Documentation/... with # an optional extension # -RE_doc = re.compile(r'Documentation(/[\w\-_/]+)(\.\w+)*') +RE_doc = re.compile(r'\bDocumentation(/[\w\-_/]+)(\.\w+)*') # # Many places in the docs refer to common system calls. It is |