texinfo: remove DOTs from name if name contains other characters

This commit is contained in:
Takeshi KOMIYA 2019-02-03 18:51:19 +09:00
parent 133ed17de6
commit e483e4afc3
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -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('.') == '.'