Skip to content

Commit

Permalink
Merge branch 'tkallevik-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
smhg committed Jul 30, 2014
2 parents ec77c9a + 9a4817c commit e87e74b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Parser(keywords) {

this.keywords = keywords;

this.pattern = new RegExp('\\{\\{(?:' + keywords.join('|') + ') "((?:\\\\.|[^"\\\\])*)"(?: "((?:\\\\.|[^"\\\\])*)" \\w+)? ?\\}\\}', 'gm');
this.pattern = new RegExp('\\{\\{(?:' + keywords.join('|') + ') [\'"]((?:\\\\.|[^\'"\\\\])*)[\'"](?: [\'"]((?:\\\\.|[^\'"\\\\])*)[\'"] \\w+)? ?\\}\\}', 'gm');
}

/**
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/plural.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<p>{{_ "book" "books" amount}}</p>
<p>{{_ "book" "books" amount}}</p>
<p>{{_ 'car' 'cars' amount}}</p>
1 change: 1 addition & 0 deletions test/fixtures/template.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<h1>{{_ "This is a title"}}</h1>
<p>{{_ "This is a fixed sentence"}}</p>
<p>{{_ 'This is wrapped in single quotes'}}</p>
<p>{{nl2br description}}</p>
<img src="someimage.png" alt="{{_ "Image description"}}" />
<p>{{_ "Multiline
Expand Down
4 changes: 2 additions & 2 deletions test/handlebars-xgettext_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ exports.INPUT = {

comment = context['Image description'].comments;
test.deepEqual(comment.reference.split('\n'), [
'test/fixtures/template.hbs:4',
'test/fixtures/template.hbs:7'
'test/fixtures/template.hbs:5',
'test/fixtures/template.hbs:8'
], 'Repeated msgid in one file is not tracked');

test.done();
Expand Down
4 changes: 2 additions & 2 deletions test/parser_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.parser = {
result = parser.parse(template);

test.equal(typeof result, 'object', 'No object returned');
test.equal(Object.keys(result).length, 5, 'Invalid amount of strings returned');
test.equal(Object.keys(result).length, 6, 'Invalid amount of strings returned');
test.equal(result['Image description'].line.length, 2, 'Invalid amount of lines returned for string');

test.done();
Expand All @@ -24,7 +24,7 @@ exports.parser = {
template = fs.readFileSync(templatePath, 'utf8'),
result = parser.parse(template);

test.equal(Object.keys(result).length, 1, 'Invalid amount of strings returned');
test.equal(Object.keys(result).length, 2, 'Invalid amount of strings returned');

test.done();
}
Expand Down

0 comments on commit e87e74b

Please sign in to comment.