aboutsummaryrefslogtreecommitdiff
path: root/lib/index.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-05-03 21:27:00 +0100
committerMichael Williamson <mike@zwobble.org>2013-05-03 21:27:00 +0100
commitce01e3ec266ca3cbd96832766174e49337db98f8 (patch)
tree60a6bec29909354bd95ecac7319f94f9bbde1d1e /lib/index.js
parent23438dd97f93b86115cc4196c88d12e5168acbd5 (diff)
Replace paragraphStyleMap with more general styleMap
Diffstat (limited to 'lib/index.js')
-rw-r--r--lib/index.js36
1 files changed, 26 insertions, 10 deletions
diff --git a/lib/index.js b/lib/index.js
index d2ccabd..2d963dc 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,22 +1,38 @@
var docxReader = require("./docx-reader");
var DocumentConverter = require("./document-to-html").DocumentConverter;
var htmlPaths = require("./html-paths");
+var documentMatchers = require("./document-matchers");
exports.Converter = Converter;
exports.read = read;
exports.convertDocumentToHtml = convertDocumentToHtml;
exports.htmlPaths = htmlPaths;
exports.standardOptions = {
- paragraphStyleMap: {
- "Heading1": htmlPaths.topLevelElement("h1"),
- "Heading2": htmlPaths.topLevelElement("h2"),
- "Heading3": htmlPaths.topLevelElement("h3"),
- "Heading4": htmlPaths.topLevelElement("h4"),
- "ListParagraph": htmlPaths.elements([
- htmlPaths.element("ul"),
- htmlPaths.element("li", {}, {fresh: true})
- ])
- }
+ styleMap: [
+ {
+ from: documentMatchers.paragraph("Heading1"),
+ to: htmlPaths.topLevelElement("h1")
+ },
+ {
+ from: documentMatchers.paragraph("Heading2"),
+ to: htmlPaths.topLevelElement("h2")
+ },
+ {
+ from: documentMatchers.paragraph("Heading3"),
+ to: htmlPaths.topLevelElement("h3")
+ },
+ {
+ from: documentMatchers.paragraph("Heading4"),
+ to: htmlPaths.topLevelElement("h4")
+ },
+ {
+ from: documentMatchers.paragraph("ListParagraph"),
+ to: htmlPaths.elements([
+ htmlPaths.element("ul"),
+ htmlPaths.element("li", {}, {fresh: true})
+ ])
+ }
+ ]
};
function Converter(options) {