From dedb48d482af2c7845fdd1eb407e1266708ce01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Fri, 11 Aug 2023 13:27:01 +0200 Subject: [PATCH] docs: allow comma separated list of tags in properties docs Allow to define a comma separated list of tags, like "---nmcli,keyfile,dbus---", instead of having to define separate blocks of comments for each one ("---nmcli---", "---keyfile---"), even for the same content. This can be useful to avoid repeating the same comment if 2 targets needs the same modifications to the general documentation, although this case might be rare. It will be more useful to allow using the new "expand enumvals" feature because it can't be used from gtkdoc comments. --- tools/generate-docs-nm-property-infos.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/generate-docs-nm-property-infos.py b/tools/generate-docs-nm-property-infos.py index b165fda637..e1ea995701 100755 --- a/tools/generate-docs-nm-property-infos.py +++ b/tools/generate-docs-nm-property-infos.py @@ -396,7 +396,9 @@ def process_setting(tag, root_node, source_file, setting_name): "> > tag:%s, source_file:%s, setting_name:%s" % (tag, source_file, setting_name) ) - start_tag = "---" + tag + "---" + start_tag = r"---([a-z\-]*,)*" + tag + r"(,[a-z\-]*)*---" + start_tag_re = re.compile(start_tag) + start_tag_fmt_re = re.compile(r"^ /\* " + start_tag + r"$") end_tag = "---end---" setting_node, created = xnode_get_or_create(root_node, "setting", setting_name) @@ -425,12 +427,12 @@ def process_setting(tag, root_node, source_file, setting_name): 'Invalid end tag "%s". Expects literally " */" after end-tag' % (line,), ) - elif start_tag in line: - if line != " /* " + start_tag: + elif start_tag_re.search(line): + if not start_tag_fmt_re.match(line): raise LineError( line_no, - 'Invalid start tag "%s". Expects literally " /* %s"' - % (line, start_tag), + 'Invalid start tag "%s". Expects literally " /* ---TAGS---"' + % line, ) if lines is not None: raise LineError(