aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorvgmoose <me@vgmoose.com>2017-07-19 16:26:35 -0400
committervgmoose <me@vgmoose.com>2017-07-19 17:24:11 -0400
commit9c9cb3e30d7cae37b42537e59ba38571a9e06097 (patch)
treeaa9cc3096cdf484fcffba4a9513283cf00894ddb /lib
parent534f62e0684af52766adf82b8fd5dbf796e018db (diff)
Parse small caps style mappings (see #123)
Diffstat (limited to 'lib')
-rw-r--r--lib/document-to-html.js3
-rw-r--r--lib/documents.js1
-rw-r--r--lib/docx/body-reader.js3
-rw-r--r--lib/style-reader.js5
-rw-r--r--lib/styles/document-matchers.js1
5 files changed, 11 insertions, 2 deletions
diff --git a/lib/document-to-html.js b/lib/document-to-html.js
index d0197cb..83e78fd 100644
--- a/lib/document-to-html.js
+++ b/lib/document-to-html.js
@@ -145,6 +145,9 @@ function DocumentConversion(options, comments) {
if (run.isBold) {
paths.push(findHtmlPathForRunProperty("bold", "strong"));
}
+ if (run.isSmallCaps) {
+ paths.push(findHtmlPathForRunProperty("smallCaps"));
+ }
var stylePath = htmlPaths.empty;
var style = findStyle(run);
if (style) {
diff --git a/lib/documents.js b/lib/documents.js
index 605b1b4..a6d5dd0 100644
--- a/lib/documents.js
+++ b/lib/documents.js
@@ -52,6 +52,7 @@ function Run(children, properties) {
isUnderline: properties.isUnderline,
isItalic: properties.isItalic,
isStrikethrough: properties.isStrikethrough,
+ isSmallCaps: properties.isSmallCaps,
verticalAlignment: properties.verticalAlignment || verticalAlignment.baseline,
font: properties.font || null
};
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 6f6ebe2..c612e5c 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -58,7 +58,8 @@ function BodyReader(options) {
isBold: readBooleanElement(element.first("w:b")),
isUnderline: readBooleanElement(element.first("w:u")),
isItalic: readBooleanElement(element.first("w:i")),
- isStrikethrough: readBooleanElement(element.first("w:strike"))
+ isStrikethrough: readBooleanElement(element.first("w:strike")),
+ isSmallCaps: readBooleanElement(element.first("w:smallCaps"))
};
});
}
diff --git a/lib/style-reader.js b/lib/style-reader.js
index 3a71ef6..32a2920 100644
--- a/lib/style-reader.js
+++ b/lib/style-reader.js
@@ -159,6 +159,8 @@ function documentMatcherRule() {
// TODO: handle unknown document matchers
}
});
+
+ var smallCaps = identifierToConstant("smallCaps", documentMatchers.smallCaps);
return lop.rules.firstOf("element type",
paragraphOrRun,
@@ -167,7 +169,8 @@ function documentMatcherRule() {
underline,
strikethrough,
commentReference,
- breakMatcher
+ breakMatcher,
+ smallCaps
);
}
diff --git a/lib/styles/document-matchers.js b/lib/styles/document-matchers.js
index afc0a7d..3548d65 100644
--- a/lib/styles/document-matchers.js
+++ b/lib/styles/document-matchers.js
@@ -5,6 +5,7 @@ exports.italic = new Matcher("italic");
exports.underline = new Matcher("underline");
exports.strikethrough = new Matcher("strikethrough");
exports.commentReference = new Matcher("commentReference");
+exports.smallCaps = new Matcher("smallCaps");
exports.lineBreak = new Matcher("break", {breakType: "line"});
exports.pageBreak = new Matcher("break", {breakType: "page"});
exports.columnBreak = new Matcher("break", {breakType: "column"});