markdown: Move handleLinkifier.

All the other handleFoo functions followed this
convention.
This commit is contained in:
Steve Howell
2022-03-29 17:55:46 +00:00
committed by Tim Abbott
parent efdf2c8fe3
commit 2a240d3e19
2 changed files with 15 additions and 16 deletions

View File

@@ -8,20 +8,6 @@ export function get_linkifier_map() {
return linkifier_map;
}
function handleLinkifier(pattern, matches) {
let url = linkifier_map.get(pattern);
let current_group = 1;
for (const match of matches) {
const back_ref = "\\" + current_group;
url = url.replace(back_ref, match);
current_group += 1;
}
return url;
}
function python_to_js_linkifier(pattern, url) {
// Converts a python named-group regex to a javascript-compatible numbered
// group regex... with a regex!
@@ -102,6 +88,4 @@ export function update_linkifier_rules(linkifiers) {
export function initialize(linkifiers) {
update_linkifier_rules(linkifiers);
marked.setOptions({linkifierHandler: handleLinkifier});
}