Skip to content

Commit

Permalink
Generators / HTML - safely return an empty string if no source is pro…
Browse files Browse the repository at this point in the history
…vided
  • Loading branch information
roperzh committed Nov 30, 2015
1 parent c8d2f0b commit f29fbff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions dist/jroff.js
Original file line number Diff line number Diff line change
Expand Up @@ -2254,8 +2254,15 @@
var HTMLGenerator = function () {};

HTMLGenerator.prototype.generate = function (source, macroLib) {
var parser = new Parser(source),
ast = parser.buildAST();
var parser,
ast;

if(!source) {
return '';
}

parser = new Parser(source);
ast = parser.buildAST();

macroLib = macroLib || 'doc';

Expand Down
11 changes: 9 additions & 2 deletions src/generators/html.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
var HTMLGenerator = function () {};

HTMLGenerator.prototype.generate = function (source, macroLib) {
var parser = new Parser(source),
ast = parser.buildAST();
var parser,
ast;

if(!source) {
return '';
}

parser = new Parser(source);
ast = parser.buildAST();

macroLib = macroLib || 'doc';

Expand Down

0 comments on commit f29fbff

Please sign in to comment.