Sha256: a834c5e4524d176622f4a88237c72912ca9b559e9ef1a143c1b2f7eadf45c683
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
# -*- coding: utf-8 -*- # #-- # Copyright (C) 2009 Thomas Leitner <t_leitner@gmx.at> # # This file is part of kramdown. # # kramdown is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. #++ # module Kramdown module Parser class Kramdown AUTOLINK_START = /<((mailto|https?|ftps?):.*?|\S*?@\S*?)>/ # Parse the autolink at the current location. def parse_autolink @src.pos += @src.matched_size href = @src[1] href= "mailto:#{href}" if @src[2].nil? el = Element.new(:a, nil, {:attr => {'href' => href}, :obfuscate_text => (@src[2].nil? || @src[2] == 'mailto')}) add_text(@src[1].sub(/^mailto:/, ''), el) @tree.children << el end define_parser(:autolink, AUTOLINK_START) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kramdown-0.4.0 | lib/kramdown/parser/kramdown/autolink.rb |
kramdown-0.3.0 | lib/kramdown/parser/kramdown/autolink.rb |