Skip to content

Commit

Permalink
Set page title based on settings in showoff.json.
Browse files Browse the repository at this point in the history
  • Loading branch information
roidrage committed May 27, 2010
1 parent 7db2772 commit ae5f189
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/showoff.rb
Expand Up @@ -328,7 +328,7 @@ def self.do_static(what)
end

get %r{/(.*)} do
@title = 'testing'
@title = ShowOffUtils.showoff_title
what = params[:captures].first
what = 'index' if "" == what
if (what != "favicon.ico")
Expand Down
9 changes: 9 additions & 0 deletions lib/showoff_utils.rb
Expand Up @@ -236,6 +236,15 @@ def self.showoff_sections(dir = '.')
order
end

def self.showoff_title(dir = '.')
index = File.join(dir, ShowOffUtils::SHOWOFF_JSON_FILE )
order = nil
if File.exists?(index)
data = JSON.parse(File.read(index))
data.is_a?(Hash) && data['name'] || "Presentation"
end
end

EXTENSIONS = {
'pl' => 'perl',
'rb' => 'ruby',
Expand Down

0 comments on commit ae5f189

Please sign in to comment.