Class: Codex::Content

Inherits:
Object
  • Object
show all
Defined in:
lib/codex/content.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Content

Returns a new instance of Content.



5
6
7
8
# File 'lib/codex/content.rb', line 5

def initialize(filename)
  @filename = filename
  @original = File.read(@filename).sub(/__END__.*/m, '').gsub(/__SKIP__.*?__ENDSKIP__/m, '')
end

Instance Method Details

#to_htmlObject



10
11
12
13
14
# File 'lib/codex/content.rb', line 10

def to_html
  content = Codex::Filters.instance.filter_all(@original)
  html = Codex::TemplateHandler.choose(@filename).call(content)
  Codex::PostProcessors.instance.process_all(html)
end