diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-01 12:03:06 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-01 12:03:06 +0100 |
| commit | 6a9f7140a8f67a9af33c30dbd0acd61496ba1e91 (patch) | |
| tree | 143d4d9c78fd1869b75f584ef8c0288704401a21 | |
| parent | 7f415770a2039f9072356e6b17349004c1ff35c0 (diff) | |
Revert "Rename paragraphStyleMap to just styleMap"
This reverts commit 7f415770a2039f9072356e6b17349004c1ff35c0.
| -rw-r--r-- | lib/documents.js | 5 | ||||
| -rw-r--r-- | lib/index.js | 2 | ||||
| -rw-r--r-- | tests/documents.tests.js | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/documents.js b/lib/documents.js index 0a6ddff..83a8106 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -11,9 +11,10 @@ exports.Text = Text; function DocumentConverter(options) { options = options || {}; + options.paragraphStyleMap = options.paragraphStyleMap || {}; var defaultParagraphStyle = options.defaultParagraphStyle || styles.topLevelElement("p"); - var styleMap = options.styleMap || {}; + var paragraphStyleMap = options.paragraphStyleMap; function convertToHtml(document) { var html = new HtmlGenerator(); @@ -43,7 +44,7 @@ function DocumentConverter(options) { } function styleForParagraph(element) { - return styleMap[element.properties.styleName] || defaultParagraphStyle; + return paragraphStyleMap[element.properties.styleName] || defaultParagraphStyle; } var elementConverters = { diff --git a/lib/index.js b/lib/index.js index b1e2da0..b124b81 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,7 +8,7 @@ var styles = require("./styles"); exports.Converter = Converter; exports.standardOptions = { - styleMap: { + paragraphStyleMap: { "Heading1": styles.topLevelElement("h1"), "Heading2": styles.topLevelElement("h2"), "Heading3": styles.topLevelElement("h3"), diff --git a/tests/documents.tests.js b/tests/documents.tests.js index b69829f..06faf10 100644 --- a/tests/documents.tests.js +++ b/tests/documents.tests.js @@ -63,7 +63,7 @@ describe('DocumentConverter', function() { paragraphOfText("Hello.", "Heading1"), ]); var converter = new DocumentConverter({ - styleMap: { + paragraphStyleMap: { "Heading1": styles.topLevelElement("h1") } }); @@ -77,7 +77,7 @@ describe('DocumentConverter', function() { paragraphOfText("Hello.", "Heading1") ]); var converter = new DocumentConverter({ - styleMap: { + paragraphStyleMap: { "Heading1": styles.elements(["h1", "span"]) } }); |
