From b5002631c0fedc5ae747fc0450fb4285f977b512 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 13 Jun 2014 15:27:59 +0200 Subject: [PATCH] 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. --- Utilities/Sphinx/CMakeLists.txt | 5 ++++ Utilities/Sphinx/create_identifiers.py | 32 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 Utilities/Sphinx/create_identifiers.py diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 951f7abb5..fd8cda90b 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -88,6 +88,11 @@ if(SPHINX_QTHELP) COMMAND ${CMAKE_COMMAND} "-DQTHELP_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/" "-DCMake_VERSION=${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}" -P "${CMAKE_CURRENT_SOURCE_DIR}/fixup_qthelp_names.cmake" + + # Create proper identifiers. Workaround for + # https://bitbucket.org/birkenfeld/sphinx/issue/1491/qthelp-should-generate-identifiers-for + COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/create_identifiers.py" "${CMAKE_CURRENT_BINARY_DIR}/qthelp/" + COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp ) endif() diff --git a/Utilities/Sphinx/create_identifiers.py b/Utilities/Sphinx/create_identifiers.py new file mode 100755 index 000000000..4db7a3f68 --- /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 "