diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-02-03 18:51:19 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-02-03 19:01:37 +0900 |
commit | e483e4afc33ce4e06de5ceec644c1b1e5a9db3b6 (patch) | |
tree | fe19ff43bc9d1df23ee7dd724ae38059439a5a69 | |
parent | 133ed17de621b41ab62d02bb5d7e82132f6a369c (diff) | |
download | sphinx-git-e483e4afc33ce4e06de5ceec644c1b1e5a9db3b6.tar.gz |
texinfo: remove DOTs from name if name contains other characters
-rw-r--r-- | sphinx/writers/texinfo.py | 3 | ||||
-rw-r--r-- | tests/test_build_texinfo.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index fd0c244d3..63c7d2af8 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -387,6 +387,9 @@ class TexinfoTranslator(nodes.NodeVisitor): bad_chars = ',:()' for bc in bad_chars: s = s.replace(bc, ' ') + if re.search('[^ .]', s): + # remove DOTs if name contains other characters + s = s.replace('.', ' ') s = ' '.join(s.split()).strip() return self.escape(s) diff --git a/tests/test_build_texinfo.py b/tests/test_build_texinfo.py index a1987689b..93e10d758 100644 --- a/tests/test_build_texinfo.py +++ b/tests/test_build_texinfo.py @@ -110,5 +110,5 @@ def test_texinfo_escape_id(app, status, warning): assert translator.escape_id('Hello Sphinx world') == 'Hello Sphinx world' assert translator.escape_id('Hello:world') == 'Hello world' assert translator.escape_id('Hello(world)') == 'Hello world' - assert translator.escape_id('Hello world.') == 'Hello world.' + assert translator.escape_id('Hello world.') == 'Hello world' assert translator.escape_id('.') == '.' |