comments
This commit is contained in:
parent
3ecf03a344
commit
5caa4f45b2
@ -85,9 +85,12 @@ export function processFile(sourceFile: ts.SourceFile) {
|
|||||||
let text = sourceFile.text.slice(candidate.pos, candidate.end);
|
let text = sourceFile.text.slice(candidate.pos, candidate.end);
|
||||||
switch (candidate.kind) {
|
switch (candidate.kind) {
|
||||||
case ts.SyntaxKind.SingleLineCommentTrivia:
|
case ts.SyntaxKind.SingleLineCommentTrivia:
|
||||||
|
// Remove comment leader
|
||||||
text = text.replace(/^[/][/]\s*/, "");
|
text = text.replace(/^[/][/]\s*/, "");
|
||||||
break;
|
break;
|
||||||
case ts.SyntaxKind.MultiLineCommentTrivia:
|
case ts.SyntaxKind.MultiLineCommentTrivia:
|
||||||
|
// Remove comment leader and trailer,
|
||||||
|
// handling white space just like xgettext.
|
||||||
text = text
|
text = text
|
||||||
.replace(/^[/][*](\s*?\n|\s*)?/, "")
|
.replace(/^[/][*](\s*?\n|\s*)?/, "")
|
||||||
.replace(/(\n[ \t]*?)?[*][/]$/, "");
|
.replace(/(\n[ \t]*?)?[*][/]$/, "");
|
||||||
@ -108,6 +111,7 @@ export function processFile(sourceFile: ts.SourceFile) {
|
|||||||
let headName = getHeadName(tte.tag);
|
let headName = getHeadName(tte.tag);
|
||||||
let comment = getComment(tte, lc);
|
let comment = getComment(tte, lc);
|
||||||
let tpl = getTemplate(tte.template).replace(/"/g, '\\"');
|
let tpl = getTemplate(tte.template).replace(/"/g, '\\"');
|
||||||
|
// Do escaping, wrap break at newlines
|
||||||
let parts = tpl
|
let parts = tpl
|
||||||
.match(/(.*\n|.+$)/g)
|
.match(/(.*\n|.+$)/g)
|
||||||
.map((x) => x.replace(/\n/g, '\\n'))
|
.map((x) => x.replace(/\n/g, '\\n'))
|
||||||
|
Loading…
Reference in New Issue
Block a user