diff options
author | Jeff Dairiki <dairiki@dairiki.org> | 2012-02-26 07:49:07 -0800 |
---|---|---|
committer | Jeff Dairiki <dairiki@dairiki.org> | 2012-02-26 07:49:07 -0800 |
commit | 081144dbed6964dd18e4252a17a9dc91430dec06 (patch) | |
tree | b1045fd030888f4ea046fdb5a6cfc71b602de43d /sphinx | |
parent | 2244cd80429fd317af1feb93a994d58512848068 (diff) | |
download | sphinx-081144dbed6964dd18e4252a17a9dc91430dec06.tar.gz |
Intersphinx: parse inventories correctly when object names contain embedded spaces.
This is an issue, e.g., for (multi-word) glossary terms.
Diffstat (limited to 'sphinx')
-rw-r--r-- | sphinx/ext/intersphinx.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index 7a1aeb40..9551e3cd 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -30,6 +30,7 @@ import codecs import urllib2 import posixpath from os import path +import re from docutils import nodes @@ -99,7 +100,12 @@ def read_inventory_v2(f, uri, join, bufsize=16*1024): assert not buf for line in split_lines(read_chunks()): - name, type, prio, location, dispname = line.rstrip().split(None, 4) + # be careful to handle names with embedded spaces correctly + m = re.match(r'(?x)(.+?)\s+(\S*:\S*)\s+(\S+)\s+(\S+)\s+(.*)', + line.rstrip()) + if not m: + continue + name, type, prio, location, dispname = m.groups() if location.endswith(u'$'): location = location[:-1] + name location = join(uri, location) |