Commit 132491e8 authored by Michal Čihař's avatar Michal Čihař

Ignore some docbook tags for same checking

This like console logs or screens are often not translated.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 1dc2bba2
......@@ -858,6 +858,12 @@ SPLIT_RE = re.compile(
ur'[() ,.^`"\'\\/_<>!?;:|{}*^@%#&~=+\r\n✓—…\[\]0-9-])+'
)
# Docbook tags to ignore
DB_TAGS = (
'screen',
'indexterm',
'programlisting',
)
def strip_format(msg, flags):
'''
......@@ -934,6 +940,12 @@ class SameCheck(TargetCheck):
if result is not None:
return result
# Ignore some docbook tags
if unit.comment.startswith('Tag: '):
if unit.comment[5:] in DB_TAGS:
self.set_cache(unit, True, cache_slot)
return True
# Lower case source
lower_source = source.lower()
......
......@@ -64,7 +64,8 @@ class MockUnit(object):
'''
Mock unit object.
'''
def __init__(self, checksum=None, flags='', code='cs', source=''):
def __init__(self, checksum=None, flags='', code='cs', source='',
comment=''):
if checksum is None:
checksum = str(uuid.uuid1())
self.checksum = checksum
......@@ -73,6 +74,7 @@ class MockUnit(object):
self.source = source
self.fuzzy = False
self.translated = True
self.comment = comment
@property
def all_flags(self):
......
......@@ -46,6 +46,20 @@ class SameCheckTest(CheckTestCase):
0
))
def test_same_db_screen(self):
self.assertTrue(self.check.check_single(
'some long text is here',
'some long text is here',
MockUnit(code='de'),
0
))
self.assertFalse(self.check.check_single(
'some long text is here',
'some long text is here',
MockUnit(code='de', comment='Tag: screen'),
0
))
def test_same_numbers(self):
self.do_test(False, ('1:4', '1:4', ''))
self.do_test(False, ('1, 3, 10', '1, 3, 10', ''))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment