Help: Identify more artifact types in QtHelp documentation.

Add identifiers for variables, properties, policies and modules.
This will allow QtCreator to show relevant documentation if it learns
more about the context of the contents of cmake files.
This commit is contained in:
Stephen Kelly 2014-06-18 17:12:53 +02:00
parent e411b30842
commit 376ba93588
1 changed files with 21 additions and 7 deletions

View File

@ -19,13 +19,27 @@ if not lines:
newlines = [] newlines = []
for line in lines: for line in lines:
if "<keyword name=\"command\"" in line:
if not "id=\"" in line: mapping = (("command", "command"),
prefix = "<keyword name=\"command\" " ("variable", "variable"),
part1, part2 = line.split(prefix) ("target property", "prop_tgt"),
head, tail = part2.split("#command:") ("test property", "prop_test"),
cmdname, rest = tail.split("\"") ("source file property", "prop_sf"),
line = part1 + prefix + "id=\"command/" + cmdname + "\" " + part2 ("global property", "prop_gbl"),
("module", "module"),
("directory property", "prop_dir"),
("cache property", "prop_cache"),
("policy", "policy"),
("installed file property", "prop_inst"))
for domain_object_string, domain_object_type in mapping:
if "<keyword name=\"" + domain_object_string + "\"" in line:
if not "id=\"" in line:
prefix = "<keyword name=\"" + domain_object_string + "\" "
part1, part2 = line.split(prefix)
head, tail = part2.split("#" + domain_object_type + ":")
domain_object, rest = tail.split("\"")
line = part1 + prefix + "id=\"" + domain_object_type + "/" + domain_object + "\" " + part2
newlines.append(line + "\n") newlines.append(line + "\n")
f = open(name, "w") f = open(name, "w")