Sha256: f8b7eb14a23079d349e9d6bf862af5cb9c9275c5d686d71c8e5e3578ca855c4e
Contents?: true
Size: 884 Bytes
Versions: 11
Compression:
Stored size: 884 Bytes
Contents
# -*- coding: utf-8; frozen_string_literal: true -*- # #-- # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at> # # This file is part of kramdown which is licensed under the MIT. #++ # module Kramdown module Parser class Kramdown ACHARS = '[[:alnum:]]-_.' AUTOLINK_START_STR = "<((mailto|https?|ftps?):.+?|[#{ACHARS}]+?@[#{ACHARS}]+?)>" AUTOLINK_START = /#{AUTOLINK_START_STR}/u # Parse the autolink at the current location. def parse_autolink start_line_number = @src.current_line_number @src.pos += @src.matched_size href = (@src[2].nil? ? "mailto:#{@src[1]}" : @src[1]) el = Element.new(:a, nil, {'href' => href}, location: start_line_number) add_text(@src[1].sub(/^mailto:/, ''), el) @tree.children << el end define_parser(:autolink, AUTOLINK_START, '<') end end end
Version data entries
11 entries across 11 versions & 3 rubygems