Fix #2397: Setup shorthandoff for turkish documents

This commit is contained in:
Takeshi KOMIYA committed 2016-04-16 18:28:15 +09:00
1 parent febfd6829c
commit c289a35c1b
3 files changed
+30

No files matched your search

+3
View File
@@ -13,6 +13,9 @@ Bugs fixed
* #1817, #2077: suppress pep8 warnings on conf.py generated by sphinx-quickstart
* #2407: building docs crash if document includes large data image URIs
* #2436: Sphinx does not check version by :confval:`needs_sphinx` if loading extensions failed
* #2397: Setup shorthandoff for turkish documents
Problems with pdflatex in a Turkish document built with sphinx #2397
Release 1.4.1 (released Apr 12, 2016)
+2
View File
@@ -127,6 +127,8 @@ class ExtBabel(Babel):
'es', 'spanish', 'nl', 'dutch', 'pl', 'polish', 'it',
'italian'):
return '\\shorthandoff{"}'
elif shortlang in ('tr', 'turkish'):
return '\\shorthandoff{=}'
return ''
def uses_cyrillic(self):
+25
View File
@@ -271,6 +271,7 @@ def test_babel_with_no_language_settings(app, status, warning):
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Fig. }}\n' in result
assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Table. }}\n' in result
assert '\\addto\\extrasenglish{\\def\\pageautorefname{page}}\n' in result
assert '\\shorthandoff' not in result
@with_app(buildername='latex', testroot='latex-babel',
@@ -290,6 +291,7 @@ def test_babel_with_language_de(app, status, warning):
assert '\\addto\\captionsngerman{\\renewcommand{\\figurename}{Fig. }}\n' in result
assert '\\addto\\captionsngerman{\\renewcommand{\\tablename}{Table. }}\n' in result
assert '\\addto\\extrasngerman{\\def\\pageautorefname{page}}\n' in result
assert '\\shorthandoff{"}' in result
@with_app(buildername='latex', testroot='latex-babel',
@@ -309,6 +311,27 @@ def test_babel_with_language_ru(app, status, warning):
assert '\\addto\\captionsrussian{\\renewcommand{\\figurename}{Fig. }}\n' in result
assert '\\addto\\captionsrussian{\\renewcommand{\\tablename}{Table. }}\n' in result
assert '\\addto\\extrasrussian{\\def\\pageautorefname{page}}\n' in result
assert '\\shorthandoff' not in result
@with_app(buildername='latex', testroot='latex-babel',
confoverrides={'language': 'tr'})
def test_babel_with_language_tr(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'Python.tex').text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
assert '\\documentclass[letterpaper,10pt,turkish]{sphinxmanual}' in result
assert '\\usepackage{babel}' in result
assert '\\usepackage{times}' in result
assert '\\usepackage[Sonny]{fncychap}' in result
assert ('\\addto\\captionsturkish{\\renewcommand{\\contentsname}{Table of content}}\n'
in result)
assert '\\addto\\captionsturkish{\\renewcommand{\\figurename}{Fig. }}\n' in result
assert '\\addto\\captionsturkish{\\renewcommand{\\tablename}{Table. }}\n' in result
assert '\\addto\\extrasturkish{\\def\\pageautorefname{sayfa}}\n' in result
assert '\\shorthandoff{=}' in result
@with_app(buildername='latex', testroot='latex-babel',
@@ -327,6 +350,7 @@ def test_babel_with_language_ja(app, status, warning):
assert '\\renewcommand{\\figurename}{Fig. }\n' in result
assert '\\renewcommand{\\tablename}{Table. }\n' in result
assert u'\\def\\pageautorefname{ページ}\n' in result
assert '\\shorthandoff' not in result
@with_app(buildername='latex', testroot='latex-babel',
@@ -346,6 +370,7 @@ def test_babel_with_unknown_language(app, status, warning):
assert '\\addto\\captionsenglish{\\renewcommand{\\figurename}{Fig. }}\n' in result
assert '\\addto\\captionsenglish{\\renewcommand{\\tablename}{Table. }}\n' in result
assert '\\addto\\extrasenglish{\\def\\pageautorefname{page}}\n' in result
assert '\\shorthandoff' not in result
assert "WARNING: no Babel option known for language 'unknown'" in warning.getvalue()