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.
This commit is contained in:
Íñigo Huguet 2023-08-11 13:27:01 +02:00
parent 87df1130bd
commit dedb48d482

View file

@ -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(