Skip to content

Commit

Permalink
fix data-original-title
Browse files Browse the repository at this point in the history
fixes #17
  • Loading branch information
Rory McCann committed Nov 30, 2014
1 parent 09c37de commit 6427988
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django_template_i18n_lint.py
Expand Up @@ -58,7 +58,8 @@ def location(str, pos):
|(?:['"]\W+)?[a-z:-]+?(?<!alt)(?<!value)(?<!title)(?<!summary)=(?:'[^']*?'|"[^"]*?"|[a-zA-Z]+)
# The actual alt/value/title tag itself cannot be translated, but the value should be
|(?:alt|value|title|summary)=['"]?
# Treat data-title/data-original-title etc as equivalanets. Think this is some bootstrap thing & HTML5
|(?:['"]\W+)?(?:data-|data-original-)?(?:alt|value|title|summary)=['"]?
# Boolean attributes
|<[^<>]+?(?:checked|selected|disabled|readonly|multiple|ismap|defer|async|declare|noresize|nowrap|noshade|compact|hidden|itemscope|autofocus|autoplay|controls|download)[^<>]*?>
Expand All @@ -67,7 +68,8 @@ def location(str, pos):
|<[\w:]+
# End of a html opening tag
|/?>
# NB: catching end of quote from last attribute
|(?:['"]\W*)?/?>
# closing html tag
|</.*?>
Expand Down
1 change: 1 addition & 0 deletions tests.py
Expand Up @@ -40,6 +40,7 @@ class DjangoTemplateI18nLintTestCase(unittest.TestCase):
testNoHTMLAttrNoQuote2 = _known_good_output("<form method=post>FOO</form>", [(1, 19, 'FOO')])

testIssue17a = _known_good_output("<input type=\"submit\" value=\"Confirm\" class=\"btn btn-danger\" />", [(1, 29, 'Confirm')])
testIssue17b = _known_good_output('<li><a href="https://twitter.com/localunews" class="icon-twitter" rel="tooltip" title="" data-placement="top" data-original-title="Twitter"><i class="fa fa-twitter"></i></a></li>', [(1, 132, 'Twitter')])


if __name__ == '__main__':
Expand Down

0 comments on commit 6427988

Please sign in to comment.