aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/document-matchers.js1
-rw-r--r--lib/style-reader.js2
-rw-r--r--tests/style-reader.tests.js7
3 files changed, 10 insertions, 0 deletions
diff --git a/lib/document-matchers.js b/lib/document-matchers.js
index a03e335..af322c8 100644
--- a/lib/document-matchers.js
+++ b/lib/document-matchers.js
@@ -1,5 +1,6 @@
exports.paragraph = paragraph;
exports.run = run;
+exports.bold = new Matcher("bold");
exports.underline = new Matcher("underline");
exports.strikethrough = new Matcher("strikethrough");
diff --git a/lib/style-reader.js b/lib/style-reader.js
index 6d36c42..d732181 100644
--- a/lib/style-reader.js
+++ b/lib/style-reader.js
@@ -121,11 +121,13 @@ function documentMatcherRule() {
return createMatcher(matcherOptions);
});
+ var bold = identifierToConstant("b", documentMatchers.bold);
var underline = identifierToConstant("u", documentMatchers.underline);
var strikethrough = identifierToConstant("strike", documentMatchers.strikethrough);
return lop.rules.firstOf("element type",
paragraphOrRun,
+ bold,
underline,
strikethrough
);
diff --git a/tests/style-reader.tests.js b/tests/style-reader.tests.js
index 76d3f97..03bea11 100644
--- a/tests/style-reader.tests.js
+++ b/tests/style-reader.tests.js
@@ -99,6 +99,13 @@ describe("styleReader.readDocumentMatcher", function() {
);
});
+ test("reads bold", function() {
+ assertDocumentMatcher(
+ "b",
+ documentMatchers.bold
+ );
+ });
+
test("reads underline", function() {
assertDocumentMatcher(
"u",