diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-09-13 09:37:24 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-09-21 11:53:31 +0200 |
| commit | fa38984e53a7a325fd317822f75551379763b810 (patch) | |
| tree | 67f6e1499358c98ccdc2a8ee8d78ee0fd85fa9e9 /sources/shiboken6/doc/scripts/patch_qhp.py | |
| parent | d08c6871fe238d1a1f09c70ece2ddcd373ba13ca (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.
Pick-to: 6.3
Change-Id: I231a90025b2777fe8ff23fcc9dd669722dcd922e
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/doc/scripts/patch_qhp.py')
| -rw-r--r-- | sources/shiboken6/doc/scripts/patch_qhp.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sources/shiboken6/doc/scripts/patch_qhp.py b/sources/shiboken6/doc/scripts/patch_qhp.py index 1f86162a9..750789698 100644 --- a/sources/shiboken6/doc/scripts/patch_qhp.py +++ b/sources/shiboken6/doc/scripts/patch_qhp.py @@ -14,9 +14,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): @@ -25,6 +29,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) @@ -33,9 +46,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, |
