diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/styles/document-matchers.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/styles/document-matchers.js b/lib/styles/document-matchers.js index 58c844a..e2fd63b 100644 --- a/lib/styles/document-matchers.js +++ b/lib/styles/document-matchers.js @@ -9,9 +9,9 @@ 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"}); -exports.columnBreak = new Matcher("break", {breakType: "column"}); +exports.lineBreak = new BreakMatcher({breakType: "line"}); +exports.pageBreak = new BreakMatcher({breakType: "page"}); +exports.columnBreak = new BreakMatcher({breakType: "column"}); exports.equalTo = equalTo; exports.startsWith = startsWith; @@ -61,6 +61,16 @@ HighlightMatcher.prototype.matches = function(element) { (this._color === undefined || element.color === this._color); }; +function BreakMatcher(options) { + options = options || {}; + this._breakType = options.breakType; +} + +BreakMatcher.prototype.matches = function(element) { + return element.type === "break" && + (this._breakType === undefined || element.breakType === this._breakType); +}; + function isList(element, levelIndex, isOrdered) { return element.numbering && element.numbering.level == levelIndex && |
