diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-06-13 13:27:59 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-06-17 09:06:48 (GMT) |
commit | b5002631c0fedc5ae747fc0450fb4285f977b512 (patch) | |
tree | 710232526ffca5126b05a255843c5495cafa4a96 /Utilities/Sphinx/create_identifiers.py | |
parent | 6b05e03de4353275d1e2e614150757397bd1f855 (diff) | |
download | CMake-b5002631c0fedc5ae747fc0450fb4285f977b512.zip CMake-b5002631c0fedc5ae747fc0450fb4285f977b512.tar.gz CMake-b5002631c0fedc5ae747fc0450fb4285f977b512.tar.bz2 |
Help: Create proper identifiers for keywords in QtHelp.
This is necessary in order for the QHelpEngineCore::linksForIdentifier API
to work.
http://doc-snapshot.qt-project.org/qt5-5.3/qhelpenginecore.html#linksForIdentifier
That API is used by QtCreator to enable contextual links to help files.
Diffstat (limited to 'Utilities/Sphinx/create_identifiers.py')
-rwxr-xr-x | Utilities/Sphinx/create_identifiers.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py new file mode 100755 index 0000000..4db7a3f --- /dev/null +++ b/Utilities/Sphinx/create_identifiers.py @@ -0,0 +1,32 @@ +#!/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: + if "<keyword name=\"command\"" in line: + if not "id=\"" in line: + prefix = "<keyword name=\"command\" " + part1, part2 = line.split(prefix) + head, tail = part2.split("#command:") + cmdname, rest = tail.split("\"") + line = part1 + prefix + "id=\"command/" + cmdname + "\" " + part2 + newlines.append(line + "\n") + +f = open(name, "w") +f.writelines(newlines) |