lib/showoff.rb in showoff-0.0.1 vs lib/showoff.rb in showoff-0.0.2
- old
+ new
@@ -1,9 +1,10 @@
require 'rubygems'
require 'sinatra/base'
require 'json'
require 'nokogiri'
+require 'showoff_utils'
begin
require 'rdiscount'
rescue LoadError
require 'bluecloth'
@@ -34,10 +35,18 @@
files = Dir.glob("#{section}/**/*").sort
pp files
files
end
+ def css_files
+ Dir.glob("#{options.pres_dir}/*.css").map { |path| File.basename(path) }
+ end
+
+ def js_files
+ Dir.glob("#{options.pres_dir}/*.js").map { |path| File.basename(path) }
+ end
+
def process_markdown(name, content)
slides = content.split('!SLIDE')
slides.delete('')
final = ''
if slides.size > 1
@@ -109,13 +118,13 @@
get '/' do
erb :index
end
- get '/image/*' do
- img_file = params[:splat].join('/')
- img = File.join(options.pres_dir, img_file)
- send_file img
+ get %r{(?:image|file)/(.*)} do
+ path = params[:captures].first
+ full_path = File.join(options.pres_dir, path)
+ send_file full_path
end
get '/slides' do
index = File.join(options.pres_dir, 'showoff.json')
files = []