summaryrefslogtreecommitdiffstats
path: root/Utilities/Sphinx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-30 14:25:27 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-30 14:25:27 (GMT)
commit4abe0ec21191c14748075259f085a4e05895f6bc (patch)
tree7e5b35c2cb30fca1c4a1bc31d69e390857d0bd9e /Utilities/Sphinx
parentfdffb6a090083b5b9446fab236a4e6e5a21123a9 (diff)
parentf88332f5b7e325d9ee6d43b54aa3dc8f78b2dc72 (diff)
downloadCMake-4abe0ec21191c14748075259f085a4e05895f6bc.zip
CMake-4abe0ec21191c14748075259f085a4e05895f6bc.tar.gz
CMake-4abe0ec21191c14748075259f085a4e05895f6bc.tar.bz2
Merge topic 'doc-conf-auto-manuals'
f88332f Help: Glob manual/*.rst in Sphinx configuration
Diffstat (limited to 'Utilities/Sphinx')
-rw-r--r--Utilities/Sphinx/CMakeLists.txt1
-rw-r--r--Utilities/Sphinx/conf.py.in39
2 files changed, 25 insertions, 15 deletions
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index e65bcd0..35c62fb 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -36,6 +36,7 @@ elseif(NOT SPHINX_EXECUTABLE)
message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!")
endif()
+set(conf_docs "${CMake_SOURCE_DIR}/Help")
set(conf_path "${CMAKE_CURRENT_SOURCE_DIR}")
set(conf_copyright "2000-2013 Kitware, Inc.")
set(conf_version "${CMake_MAJOR_VERSION}.${CMake_MINOR_VERSION}.${CMake_PATCH_VERSION}")
diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in
index 5dbdede..ea00b78 100644
--- a/Utilities/Sphinx/conf.py.in
+++ b/Utilities/Sphinx/conf.py.in
@@ -10,6 +10,9 @@
# See the License for more information.
#=============================================================================
import sys
+import os
+import re
+import glob
sys.path.insert(0, r'@conf_path@')
@@ -27,21 +30,27 @@ exclude_patterns = []
extensions = ['cmake']
-man_pages = [
- ('manual/cmake.1', 'cmake', 'CMake Command-Line Reference', [], 1),
- ('manual/ccmake.1', 'ccmake', 'CMake Curses Dialog Command-Line Reference', [], 1),
- ('manual/cmake-gui.1', 'cmake-gui', 'CMake GUI Command-Line Reference', [], 1),
- ('manual/cpack.1', 'cpack', 'CPack Command-Line Reference', [], 1),
- ('manual/ctest.1', 'ctest', 'CTest Command-Line Reference', [], 1),
- ('manual/cmake-commands.7', 'cmake-commands', 'CMake Language Command Reference', [], 7),
- ('manual/cmake-generators.7', 'cmake-generators', 'CMake Generators Reference', [], 7),
- ('manual/cmake-modules.7', 'cmake-modules', 'CMake Modules Reference', [], 7),
- ('manual/cmake-policies.7', 'cmake-policies', 'CMake Policies Reference', [], 7),
- ('manual/cmake-properties.7', 'cmake-properties', 'CMake Properties Reference', [], 7),
- ('manual/cmake-variables.7', 'cmake-variables', 'CMake Variables Reference', [], 7),
- ('manual/cmake-generator-expressions.7', 'cmake-generator-expressions', 'CMake Generator Expressions', [], 7),
- ('manual/cmake-developer.7', 'cmake-developer', 'CMake Developer Reference', [], 7),
-]
+cmake_manuals = sorted(glob.glob(r'@conf_docs@/manual/*.rst'))
+cmake_manual_description = re.compile('^\.\. cmake-manual-description:(.*)$')
+man_pages = []
+for fpath in cmake_manuals:
+ try:
+ name, sec, rst = os.path.basename(fpath).split('.')
+ desc = None
+ f = open(fpath, 'r')
+ for l in f:
+ m = cmake_manual_description.match(l)
+ if m:
+ desc = m.group(1).strip()
+ break
+ f.close()
+ if desc:
+ man_pages.append(('manual/%s.%s' % (name, sec),
+ name, desc, [], int(sec)))
+ else:
+ sys.stderr.write("ERROR: No cmake-manual-description in '%s'\n" % fpath)
+ except Exception, e:
+ sys.stderr.write("ERROR: %s\n" % str(e))
man_show_urls = False
html_show_sourcelink = True