diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-09-13 09:37:24 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-09-21 11:23:42 +0000 |
commit | 0fcb6ce41ddb2b3fcb4aa1a25f179e3e338f4805 (patch) | |
tree | cc1cba14fddd2c9a50422d11a9005cf8b152a2a6 | |
parent | c4f1f65208b072fbd06af42682681d1fcdc042ef (diff) |
Documentation/patch_qhp.py: Strip the module from the index
This makes the index actually useable since it is then
possible to find a class by starting to type the name.
The downside is that there is a conflict with the Qt names
if the C++ documentation is installed, too.
Change-Id: I231a90025b2777fe8ff23fcc9dd669722dcd922e
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit fa38984e53a7a325fd317822f75551379763b810)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/doc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sources/shiboken6/doc/scripts/patch_qhp.py | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/sources/pyside6/doc/CMakeLists.txt b/sources/pyside6/doc/CMakeLists.txt index 93c4b995a..c8f21b23a 100644 --- a/sources/pyside6/doc/CMakeLists.txt +++ b/sources/pyside6/doc/CMakeLists.txt @@ -215,7 +215,7 @@ else() set(PATCH_QHP_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../../shiboken6/doc/scripts/patch_qhp.py") file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/html/PySide.qhp QHP_FILE) add_custom_command(TARGET apidoc POST_BUILD - COMMAND ${python_executable} ${PATCH_QHP_SCRIPT} -v pyside6 ${QHP_FILE} + COMMAND ${python_executable} ${PATCH_QHP_SCRIPT} -p -v pyside6 ${QHP_FILE} COMMAND "${qhelpgenerator_binary}" ${QHP_FILE} COMMENT "Generating QCH from a QHP file..." VERBATIM diff --git a/sources/shiboken6/doc/scripts/patch_qhp.py b/sources/shiboken6/doc/scripts/patch_qhp.py index 9c7c875ae..586c8d1fe 100644 --- a/sources/shiboken6/doc/scripts/patch_qhp.py +++ b/sources/shiboken6/doc/scripts/patch_qhp.py @@ -50,9 +50,13 @@ registering the documentation in Qt Assistant.""" VIRTUAL_FOLDER_PATTERN = re.compile("(^.*virtualFolder.)doc(.*$)") +# Strip "PySide6.QtModule." from index entries +INDEX_CLASS_PATTERN = re.compile(r'^(\s*<keyword name=")PySide6\.[^.]+\.(.*\(class in .*)$') +INDEX_METHOD_PATTERN = re.compile(r'^(\s+<keyword name=".* \()PySide6\.[^.]+\.(.*>)$') virtual_folder = "" +strip_pyside_module = False def process_line(line): @@ -61,6 +65,15 @@ def process_line(line): if match: print(f"{match.group(1)}{virtual_folder}{match.group(2)}") return + if strip_pyside_module: + match = INDEX_METHOD_PATTERN.match(line) + if match: + print(f"{match.group(1)}{match.group(2)}") + return + match = INDEX_CLASS_PATTERN.match(line) + if match: + print(f"{match.group(1)}{match.group(2)}") + return sys.stdout.write(line) @@ -69,9 +82,12 @@ if __name__ == '__main__': formatter_class=RawTextHelpFormatter) arg_parser.add_argument('-v', '--vfolder', type=str, help='String to be injected into the Qhp file.') + arg_parser.add_argument("--pyside", "-p", action="store_true", + help="Strip the PySide module path off the index entries.") arg_parser.add_argument("file", type=str, help='Qhp filename.') options = arg_parser.parse_args() virtual_folder = options.vfolder + strip_pyside_module = options.pyside try: with fileinput.input(options.file, inplace=True, |