CMake/Utilities/Sphinx/create_identifiers.py
Kyle Edwards 2a2829cc75 Help: Add new section for CPack generators
The documentation for CPack generators previously lived in their
respective internal CMake modules. This setup was misleading,
because it implied that you should include the modules in your own
code, which is not the case. Moving the documentation into a
separate section does a better job of hiding the internal modules,
which are just an implementation detail. The generator documentation
has also been modified to remove any references to the module name.

The CPackIFW module is a special exception: since it has user-facing
macros, the documentation for these macros has been kept in the module
page, while all other documentation related to the IFW generator has
been moved into the new section.

To make it easier to find the new documentation, the old help pages
for the CPack*.cmake modules have not been deleted, but have been
replaced with a link to their respective help page in the new
documentation section.
2018-06-21 11:00:25 -04:00

50 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python
import sys, os
if len(sys.argv) != 2:
sys.exit(-1)
name = sys.argv[1] + "/CMake.qhp"
f = open(name)
if not f:
sys.exit(-1)
lines = f.read().splitlines()
if not lines:
sys.exit(-1)
newlines = []
for line in lines:
mapping = (("command", "command"),
("cpack generator", "cpack_gen"),
("envvar", "envvar"),
("variable", "variable"),
("generator", "generator"),
("target property", "prop_tgt"),
("test property", "prop_test"),
("source file property", "prop_sf"),
("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 and not "#index-" 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")
f = open(name, "w")
f.writelines(newlines)