Merge topic 'qthelp-context-fixes'
d107949d Help: Add context to titles in QtHelp. b5002631 Help: Create proper identifiers for keywords in QtHelp.
This commit is contained in:
commit
fc6fdc9b0b
@ -88,6 +88,11 @@ if(SPHINX_QTHELP)
|
|||||||
COMMAND ${CMAKE_COMMAND} "-DQTHELP_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/"
|
COMMAND ${CMAKE_COMMAND} "-DQTHELP_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/"
|
||||||
"-DCMake_VERSION=${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}"
|
"-DCMake_VERSION=${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}"
|
||||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/fixup_qthelp_names.cmake"
|
-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
|
COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
32
Utilities/Sphinx/create_identifiers.py
Executable file
32
Utilities/Sphinx/create_identifiers.py
Executable file
@ -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)
|
@ -11,3 +11,9 @@
|
|||||||
<a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }}
|
<a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }}
|
||||||
</li>
|
</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{# Put some context in the html title element. Workaround for #}
|
||||||
|
{# https://bitbucket.org/birkenfeld/sphinx/issue/1492/qthelp-generate-html-title-element-should #}
|
||||||
|
{% block htmltitle %}
|
||||||
|
<title>{{ title|striptags|e }} {{ "—"|safe }} {{ docstitle|e }}</title>
|
||||||
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user