Class: Gollum::Filter::Sanitize

Inherits:
Gollum::Filter show all
Defined in:
lib/gollum-lib/filter/sanitize.rb

Instance Method Summary collapse

Methods inherited from Gollum::Filter

#initialize

Methods included from Helpers

#trim_leading_slash

Constructor Details

This class inherits a constructor from Gollum::Filter

Instance Method Details

#extract(data) ⇒ Object



4
5
6
# File 'lib/gollum-lib/filter/sanitize.rb', line 4

def extract(data)
  data
end

#process(data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/gollum-lib/filter/sanitize.rb', line 8

def process(data)
  if @markup.sanitize
    doc = Nokogiri::HTML::DocumentFragment.parse(data)
    doc = @markup.sanitize.clean_node!(doc)

    doc.to_xml(@markup.to_xml_opts)
  else
    data
  end
end