diff options
author | Brad King <brad.king@kitware.com> | 2014-12-04 14:59:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-12-04 15:03:26 (GMT) |
commit | 607b39dc1192a9e0f7eae66f9979c399e5126337 (patch) | |
tree | bcad80c1608154918b90ac4f0923855eb4d52e8f /Utilities | |
parent | 5cda220548b82010b9f2fc9f177e808b6151a162 (diff) | |
download | CMake-607b39dc1192a9e0f7eae66f9979c399e5126337.zip CMake-607b39dc1192a9e0f7eae66f9979c399e5126337.tar.gz CMake-607b39dc1192a9e0f7eae66f9979c399e5126337.tar.bz2 |
Utilities/Sphinx: Fix link targets for mixed-case command names
When a CMake domain 'command' object is defined by CMakeTransform or the
'cmake:command' directive, generate the link target with a lower-case
name even if the command name is not all lower-case. This is needed to
make cross-references to the command definition work since the
'cmake:command' role is marked with the 'lowercase' property.
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/Sphinx/cmake.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index e20679a..5c0406d 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -201,7 +201,11 @@ class CMakeTransform(Transform): if make_index_entry: title = self.parse_title(env.docname) # Insert the object link target. - targetid = '%s:%s' % (objtype, title) + if objtype == 'command': + targetname = title.lower() + else: + targetname = title + targetid = '%s:%s' % (objtype, targetname) targetnode = nodes.target('', '', ids=[targetid]) self.document.note_explicit_target(targetnode) self.document.insert(0, targetnode) @@ -220,7 +224,11 @@ class CMakeObject(ObjectDescription): return sig def add_target_and_index(self, name, sig, signode): - targetid = '%s:%s' % (self.objtype, name) + if self.objtype == 'command': + targetname = name.lower() + else: + targetname = name + targetid = '%s:%s' % (self.objtype, targetname) if targetid not in self.state.document.ids: signode['names'].append(targetid) signode['ids'].append(targetid) |