Class: Gollum::Filter::Render

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

Constant Summary

Constants inherited from Gollum::Filter

PLACEHOLDER_PATTERN

Instance Attribute Summary

Attributes inherited from Gollum::Filter

#close_pattern, #open_pattern

Instance Method Summary collapse

Methods inherited from Gollum::Filter

#initialize

Methods included from Helpers

#path_to_link_text, #trim_leading_slashes

Constructor Details

This class inherits a constructor from Gollum::Filter

Instance Method Details

#extract(data) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gollum-lib/filter/render.rb', line 4

def extract(data)
  begin
    working_dir = Pathname.new(@markup.wiki.path).join(@markup.dir)
    working_dir = working_dir.exist? ? working_dir.to_s : '.'
    Dir.chdir(working_dir) do
      data = GitHub::Markup.render_s(@markup.format, data)
    end
    if data.nil?
      raise "There was an error converting #{@markup.name} to HTML."
    end
  rescue Object => e
    data = html_error("Failed to render page: #{e.message}")
  end

  data
end

#process(data) ⇒ Object



21
22
23
24
# File 'lib/gollum-lib/filter/render.rb', line 21

def process(data)
  data = add_editable_header_class(data)
  data
end