Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
178f8834
Commit
178f8834
authored
Feb 15, 2016
by
Philipp Wolfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AngularJS check: Implemented check_highlight
parent
33fca50f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
weblate/trans/checks/angularjs.py
weblate/trans/checks/angularjs.py
+9
-0
weblate/trans/tests/test_angularjs_checks.py
weblate/trans/tests/test_angularjs_checks.py
+16
-0
No files found.
weblate/trans/checks/angularjs.py
View file @
178f8834
...
@@ -65,3 +65,12 @@ class AngularJSInterpolationCheck(TargetCheck):
...
@@ -65,3 +65,12 @@ class AngularJSInterpolationCheck(TargetCheck):
tgt_tags = set([re.sub(WHITESPACE, '', x) for x in tgt_match])
tgt_tags = set([re.sub(WHITESPACE, '', x) for x in tgt_match])
return src_tags != tgt_tags
return src_tags != tgt_tags
def check_highlight(self, source, unit):
if self.should_skip(unit):
return []
ret = []
match_objects = ANGULARJS_INTERPOLATION_MATCH.finditer(source)
for match in match_objects:
ret.append((match.start(), match.end(), match.group()))
return ret
weblate/trans/tests/test_angularjs_checks.py
View file @
178f8834
...
@@ -75,3 +75,19 @@ class AngularJSInterpolationCheckTest(TestCase):
...
@@ -75,3 +75,19 @@ class AngularJSInterpolationCheckTest(TestCase):
u'{{nameerror}} string'
,
u'{{nameerror}} string'
,
MockUnit
(
'angularjs_wrong_value'
,
flags
=
'angularjs-format'
)
MockUnit
(
'angularjs_wrong_value'
,
flags
=
'angularjs-format'
)
))
))
def
test_check_highlight
(
self
):
highlights
=
self
.
check
.
check_highlight
(
u'{{name}} {{other}} string'
,
MockUnit
(
'angularjs_format'
,
flags
=
'angularjs-format'
))
self
.
assertEqual
(
2
,
len
(
highlights
))
self
.
assertEqual
(
0
,
highlights
[
0
][
0
])
self
.
assertEqual
(
8
,
highlights
[
0
][
1
])
self
.
assertEqual
(
9
,
highlights
[
1
][
0
])
self
.
assertEqual
(
18
,
highlights
[
1
][
1
])
def
test_check_highlight_ignored
(
self
):
highlights
=
self
.
check
.
check_highlight
(
u'{{name}} {{other}} string'
,
MockUnit
(
'angularjs_format'
,
flags
=
'ignore-angularjs-format'
))
self
.
assertEqual
([],
highlights
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment