fix parser regexp (#31)

- fix template parser regexp (Closes #15)
This commit is contained in:
cvaliere
2017-04-06 08:50:23 +02:00
committed by Kim Biesbjerg
parent bcb4a9c069
commit 262a89206d
2 changed files with 9 additions and 3 deletions

View File

@@ -15,10 +15,10 @@ export class PipeParser extends AbstractTemplateParser implements ParserInterfac
protected _parseTemplate(template: string): TranslationCollection {
let collection: TranslationCollection = new TranslationCollection();
const regExp: RegExp = /(['"`])([^>\1\r\n]*?)\1\s*\|\s*translate/g;
const regExp: RegExp = /(['"`])((?:(?!\1).|\\\1)+)\1\s*\|\s*translate/g;
let matches: RegExpExecArray;
while (matches = regExp.exec(template)) {
collection = collection.add(matches[2]);
collection = collection.add(matches[2].replace('\\\'', '\''));
}
return collection;