diff options
Diffstat (limited to 'lib/styles')
| -rw-r--r-- | lib/styles/document-matchers.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/styles/document-matchers.js b/lib/styles/document-matchers.js index 005e2db..58c844a 100644 --- a/lib/styles/document-matchers.js +++ b/lib/styles/document-matchers.js @@ -7,6 +7,7 @@ exports.underline = new Matcher("underline"); exports.strikethrough = new Matcher("strikethrough"); exports.allCaps = new Matcher("allCaps"); exports.smallCaps = new Matcher("smallCaps"); +exports.highlight = highlight; exports.commentReference = new Matcher("commentReference"); exports.lineBreak = new Matcher("break", {breakType: "line"}); exports.pageBreak = new Matcher("break", {breakType: "page"}); @@ -27,6 +28,10 @@ function table(options) { return new Matcher("table", options); } +function highlight(options) { + return new HighlightMatcher(options); +} + function Matcher(elementType, options) { options = options || {}; this._elementType = elementType; @@ -46,6 +51,16 @@ Matcher.prototype.matches = function(element) { (this._breakType === undefined || this._breakType === element.breakType); }; +function HighlightMatcher(options) { + options = options || {}; + this._color = options.color; +} + +HighlightMatcher.prototype.matches = function(element) { + return element.type === "highlight" && + (this._color === undefined || element.color === this._color); +}; + function isList(element, levelIndex, isOrdered) { return element.numbering && element.numbering.level == levelIndex && |
