aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-09-08 09:10:47 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-09-11 11:17:40 -0700
commit9ead350be9302268214801ef966f4f50efc4996a (patch)
tree18c33b11d0edd55bb726205f777cd66028bdc048 /js
parent33a425b931b844691b5e4ca4b63101d8566ab159 (diff)
Did parseAutolink.
Diffstat (limited to 'js')
-rwxr-xr-xjs/stmd.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/js/stmd.js b/js/stmd.js
index 5fb0fb5..330ebef 100755
--- a/js/stmd.js
+++ b/js/stmd.js
@@ -199,21 +199,21 @@ var parseBackslash = function() {
};
// Attempt to parse an autolink (URL or email in pointy brackets).
-var parseAutolink = function(inlines) {
+var parseAutolink = function() {
var m;
var dest;
if ((m = this.match(/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/))) { // email autolink
dest = m.slice(1,-1);
- inlines.push({ t: 'Link', label: [{ t: 'Str', c: dest }],
- destination: 'mailto:' + dest });
- return m.length;
+ return {t: 'Link',
+ label: [{ t: 'Str', c: dest }],
+ destination: 'mailto:' + dest };
} else if ((m = this.match(/^<(?:coap|doi|javascript|aaa|aaas|about|acap|cap|cid|crid|data|dav|dict|dns|file|ftp|geo|go|gopher|h323|http|https|iax|icap|im|imap|info|ipp|iris|iris.beep|iris.xpc|iris.xpcs|iris.lwz|ldap|mailto|mid|msrp|msrps|mtqp|mupdate|news|nfs|ni|nih|nntp|opaquelocktoken|pop|pres|rtsp|service|session|shttp|sieve|sip|sips|sms|snmp|soap.beep|soap.beeps|tag|tel|telnet|tftp|thismessage|tn3270|tip|tv|urn|vemmi|ws|wss|xcon|xcon-userid|xmlrpc.beep|xmlrpc.beeps|xmpp|z39.50r|z39.50s|adiumxtra|afp|afs|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|chrome|chrome-extension|com-eventbrite-attendee|content|cvs|dlna-playsingle|dlna-playcontainer|dtn|dvb|ed2k|facetime|feed|finger|fish|gg|git|gizmoproject|gtalk|hcp|icon|ipn|irc|irc6|ircs|itms|jar|jms|keyparc|lastfm|ldaps|magnet|maps|market|message|mms|ms-help|msnim|mumble|mvn|notes|oid|palm|paparazzi|platform|proxy|psyc|query|res|resource|rmi|rsync|rtmp|secondlife|sftp|sgn|skype|smb|soldat|spotify|ssh|steam|svn|teamspeak|things|udp|unreal|ut2004|ventrilo|view-source|webcal|wtai|wyciwyg|xfire|xri|ymsgr):[^<>\x00-\x20]*>/i))) {
dest = m.slice(1,-1);
- inlines.push({ t: 'Link', label: [{ t: 'Str', c: dest }],
- destination: dest });
- return m.length;
+ return { t: 'Link',
+ label: [{ t: 'Str', c: dest }],
+ destination: dest };
} else {
- return 0;
+ return null;
}
};
@@ -666,7 +666,7 @@ var parseInline = function() {
res = this.parseImage(inlines);
break;
case '<':
- res = this.parseAutolink(inlines) ||
+ res = this.parseAutolink() ||
this.parseHtmlTag();
break;
case '&':