|
@ -1,13 +1,12 @@ |
|
|
'use strict'; |
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var StateInline = require('../rules_inline/state_inline'); |
|
|
|
|
|
var parseLinkDestination = require('../helpers/parse_link_destination'); |
|
|
var parseLinkDestination = require('../helpers/parse_link_destination'); |
|
|
var parseLinkTitle = require('../helpers/parse_link_title'); |
|
|
var parseLinkTitle = require('../helpers/parse_link_title'); |
|
|
var normalizeReference = require('../helpers/normalize_reference'); |
|
|
var normalizeReference = require('../helpers/normalize_reference'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function parseReference(str, parser, options, env) { |
|
|
function parseReference(str, md, env) { |
|
|
var state, pos, code, start, href, title, label, ch, max, |
|
|
var state, pos, code, start, href, title, label, ch, max, |
|
|
labelEnd = -1; |
|
|
labelEnd = -1; |
|
|
|
|
|
|
|
@ -15,7 +14,7 @@ function parseReference(str, parser, options, env) { |
|
|
|
|
|
|
|
|
if (str.indexOf(']:') === -1) { return -1; } |
|
|
if (str.indexOf(']:') === -1) { return -1; } |
|
|
|
|
|
|
|
|
state = new StateInline(str, parser, options, env, []); |
|
|
state = new md.inline.State(str, md, env, []); |
|
|
max = state.posMax; |
|
|
max = state.posMax; |
|
|
|
|
|
|
|
|
for (pos = 1; pos < max; pos++) { |
|
|
for (pos = 1; pos < max; pos++) { |
|
@ -93,7 +92,7 @@ module.exports = function references(state) { |
|
|
|
|
|
|
|
|
content = tokens[i].content; |
|
|
content = tokens[i].content; |
|
|
while (content.length) { |
|
|
while (content.length) { |
|
|
pos = parseReference(content, state.inline, state.options, state.env); |
|
|
pos = parseReference(content, state.md, state.env); |
|
|
if (pos < 0) { break; } |
|
|
if (pos < 0) { break; } |
|
|
content = content.slice(pos).trim(); |
|
|
content = content.slice(pos).trim(); |
|
|
} |
|
|
} |
|
|