diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-01-07 23:04:12 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-01-07 23:04:12 +0000 |
| commit | 743ca7a9b10aca9c9ce4e20cc3246558f1eb706e (patch) | |
| tree | d72297928b7650d310293146707a7defec682f8a | |
| parent | 542016383adcf720da27a52e711ec349e4406ecd (diff) | |
Rename mammoth.style to mammoth.styleMapping
| -rw-r--r-- | README.md | 16 | ||||
| -rw-r--r-- | lib/index.js | 4 | ||||
| -rw-r--r-- | tests/mammoth.tests.js | 2 | ||||
| -rw-r--r-- | tests/options-reader.tests.js | 6 |
4 files changed, 14 insertions, 14 deletions
@@ -56,12 +56,12 @@ and paragraphs with the style `SubSectionTitle` should be converted to `h2` elem ```javascript var mammoth = require("mammoth"); -var style = mammoth.style; +var styleMapping = mammoth.styleMapping; var options = { styleMap: [ - style("p.SectionTitle => h1:fresh"), - style("p.SubSectionTitle => h2:fresh") + styleMapping("p.SectionTitle => h1:fresh"), + styleMapping("p.SubSectionTitle => h2:fresh") ] }; mammoth.convertToHtml({path: "path/to/document.docx"}, options); @@ -74,8 +74,8 @@ set `options.includeDefaultStyleMap` to `false`: ```javascript var options = { styleMap: [ - style("p.SectionTitle => h1:fresh"), - style("p.SubSectionTitle => h2:fresh") + styleMapping("p.SectionTitle => h1:fresh"), + styleMapping("p.SubSectionTitle => h2:fresh") ], includeDefaultStyleMap: false }; @@ -97,7 +97,7 @@ Converts the source document to HTML. If `options.styleMap` is a string, each non-blank line is treated as a separate style mapping. If `options.styleMap` is an array, - each element is expected to be the result of a call to `mammoth.style`. + each element is expected to be the result of a call to `mammoth.styleMapping`. See "Writing style maps" for a reference to the syntax for style maps. ** `includeDefaultStyleMap`: by default, @@ -112,9 +112,9 @@ Converts the source document to HTML. ** `messages`: any messages, such as errors and warnings, generated during the conversion -#### `mammoth.style(string)` +#### `mammoth.styleMapping(string)` -Creates a style using the passed string. +Creates a style mapping using the passed string. #### Messages diff --git a/lib/index.js b/lib/index.js index b7ee6c3..d42acd6 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,10 +1,10 @@ var docxReader = require("./docx-reader"); var DocumentConverter = require("./document-to-html").DocumentConverter; -var style = require("./style-reader").readStyle; +var styleMapping = require("./style-reader").readStyle; var readOptions = require("./options-reader").readOptions; exports.convertToHtml = convertToHtml; -exports.style = style; +exports.styleMapping = styleMapping; function convertToHtml(input, options) { var fullOptions = readOptions(options); diff --git a/tests/mammoth.tests.js b/tests/mammoth.tests.js index 08270a4..c9f4787 100644 --- a/tests/mammoth.tests.js +++ b/tests/mammoth.tests.js @@ -40,7 +40,7 @@ describe('mammoth', function() { "word/document.xml": testData("simple/word/document.xml") }); var options = { - styleMap: [mammoth.style("p => h1")] + styleMap: [mammoth.styleMapping("p => h1")] }; return mammoth.convertToHtml({file: docxFile}, options).then(function(result) { assert.equal("<h1>Hello.</h1>", result.value); diff --git a/tests/options-reader.tests.js b/tests/options-reader.tests.js index 8160061..fcfa1bf 100644 --- a/tests/options-reader.tests.js +++ b/tests/options-reader.tests.js @@ -1,6 +1,6 @@ var assert = require("assert"); -var style = require("../").style; +var styleMapping = require("../").styleMapping; var optionsReader = require("../lib/options-reader"); var standardOptions = optionsReader._standardOptions; var readOptions = optionsReader.readOptions; @@ -19,7 +19,7 @@ describe('readOptions', function() { var options = readOptions({ styleMap: "p.SectionTitle => h2" }); - assert.deepEqual(style("p.SectionTitle => h2"), options.styleMap[0]); + assert.deepEqual(styleMapping("p.SectionTitle => h2"), options.styleMap[0]); assert.deepEqual(standardOptions.styleMap, options.styleMap.slice(1)); }); @@ -28,7 +28,7 @@ describe('readOptions', function() { styleMap: "p.SectionTitle => h2", includeDefaultStyleMap: false }); - assert.deepEqual([style("p.SectionTitle => h2")], options.styleMap); + assert.deepEqual([styleMapping("p.SectionTitle => h2")], options.styleMap); }); }); |
