From fc5b5a22f9b9be138da18d38a67224171663c2f9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 17 May 2015 16:20:43 +0100 Subject: Add ignoreEmptyParagraphs option --- lib/document-to-html.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/document-to-html.js') 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); }); -- cgit v1.2.3