diff options
| -rw-r--r-- | lib/document-matchers.js | 1 | ||||
| -rw-r--r-- | lib/style-reader.js | 2 | ||||
| -rw-r--r-- | tests/style-reader.tests.js | 7 |
3 files changed, 10 insertions, 0 deletions
diff --git a/lib/document-matchers.js b/lib/document-matchers.js index af322c8..a9150e3 100644 --- a/lib/document-matchers.js +++ b/lib/document-matchers.js @@ -1,6 +1,7 @@ exports.paragraph = paragraph; exports.run = run; exports.bold = new Matcher("bold"); +exports.italic = new Matcher("italic"); exports.underline = new Matcher("underline"); exports.strikethrough = new Matcher("strikethrough"); diff --git a/lib/style-reader.js b/lib/style-reader.js index d732181..af6206c 100644 --- a/lib/style-reader.js +++ b/lib/style-reader.js @@ -122,12 +122,14 @@ function documentMatcherRule() { }); var bold = identifierToConstant("b", documentMatchers.bold); + var italic = identifierToConstant("i", documentMatchers.italic); var underline = identifierToConstant("u", documentMatchers.underline); var strikethrough = identifierToConstant("strike", documentMatchers.strikethrough); return lop.rules.firstOf("element type", paragraphOrRun, bold, + italic, underline, strikethrough ); diff --git a/tests/style-reader.tests.js b/tests/style-reader.tests.js index 03bea11..0a4dccb 100644 --- a/tests/style-reader.tests.js +++ b/tests/style-reader.tests.js @@ -106,6 +106,13 @@ describe("styleReader.readDocumentMatcher", function() { ); }); + test("reads italic", function() { + assertDocumentMatcher( + "i", + documentMatchers.italic + ); + }); + test("reads underline", function() { assertDocumentMatcher( "u", |
