remove unusable 'SEVERE: Duplicate ID' message for footnote that the translation node has been recognized as a duplicate.

This commit is contained in:
Takayuki Shimizukawa 2013-02-04 23:06:44 +09:00
parent c1c0a03895
commit d6f31f3fa1
2 changed files with 8 additions and 1 deletions

View File

@ -262,6 +262,8 @@ class Locale(Transform):
'translated message', node)
for old, new in zip(old_foot_refs, new_foot_refs):
new['ids'] = old['ids']
for id in new['ids']:
self.document.ids[id] = new
self.document.autofootnote_refs.remove(old)
self.document.note_autofootnote_ref(new)

View File

@ -114,9 +114,10 @@ def test_i18n_footnote_break_refid(app):
# expect no error by build
@with_intl_app(buildername='text', cleanenv=True)
@with_intl_app(buildername='text', warning=warnfile)
def test_i18n_footnote_regression(app):
"""regression test for fix #955"""
app.builddir.rmtree(True)
app.builder.build(['footnote'])
result = (app.outdir / 'footnote.txt').text(encoding='utf-8')
expect = (u"\nI18N WITH FOOTNOTE"
@ -127,6 +128,10 @@ def test_i18n_footnote_regression(app):
u"\n[100] THIS IS A NUMBERED FOOTNOTE.\n")
assert result == expect
warnings = warnfile.getvalue().replace(os.sep, '/')
warning_expr = u'.*/footnote.txt:\\d*: SEVERE: Duplicate ID: ".*".\n'
assert not re.search(warning_expr, warnings)
@with_intl_app(buildername='html', cleanenv=True)
def test_i18n_footnote_backlink(app):