Class: HTML::Pipeline::AutolinkFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/html/pipeline/autolink_filter.rb

Overview

HTML Filter for auto_linking urls in HTML.

Context options:

:autolink - boolean whether to autolink urls
:flags    - additional Rinku flags. See https://github.com/vmg/rinku

This filter does not write additional information to the context.

Instance Attribute Summary

Attributes inherited from Filter

#context, #result

Instance Method Summary collapse

Methods inherited from Filter

#base_url, call, #can_access_repo?, #current_user, #doc, #has_ancestor?, #html, #initialize, #needs, #parse_html, #repository, to_document, to_html, #validate

Constructor Details

This class inherits a constructor from HTML::Pipeline::Filter

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'lib/html/pipeline/autolink_filter.rb', line 13

def call
  return html if context[:autolink] == false
  flags = 0
  flags |= context[:flags] if context[:flags]

  Rinku.auto_link(html, :urls, nil, %w[a script kbd pre code], flags)
end