aboutsummaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-01-27 01:19:20 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-01-27 01:19:20 +0100
commit5caa4f45b28af712bd86f5381c0ab4ac4abb372f (patch)
treedbe037643dcf665353b8c952098075d1bec6a6cc /extension
parent3ecf03a344de3441ef74321d638956a923175a0a (diff)
comments
Diffstat (limited to 'extension')
-rw-r--r--extension/pogen/pogen.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/extension/pogen/pogen.ts b/extension/pogen/pogen.ts
index 9fbe0b1a8..6d2977ad8 100644
--- a/extension/pogen/pogen.ts
+++ b/extension/pogen/pogen.ts
@@ -85,9 +85,12 @@ export function processFile(sourceFile: ts.SourceFile) {
let text = sourceFile.text.slice(candidate.pos, candidate.end);
switch (candidate.kind) {
case ts.SyntaxKind.SingleLineCommentTrivia:
+ // Remove comment leader
text = text.replace(/^[/][/]\s*/, "");
break;
case ts.SyntaxKind.MultiLineCommentTrivia:
+ // Remove comment leader and trailer,
+ // handling white space just like xgettext.
text = text
.replace(/^[/][*](\s*?\n|\s*)?/, "")
.replace(/(\n[ \t]*?)?[*][/]$/, "");
@@ -108,6 +111,7 @@ export function processFile(sourceFile: ts.SourceFile) {
let headName = getHeadName(tte.tag);
let comment = getComment(tte, lc);
let tpl = getTemplate(tte.template).replace(/"/g, '\\"');
+ // Do escaping, wrap break at newlines
let parts = tpl
.match(/(.*\n|.+$)/g)
.map((x) => x.replace(/\n/g, '\\n'))