diff --git a/addons/linkify/linkify.js b/addons/linkify/linkify.js index 543e5feb..9834183b 100644 --- a/addons/linkify/linkify.js +++ b/addons/linkify/linkify.js @@ -7,14 +7,14 @@ } else { /* * Plain browser environment - */ + */ linkify(this.Xterm); } })(function (Xterm) { 'use strict'; /** - * This module provides methods for convertings valid URL substrings + * This module provides methods for convertings valid URL substrings * into HTML anchor elements (links), inside a terminal view. * * @module xterm/addons/linkify/linkify @@ -31,8 +31,11 @@ bodyClause = hostClause + pathClause, start = '(?:^|' + negatedDomainCharacterSet + ')(', end = ')($|' + negatedPathCharacterSet + ')', - urlClause = start + protocolClause + '?' + bodyClause + end, - urlRegex = new RegExp(urlClause); + lenientUrlClause = start + protocolClause + '?' + bodyClause + end, + strictUrlClause = start + protocolClause + bodyClause + end, + lenientUrlRegex = new RegExp(lenientUrlClause), + strictUrlRegex = new RegExp(strictUrlClause); + /** * Converts all valid URLs found in the given terminal line into @@ -43,10 +46,12 @@ * @param {Xterm} terminal - The terminal that owns the given line. * @param {number|HTMLDivElement} line - The terminal line that should get * "linkified". + * @param {boolean} lenient - The regex type that will be used to identify links. If lenient is + * false, the regex requires a protocol clause. Defaults to true. * @emits linkify * @emits linkify:line */ - exports.linkifyTerminalLine = function (terminal, line) { + exports.linkifyTerminalLine = function (terminal, line, lenient) { if (typeof line == 'number') { line = terminal.rowContainer.children[line]; } else if (! (line instanceof HTMLDivElement)) { @@ -60,7 +65,8 @@ nodes = line.childNodes; for (var j=0; j