From ed8fdc9e31d6c60529bf6c8c6bd1bd81b1ca6153 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 22 Apr 2014 19:00:30 +0100 Subject: Show style name when emitting unknown run style warning --- lib/document-to-html.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/document-to-html.js b/lib/document-to-html.js index 4559155..bd3a3d6 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -62,7 +62,7 @@ function DocumentConverter(options) { return style.to; } else { if (element.styleId) { - messages.push(results.warning("Unrecognised paragraph style: '" + element.styleName + "'")); + messages.push(unrecognisedStyleWarning("paragraph", element));; } return defaultParagraphStyle; } @@ -75,7 +75,7 @@ function DocumentConverter(options) { if (style) { runHtml.satisfyPath(style.to); } else { - messages.push(results.warning("Unrecognised run style: " + run.styleId)); + messages.push(unrecognisedStyleWarning("run", run)); } } if (run.isBold) { @@ -146,3 +146,7 @@ function DocumentConverter(options) { convertToHtml: convertToHtml }; } + +function unrecognisedStyleWarning(type, element) { + return results.warning("Unrecognised " + type + " style: '" + element.styleName + "'"); +} -- cgit v1.2.3