mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 22:33:50 +00:00
Added run parse for external links
This commit is contained in:
parent
55dd392fe4
commit
10fb5fd11c
33
core/modules/parsers/newwikitextparser/rules/extlink.js
Normal file
33
core/modules/parsers/newwikitextparser/rules/extlink.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/parsers/newwikitextparser/rules/extlink.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: wikitextrule
|
||||||
|
|
||||||
|
Wiki text run rule for external links
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.name = "extlink";
|
||||||
|
|
||||||
|
exports.runParser = true;
|
||||||
|
exports.blockParser = true;
|
||||||
|
|
||||||
|
exports.regExpString = "(?:file|http|https|mailto|ftp|irc|news|data):[^\\s'\"]+(?:/|\\b)";
|
||||||
|
|
||||||
|
exports.parse = function(match,isBlock) {
|
||||||
|
this.pos = match.index + match[0].length;
|
||||||
|
var macroNode = $tw.Tree.Macro("link",{
|
||||||
|
srcParams: {to: match[0]},
|
||||||
|
content: [$tw.Tree.Text(match[0])],
|
||||||
|
wiki: this.wiki
|
||||||
|
});
|
||||||
|
this.dependencies.mergeDependencies(macroNode.dependencies);
|
||||||
|
return [macroNode];
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
Loading…
x
Reference in New Issue
Block a user