diff options
| author | Georg Brandl <georg@python.org> | 2009-09-03 18:25:54 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2009-09-03 18:25:54 +0200 |
| commit | c816d7defda99496824b8eabf66bc909e4b50f49 (patch) | |
| tree | 0f24e0fc1fad9e19af93f6ec84b0ee2a543a9919 /sphinx/util | |
| parent | adcb3f5072cf97df8329ca5f962d09d94345939c (diff) | |
| parent | 90feb78ace5ced952d80c7e14ed632521873032f (diff) | |
| download | sphinx-c816d7defda99496824b8eabf66bc909e4b50f49.tar.gz | |
merge with trunk
Diffstat (limited to 'sphinx/util')
| -rw-r--r-- | sphinx/util/__init__.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 082ca888..05e72caf 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -28,7 +28,8 @@ import sphinx # Generally useful regular expressions. ws_re = re.compile(r'\s+') -caption_ref_re = re.compile(r'^([^<]+?)\s*<(.+)>$') +explicit_title_re = re.compile('^(.+?)\s*<(.*?)>$') +caption_ref_re = explicit_title_re # b/w compat alias url_re = re.compile(r'(?P<schema>.+)://.*') # SEP separates path elements in the canonical file names @@ -437,21 +438,13 @@ def copy_static_entry(source, target, builder, context={}): shutil.copytree(source, target) + def split_explicit_title(text): """Split role content into title and target, if given.""" - brace = text.find('<') - if brace != -1: - m = caption_ref_re.match(text) - if m: - target = m.group(2) - title = m.group(1) - else: - # fallback: everything after '<' is the target - target = text[brace+1:] - title = text[:brace] - return True, title, target - else: - return False, text, text + match = explicit_title_re.match(text) + if match: + return True, m.group(1), m.group(2) + return False, text, text from docutils import nodes |
