mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge bugfix from 0.5.
This commit is contained in:
commit
b572cf2504
8
CHANGES
8
CHANGES
@ -6,7 +6,7 @@ New features added
|
|||||||
|
|
||||||
* Configuration:
|
* Configuration:
|
||||||
|
|
||||||
- The new ``html_add_permalinks`` config value can be used to
|
- The new ``html_add_permalinks`` config value can be used to
|
||||||
switch off the generated "paragraph sign" permalinks for each
|
switch off the generated "paragraph sign" permalinks for each
|
||||||
heading and definition environment.
|
heading and definition environment.
|
||||||
|
|
||||||
@ -21,6 +21,12 @@ New features added
|
|||||||
command line.
|
command line.
|
||||||
|
|
||||||
|
|
||||||
|
Release 0.5.1 (in development)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
* Don't crash on empty index entries, only emit a warning.
|
||||||
|
|
||||||
|
|
||||||
Release 0.5 (Nov 23, 2008) -- Birthday release!
|
Release 0.5 (Nov 23, 2008) -- Birthday release!
|
||||||
===============================================
|
===============================================
|
||||||
|
|
||||||
|
@ -205,7 +205,10 @@ def index_directive(name, arguments, options, content, lineno,
|
|||||||
# shorthand notation for single entries
|
# shorthand notation for single entries
|
||||||
else:
|
else:
|
||||||
for value in entry.split(','):
|
for value in entry.split(','):
|
||||||
ne.append(('single', value.strip(), targetid, value.strip()))
|
value = value.strip()
|
||||||
|
if not value:
|
||||||
|
continue
|
||||||
|
ne.append(('single', value, targetid, value))
|
||||||
return [indexnode, targetnode]
|
return [indexnode, targetnode]
|
||||||
|
|
||||||
index_directive.arguments = (1, 0, 1)
|
index_directive.arguments = (1, 0, 1)
|
||||||
|
@ -1137,25 +1137,42 @@ class BuildEnvironment:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
for fn, entries in self.indexentries.iteritems():
|
for fn, entries in self.indexentries.iteritems():
|
||||||
# new entry types must be listed in directives.py!
|
# new entry types must be listed in directives/other.py!
|
||||||
for type, string, tid, alias in entries:
|
for type, string, tid, alias in entries:
|
||||||
if type == 'single':
|
if type == 'single':
|
||||||
try:
|
try:
|
||||||
entry, subentry = string.split(';', 1)
|
entry, subentry = string.split(';', 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
entry, subentry = string, ''
|
entry, subentry = string, ''
|
||||||
|
if not entry:
|
||||||
|
self.warn(fn, 'invalid index entry %r' % string)
|
||||||
|
continue
|
||||||
add_entry(entry.strip(), subentry.strip())
|
add_entry(entry.strip(), subentry.strip())
|
||||||
elif type == 'pair':
|
elif type == 'pair':
|
||||||
first, second = map(lambda x: x.strip(), string.split(';', 1))
|
try:
|
||||||
|
first, second = map(lambda x: x.strip(),
|
||||||
|
string.split(';', 1))
|
||||||
|
if not first or not second:
|
||||||
|
raise ValueError
|
||||||
|
except ValueError:
|
||||||
|
self.warn(fn, 'invalid pair index entry %r' % string)
|
||||||
|
continue
|
||||||
add_entry(first, second)
|
add_entry(first, second)
|
||||||
add_entry(second, first)
|
add_entry(second, first)
|
||||||
elif type == 'triple':
|
elif type == 'triple':
|
||||||
first, second, third = map(lambda x: x.strip(), string.split(';', 2))
|
try:
|
||||||
|
first, second, third = map(lambda x: x.strip(),
|
||||||
|
string.split(';', 2))
|
||||||
|
if not first or not second or not third:
|
||||||
|
raise ValueError
|
||||||
|
except ValueError:
|
||||||
|
self.warn(fn, 'invalid triple index entry %r' % string)
|
||||||
|
continue
|
||||||
add_entry(first, second+' '+third)
|
add_entry(first, second+' '+third)
|
||||||
add_entry(second, third+', '+first)
|
add_entry(second, third+', '+first)
|
||||||
add_entry(third, first+' '+second)
|
add_entry(third, first+' '+second)
|
||||||
else:
|
else:
|
||||||
self.warn(fn, "unknown index entry type %r" % type)
|
self.warn(fn, 'unknown index entry type %r' % type)
|
||||||
|
|
||||||
newlist = new.items()
|
newlist = new.items()
|
||||||
newlist.sort(key=lambda t: t[0].lower())
|
newlist.sort(key=lambda t: t[0].lower())
|
||||||
|
Loading…
Reference in New Issue
Block a user