Skip to content

Commit

Permalink
extract summary
Browse files Browse the repository at this point in the history
  • Loading branch information
ichiriac committed Jan 7, 2017
1 parent ddde5f8 commit 1134c84
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,28 @@ Parser.prototype.parse = function (input) {
}
this.token = this.lexer.lex();
}
ast.summary = input.substring(0, this.lexer.offset);

// extract summary from text
if (this.token === '@') {
ast.summary = input.substring(0, this.lexer.offset - 1);
} else {
ast.summary = input.substring(0, this.lexer.offset);
}

// trim first starting line returns
if (ast.summary[0] === '\r') {
ast.summary = ast.summary.substring(1);
}
if (ast.summary[0] === '\n') {
ast.summary = ast.summary.substring(1);
}
// trim last line returns
if (ast.summary[ast.summary.length - 1] === '\n') {
ast.summary = ast.summary.substring(0, ast.summary.length - 1);
}
if (ast.summary[ast.summary.length - 1] === '\r') {
ast.summary = ast.summary.substring(0, ast.summary.length - 1);
}

// parsing blocks
while (this.token !== this.lexer._t.T_EOF) {
Expand Down

0 comments on commit 1134c84

Please sign in to comment.