diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-05-03 22:02:44 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-05-03 22:02:44 +0100 |
| commit | 9787dd5549f3a3d50580755b80292c1d965d018d (patch) | |
| tree | 010111c7691cb75e636c252c6ec8a3ea08547f5c /lib | |
| parent | 9f2a2399cdabf91d0766c9a6ddbeed0a4e2597cf (diff) | |
Use styleReader to generate standardOptions
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/index.js | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/lib/index.js b/lib/index.js index 2d963dc..c53d26b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -2,6 +2,7 @@ var docxReader = require("./docx-reader"); var DocumentConverter = require("./document-to-html").DocumentConverter; var htmlPaths = require("./html-paths"); var documentMatchers = require("./document-matchers"); +var style = require("./style-reader").readStyle; exports.Converter = Converter; exports.read = read; @@ -9,29 +10,11 @@ exports.convertDocumentToHtml = convertDocumentToHtml; exports.htmlPaths = htmlPaths; exports.standardOptions = { 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}) - ]) - } + style("p.Heading1 => h1"), + style("p.Heading2 => h2"), + style("p.Heading3 => h3"), + style("p.Heading4 => h4"), + style("p.ListParagraph => ul > li:fresh") ] }; |
