Sha256: 52b8443fab14e0755544d5fb04aff564cc1cd16ece4fe7e38dfb7226ceb9b9e6
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'wparser/parse' module Inlines class Http < Parse # (?<![.,?\!]) 1.8.7では後読みが出来ない、どーするか。 def self.parse text url_rex = %r! \b ( https?:// [-a-z0-9]+(\.[-a-z0-9]+)*\.(?:com |edu |biz |org |gov |in(?:t|fo) |mil |net |name |museum |coop |aero |[a-z][a-z]) \b (?: / [-a-z0-9_:\@&?=+,.\!/~*'%\$]*[^.,?\!] )? \b ) !x @result = text.gsub(url_rex){|s| "<a href=\"#$1\">#$1</a>"} super end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wparser-0.1.3 | lib/wparser/inline/http.rb |