From 0450a33890c8b7b1b124f11d32760ffed7d222e0 Mon Sep 17 00:00:00 2001 From: Tomas Trescak Date: Tue, 26 May 2015 16:09:12 +1000 Subject: [PATCH 01/11] Fixes broken error message over multiple lines --- msgfmt:extract/extract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msgfmt:extract/extract.js b/msgfmt:extract/extract.js index b8670f2..d486afb 100644 --- a/msgfmt:extract/extract.js +++ b/msgfmt:extract/extract.js @@ -254,7 +254,7 @@ var lastFile = null; function logKey(file, key, text, file, line, strings) { if (strings[key] && strings[key].text != text) log.warn('{ ' + key + ': "' + text + '" } in ' - + file + ':' + line + ' replaces DUP_KEY\n { ' + + file + ':' + line + ' replaces DUP_KEY { ' + key + ': "' + strings[key].text + '" } in ' + strings[key].file + ':' + strings[key].line); From d1e9997b5133a10be5e7348ae1bb1d2cfdb9847e Mon Sep 17 00:00:00 2001 From: Tomas Trescak Date: Tue, 26 May 2015 16:21:33 +1000 Subject: [PATCH 02/11] Ability to recognise by key only {{ mf 'key' }} Often desired way is to have only keys in sources and translation left for later. --- msgfmt:extract/extract.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/msgfmt:extract/extract.js b/msgfmt:extract/extract.js index d486afb..e21c29f 100644 --- a/msgfmt:extract/extract.js +++ b/msgfmt:extract/extract.js @@ -278,16 +278,16 @@ handlers.html = function(file, data, mtime, strings) { var result, re; // {{mf "key" 'text' attr1=val1 attr2=val2 etc}} - re = /{{[\s]?mf (['"])(.*?)\1 ?(["'])(.*?)\3(.*?)}}/g; + re = /\{\{[\s]?mf ['"](.*?)['"] ?(["'](.*?)['"])?(.*?)\}\}/g; while (result = re.exec(data)) { - var key = result[2], text = result[4], attributes = attrDict(result[5]); + var key = result[1], text = result[3], attributes = attrDict(result[4]); var tpl = /