aboutsummaryrefslogtreecommitdiff
path: root/lib/document-to-html.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-06-17 14:33:43 +0100
committerMichael Williamson <mike@zwobble.org>2015-06-17 14:33:43 +0100
commit17577bdd715c65e71d81f762b54b8c27f60f4535 (patch)
tree5389d7741881b2d198daf450f915fa9b3527f7e7 /lib/document-to-html.js
parentdc31bacddd43e100a2793c76e26d35568262d89a (diff)
Support underlines in style map
Diffstat (limited to 'lib/document-to-html.js')
-rw-r--r--lib/document-to-html.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index 220ae2b..264f7c9 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -122,8 +122,8 @@ function DocumentConversion(options) {
if (run.verticalAlignment === documents.verticalAlignment.subscript) {
runHtml.open(htmlPaths.element("sub"));
}
- if (run.isUnderline && options.convertUnderline) {
- options.convertUnderline(runHtml);
+ if (run.isUnderline) {
+ convertUnderline(runHtml);
}
convertElements(run.children, runHtml, messages, function(err) {
if (err) {
@@ -136,6 +136,17 @@ function DocumentConversion(options) {
});
}
+ function convertUnderline(runHtml) {
+ (options.convertUnderline || defaultConvertUnderline)(runHtml);
+ }
+
+ function defaultConvertUnderline(runHtml) {
+ var style = findStyle({type: "underline"});
+ if (style) {
+ runHtml.appendPath(style.to);
+ }
+ }
+
function findStyle(element) {
for (var i = 0; i < styleMap.length; i++) {
if (styleMap[i].from.matches(element)) {