aboutsummaryrefslogtreecommitdiff
path: root/lib/document-to-html.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-05-17 16:20:43 +0100
committerMichael Williamson <mike@zwobble.org>2015-05-17 16:20:43 +0100
commitfc5b5a22f9b9be138da18d38a67224171663c2f9 (patch)
tree1eeba35c07a1713908f0935cdc3c8c4e903541fd /lib/document-to-html.js
parent969d80c62e7d5d5ed41a3dc7ec8f5f8bdec59a91 (diff)
Add ignoreEmptyParagraphs option
Diffstat (limited to 'lib/document-to-html.js')
-rw-r--r--lib/document-to-html.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index e9d35b9..220ae2b 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -1,6 +1,7 @@
-var promises = require("./promises");
var async = require("async");
+var _ = require("underscore");
+var promises = require("./promises");
var documents = require("./documents");
var htmlPaths = require("./html-paths");
var HtmlGenerator = require("./html-generator").HtmlGenerator;
@@ -32,7 +33,7 @@ function DocumentConversion(options) {
var noteReferences = [];
- options = options || {};
+ options = _.extend({ignoreEmptyParagraphs: true}, options);
var idPrefix = options.idPrefix === undefined ?
Math.floor(Math.random() * 1000000000000000) :
options.idPrefix;
@@ -76,6 +77,11 @@ function DocumentConversion(options) {
function convertParagraph(element, html, messages, callback) {
html.satisfyPath(styleForParagraph(element, messages));
+
+ if (!options.ignoreEmptyParagraphs) {
+ html.writeAll();
+ }
+
setImmediate(function() {
convertElements(element.children, html, messages, callback);
});