Skip to content

Commit 16e8ae8

Browse files
committed
Refactor for changes in mdast
1 parent 582ea99 commit 16e8ae8

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,15 @@ function testFactory(settings, callback) {
147147
* @return {Object?}
148148
*/
149149
function test(node, context) {
150-
var value = node.value;
150+
var value;
151151
var match;
152152
var result;
153153

154-
if (node.type !== 'html') {
154+
if (!node || node.type !== 'html') {
155155
return null;
156156
}
157157

158+
value = node.value;
158159
match = value.match(expression);
159160

160161
if (
@@ -201,13 +202,17 @@ function parse(tokenize, settings) {
201202
*
202203
* @return {Node}
203204
*/
204-
return function () {
205+
function replacement() {
205206
var node = tokenize.apply(this, arguments);
206207

207208
test(node, this);
208209

209210
return node;
210-
};
211+
}
212+
213+
replacement.locator = tokenize.locator;
214+
215+
return replacement;
211216
}
212217

213218
/**

mdast-zone.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,15 @@ function testFactory(settings, callback) {
148148
* @return {Object?}
149149
*/
150150
function test(node, context) {
151-
var value = node.value;
151+
var value;
152152
var match;
153153
var result;
154154

155-
if (node.type !== 'html') {
155+
if (!node || node.type !== 'html') {
156156
return null;
157157
}
158158

159+
value = node.value;
159160
match = value.match(expression);
160161

161162
if (
@@ -202,13 +203,17 @@ function parse(tokenize, settings) {
202203
*
203204
* @return {Node}
204205
*/
205-
return function () {
206+
function replacement() {
206207
var node = tokenize.apply(this, arguments);
207208

208209
test(node, this);
209210

210211
return node;
211-
};
212+
}
213+
214+
replacement.locator = tokenize.locator;
215+
216+
return replacement;
212217
}
213218

214219
/**

mdast-zone.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"istanbul": "^0.3.0",
3131
"jscs": "^2.0.0",
3232
"jscs-jsdoc": "^1.0.0",
33-
"mdast": "^1.0.0",
34-
"mdast-github": "^1.0.0",
33+
"mdast": "^3.0.0-alpha.1",
34+
"mdast-github": "^2.0.0-alpha.1",
3535
"mdast-lint": "^1.0.0",
3636
"mdast-toc": "^1.0.0",
3737
"mdast-usage": "^1.0.0",

0 commit comments

Comments
 (0)