diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-04-27 15:58:59 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-04-27 15:58:59 +0100 |
| commit | 869d5b2a725db8e41dc447227468c173d5292c18 (patch) | |
| tree | 176267563f49df0d6804437c19dbbf62134569d2 /lib/options-reader.js | |
| parent | e9d9ab3c03b6018ba8b63335e6aa2b1809a188a5 (diff) | |
Remove mammoth.styleMapping
Diffstat (limited to 'lib/options-reader.js')
| -rw-r--r-- | lib/options-reader.js | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/lib/options-reader.js b/lib/options-reader.js index 0f7e38e..2c6ad4f 100644 --- a/lib/options-reader.js +++ b/lib/options-reader.js @@ -2,29 +2,28 @@ exports.readOptions = readOptions; var _ = require("underscore"); -var style = require("./style-reader").readStyle; var standardOptions = exports._standardOptions = { styleMap: [ - style("p.Heading1 => h1:fresh"), - style("p.Heading2 => h2:fresh"), - style("p.Heading3 => h3:fresh"), - style("p.Heading4 => h4:fresh"), - style("p[style-name='Heading 1'] => h1:fresh"), - style("p[style-name='Heading 2'] => h2:fresh"), - style("p[style-name='Heading 3'] => h3:fresh"), - style("p[style-name='Heading 4'] => h4:fresh"), - style("p:unordered-list(1) => ul > li:fresh"), - style("p:unordered-list(2) => ul|ol > li > ul > li:fresh"), - style("p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh"), - style("p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh"), - style("p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh"), - style("p:ordered-list(1) => ol > li:fresh"), - style("p:ordered-list(2) => ul|ol > li > ol > li:fresh"), - style("p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh"), - style("p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh"), - style("p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh") + "p.Heading1 => h1:fresh", + "p.Heading2 => h2:fresh", + "p.Heading3 => h3:fresh", + "p.Heading4 => h4:fresh", + "p[style-name='Heading 1'] => h1:fresh", + "p[style-name='Heading 2'] => h2:fresh", + "p[style-name='Heading 3'] => h3:fresh", + "p[style-name='Heading 4'] => h4:fresh", + "p:unordered-list(1) => ul > li:fresh", + "p:unordered-list(2) => ul|ol > li > ul > li:fresh", + "p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh", + "p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh", + "p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh", + "p:ordered-list(1) => ol > li:fresh", + "p:ordered-list(2) => ul|ol > li > ol > li:fresh", + "p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh", + "p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh", + "p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh" ], transformDocument: identity, includeDefaultStyleMap: true @@ -35,15 +34,14 @@ function readOptions(options) { var fullOptions = {}; _.extend(fullOptions, standardOptions, options); - fullOptions.styleMap = readStyleMap(options) - .concat(fullOptions.includeDefaultStyleMap ? standardOptions.styleMap : []); + fullOptions.styleMap = readStyleMap(options.styleMap, fullOptions); return fullOptions; } -function readStyleMap(options) { - var customStyleMap = readCustomStyleMap(options.styleMap); - return customStyleMap; +function readStyleMap(styleMap, options) { + var customStyleMap = readCustomStyleMap(styleMap); + return customStyleMap.concat(options.includeDefaultStyleMap ? standardOptions.styleMap : []); } function readCustomStyleMap(styleMap) { @@ -51,7 +49,7 @@ function readCustomStyleMap(styleMap) { return []; } else if (_.isString(styleMap)) { return styleMap.split("\n").map(function(line) { - return style(line.trim()); + return line.trim(); }); } else { return styleMap; |
