aboutsummaryrefslogtreecommitdiff
path: root/lib/document-matchers.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/document-matchers.js')
-rw-r--r--lib/document-matchers.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/document-matchers.js b/lib/document-matchers.js
index f116d3f..0846513 100644
--- a/lib/document-matchers.js
+++ b/lib/document-matchers.js
@@ -1,18 +1,34 @@
+var _ = require("underscore");
+
exports.paragraph = paragraph;
exports.run = run;
-function paragraph(styleId) {
- return new Matcher("paragraph", styleId);
+function paragraph(options) {
+ options = options || {};
+ if (_.isString(options)) {
+ // TODO: this is deprecated, remove usages
+ options = {styleId: options};
+ }
+ return new Matcher("paragraph", options);
}
-function run(styleId) {
- return new Matcher("run", styleId);
+function run(options) {
+ options = options || {};
+ if (_.isString(options)) {
+ // TODO: this is deprecated, remove usages
+ options = {styleId: options};
+ }
+ return new Matcher("run", options);
}
-function Matcher(elementType, styleId) {
+function Matcher(elementType, options) {
this._elementType = elementType;
- this._styleId = styleId;
+ this._styleId = options.styleId;
+ if (options.list) {
+ this._listIndex = options.list.levelIndex;
+ this._listIsOrdered = options.list.isOrdered;
+ }
}
Matcher.prototype.matches = function(element) {