1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-27 14:48:19 +00:00

Added run parse for external links

This commit is contained in:
Jeremy Ruston 2012-06-05 14:43:43 +01:00
parent 55dd392fe4
commit 10fb5fd11c

View 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];
};
})();