diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-04-22 11:05:42 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-04-22 11:05:42 +0100 |
| commit | 57cc8dff2e5723b8468c2f1fa1020ac2a9144022 (patch) | |
| tree | d04cc33addc704c07696aa44a4503c5e5388fad5 /lib | |
| parent | bc8e8b44a05041bc656e83a87d857ec58ba0b4fe (diff) | |
Rename styleName to the more accurate styleId
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/document-matchers.js | 14 | ||||
| -rw-r--r-- | lib/document-to-html.js | 8 | ||||
| -rw-r--r-- | lib/documents.js | 4 | ||||
| -rw-r--r-- | lib/docx/document-xml-reader.js | 4 | ||||
| -rw-r--r-- | lib/style-reader.js | 4 |
5 files changed, 17 insertions, 17 deletions
diff --git a/lib/document-matchers.js b/lib/document-matchers.js index a5b5ff5..f116d3f 100644 --- a/lib/document-matchers.js +++ b/lib/document-matchers.js @@ -2,22 +2,22 @@ exports.paragraph = paragraph; exports.run = run; -function paragraph(styleName) { - return new Matcher("paragraph", styleName); +function paragraph(styleId) { + return new Matcher("paragraph", styleId); } -function run(styleName) { - return new Matcher("run", styleName); +function run(styleId) { + return new Matcher("run", styleId); } -function Matcher(elementType, styleName) { +function Matcher(elementType, styleId) { this._elementType = elementType; - this._styleName = styleName; + this._styleId = styleId; } Matcher.prototype.matches = function(element) { return element.type === this._elementType && - (this._styleName === undefined || element.styleName === this._styleName) && + (this._styleId === undefined || element.styleId === this._styleId) && (this._listIndex === undefined || isList(element, this._listIndex, this._listIsOrdered)); }; diff --git a/lib/document-to-html.js b/lib/document-to-html.js index e8c393c..347504b 100644 --- a/lib/document-to-html.js +++ b/lib/document-to-html.js @@ -61,8 +61,8 @@ function DocumentConverter(options) { if (style) { return style.to; } else { - if (element.styleName) { - messages.push(results.warning("Unrecognised paragraph style: " + element.styleName)); + if (element.styleId) { + messages.push(results.warning("Unrecognised paragraph style: " + element.styleId)); } return defaultParagraphStyle; } @@ -70,12 +70,12 @@ function DocumentConverter(options) { function convertRun(run, html, messages, callback) { var runHtml = new HtmlGenerator(); - if (run.styleName) { + if (run.styleId) { var style = findStyle(run); if (style) { runHtml.satisfyPath(style.to); } else { - messages.push(results.warning("Unrecognised run style: " + run.styleName)); + messages.push(results.warning("Unrecognised run style: " + run.styleId)); } } if (run.isBold) { diff --git a/lib/documents.js b/lib/documents.js index ce985e9..8463da0 100644 --- a/lib/documents.js +++ b/lib/documents.js @@ -20,7 +20,7 @@ function Paragraph(children, properties) { return { type: types.paragraph, children: children, - styleName: properties.styleName || null, + styleId: properties.styleId || null, numbering: properties.numbering || null, alignment: properties.alignment || null }; @@ -31,7 +31,7 @@ function Run(children, properties) { return { type: types.run, children: children, - styleName: properties.styleName || null, + styleId: properties.styleId || null, isBold: properties.isBold, isItalic: properties.isItalic }; diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js index 1825006..a23aa5f 100644 --- a/lib/docx/document-xml-reader.js +++ b/lib/docx/document-xml-reader.js @@ -62,7 +62,7 @@ function DocumentXmlReader(relationships, contentTypes, docxFile, numbering) { var styleElement = element.first("w:pStyle"); if (styleElement) { - properties.styleName = styleElement.attributes["w:val"]; + properties.styleId = styleElement.attributes["w:val"]; } var alignElement = element.first("w:jc"); if (alignElement) { @@ -96,7 +96,7 @@ function DocumentXmlReader(relationships, contentTypes, docxFile, numbering) { var styleElement = element.first("w:rStyle"); if (styleElement) { - properties.styleName = styleElement.attributes["w:val"]; + properties.styleId = styleElement.attributes["w:val"]; } properties.isBold = !!element.first("w:b"); properties.isItalic = !!element.first("w:i"); diff --git a/lib/style-reader.js b/lib/style-reader.js index 0e50172..13f3609 100644 --- a/lib/style-reader.js +++ b/lib/style-reader.js @@ -89,8 +89,8 @@ function documentMatcherRule() { sequence.capture(elementTypeRule), sequence.capture(lop.rules.optional(classRule)), sequence.capture(optionalListRule) - ).map(function(createMatcher, styleName, applyList) { - return applyList(createMatcher(styleName.valueOrElse())); + ).map(function(createMatcher, styleId, applyList) { + return applyList(createMatcher(styleId.valueOrElse())); }); } |
