Sha256: 6edbf740653f701c238514e3509e4b666fd6d280374aff3e681798216e2b5eda
Contents?: true
Size: 995 Bytes
Versions: 8
Compression:
Stored size: 995 Bytes
Contents
begin require "rinku" rescue LoadError => _ raise HTML::Pipeline::MissingDependencyError, "Missing dependency 'rinku' for AutolinkFilter. See README.md for details." end module HTML class Pipeline # HTML Filter for auto_linking urls in HTML. # # Context options: # :autolink - boolean whether to autolink urls # :link_attr - HTML attributes for the link that will be generated # :skip_tags - HTML tags inside which autolinking will be skipped. # See Rinku.skip_tags # :flags - additional Rinku flags. See https://github.com/vmg/rinku # # This filter does not write additional information to the context. class AutolinkFilter < Filter def call return html if context[:autolink] == false skip_tags = context[:skip_tags] flags = 0 flags |= context[:flags] if context[:flags] Rinku.auto_link(html, :urls, context[:link_attr], skip_tags, flags) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems