From fe8918642d9d95bbc099993b96e845bdc17215e1 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 18 Jul 2014 15:00:53 +0100 Subject: Ignore underline by default --- lib/document-to-html.js | 6 +++--- lib/index.js | 1 + lib/underline.js | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 lib/underline.js (limited to 'lib') diff --git a/lib/document-to-html.js b/lib/document-to-html.js index 35fb3e6..d5be742 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -100,12 +100,12 @@ function DocumentConversion(options) { if (run.isBold) { runHtml.open(htmlPaths.element("strong")); } - if (run.isUnderline) { - runHtml.open(htmlPaths.element("u")); - } if (run.isItalic) { runHtml.open(htmlPaths.element("em")); } + if (run.isUnderline && options.convertUnderline) { + options.convertUnderline(runHtml); + } convertElements(run.children, runHtml, messages, function(err) { if (err) { callback(err); diff --git a/lib/index.js b/lib/index.js index a6962b3..42ce828 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,6 +7,7 @@ exports.convertToHtml = convertToHtml; exports.extractRawText = extractRawText; exports.images = require("./images"); exports.transforms = require("./transforms"); +exports.underline = require("./underline"); function convertToHtml(input, options) { var fullOptions = readOptions(options); diff --git a/lib/underline.js b/lib/underline.js new file mode 100644 index 0000000..17448e8 --- /dev/null +++ b/lib/underline.js @@ -0,0 +1,10 @@ +var htmlPaths = require("./html-paths"); + + +exports.element = element; + +function element(name) { + return function(html) { + html.open(htmlPaths.element(name)); + }; +} -- cgit v1.2.3