Skip to content

Commit

Permalink
Various fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Jul 22, 2009
1 parent 84ad114 commit e4aa3cf
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/ecstatic.rb
Expand Up @@ -45,7 +45,11 @@ def initialize(params = {})
:title => p['title'],
:layoutfile => p['layout'] || @default_layout,
:templatefile => File.join(@templatesdir, p['template']),
:format => p['format'] || :html,
:format => if p['format']
p['format'].to_sym
else
:html
end,
:navhash => @navhash,
:datafiles => if p['data'].class == Array
File.join @datadir, p['data']
Expand Down Expand Up @@ -122,9 +126,14 @@ def initialize(params)
yaml.each_pair do |key,val|
model = key.singularize.capitalize
begin
@contexthash[key] = Object.const_get(model).from_array(val)
mod = Object.const_get(model)
begin
@contexthash[key] = mod.from_array(val)
rescue
$stderr.puts("Unable to initialize " + key + " from model " + model)
throw :unable_to_initialize
end
rescue
$stderr.puts("Unable to initialize " + key + " from model " + model)
@contexthash[key] = val
end
end
Expand All @@ -140,8 +149,6 @@ def render
"pandoc -r markdown -w html --smart"
when :latex
"pandoc -r markdown -w latex --smart"
when :pdf
"pandoc -r markdown -w latex --smart | rubber-pipe --pdf"
when :plain
"cat"
end
Expand Down Expand Up @@ -184,7 +191,7 @@ def mkmenu(menu, url = nil)
else
""
end
_buf << "<li><a href=#{v}#{selected}>#{k}</a></li>"
_buf << "<li#{selected}><a href=#{v}>#{k}</a></li>"
end
end
else
Expand Down

0 comments on commit e4aa3cf

Please sign in to comment.