mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
963 B
51 lines
963 B
/**
|
|
* @author Titus Wormer
|
|
* @copyright 2015 Titus Wormer
|
|
* @license MIT
|
|
* @module remark:parse:util:get-indentation
|
|
* @fileoverview Get indentation.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
module.exports = interrupt;
|
|
|
|
function interrupt(interruptors, tokenizers, ctx, params) {
|
|
var bools = ['pedantic', 'commonmark'];
|
|
var count = bools.length;
|
|
var length = interruptors.length;
|
|
var index = -1;
|
|
var interruptor;
|
|
var config;
|
|
var fn;
|
|
var offset;
|
|
var bool;
|
|
var ignore;
|
|
|
|
while (++index < length) {
|
|
interruptor = interruptors[index];
|
|
config = interruptor[1] || {};
|
|
fn = interruptor[0];
|
|
offset = -1;
|
|
ignore = false;
|
|
|
|
while (++offset < count) {
|
|
bool = bools[offset];
|
|
|
|
if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) {
|
|
ignore = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (ignore) {
|
|
continue;
|
|
}
|
|
|
|
if (tokenizers[fn].apply(ctx, params)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|