diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2015-05-27 16:14:11 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 15:00:46 +0100 |
commit | 51e6efde9ab638a04e6d4596ad1abf8c0c3b4b31 (patch) | |
tree | 27b979335792ff78d65b0a51621c7c923bac90f4 /packages/gitbook-markdown/lib/annotate_engine.js | |
parent | 6b22b7cc996330c8985755237c190fd830b89de2 (diff) | |
download | gitbook-51e6efde9ab638a04e6d4596ad1abf8c0c3b4b31.zip gitbook-51e6efde9ab638a04e6d4596ad1abf8c0c3b4b31.tar.gz gitbook-51e6efde9ab638a04e6d4596ad1abf8c0c3b4b31.tar.bz2 |
Remove annotation code and switch to kramed's annotation engine
Diffstat (limited to 'packages/gitbook-markdown/lib/annotate_engine.js')
-rw-r--r-- | packages/gitbook-markdown/lib/annotate_engine.js | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/packages/gitbook-markdown/lib/annotate_engine.js b/packages/gitbook-markdown/lib/annotate_engine.js deleted file mode 100644 index 181ee30..0000000 --- a/packages/gitbook-markdown/lib/annotate_engine.js +++ /dev/null @@ -1,43 +0,0 @@ -function annotateEngine(src, rules, ruleTypes, ruleMap) { - var tokens = []; - - while(src) { - // Pick rule - var rule = ruleTypes.filter(function(ruleName, idx) { - var regex = rules[ruleName]; - return regex.exec(src); - })[0]; - - // No matching rules - if(!rule) { - throw new Error('No rule found for: ' + src); - } - - // Use rule to extract block - var ruleRegex = rules[rule]; - var block = ruleRegex.exec(src); - - // Get rule type - var type = ruleMap[rule] || rule; - - // Get raw text - var raw = block[0]; - - // Break out here to avoid infinite loops - if(raw.length === 0) { - break; - } - - tokens.push({ - type: ruleMap[rule] || rule, - raw: raw, - }); - - // Update source - src = src.substring(raw.length); - } - - return tokens; -} - -module.exports = annotateEngine; |