Module: PseudoHiki::AutoLink::URL

Defined in:
lib/pseudohiki/blockparser.rb

Class Method Summary collapse

Class Method Details

Returns:

  • (Boolean)


364
365
366
# File 'lib/pseudohiki/blockparser.rb', line 364

def self.auto_link_url?
  true
end

Returns:

  • (Boolean)


355
356
357
# File 'lib/pseudohiki/blockparser.rb', line 355

def self.in_link_tag?(preceding_str)
  preceding_str.end_with?(OPEN_TAG) or preceding_str.end_with?(LINK_SEP)
end


359
360
361
362
# File 'lib/pseudohiki/blockparser.rb', line 359

def self.link(line)
  return line unless URI_RE.match? line and not VERBATIM_LEAF_HEAD_RE.match? line
  line.gsub(URI_RE) {|url| in_link_tag?($`) ? url : "[[#{url}]]" }
end