lib/slideoff/presentation.rb in slideoff-0.2 vs lib/slideoff/presentation.rb in slideoff-0.3
- old
+ new
@@ -38,14 +38,14 @@
end
def path_for_asset(asset)
[CONFIG, theme, common].each { |dir| convert_styles(dir) }
- Dir[ "#{CONFIG.dir}#{asset}"].first ||
- Dir[ "#{theme.dir}#{asset}"].first ||
- Dir[ "#{common.dir}#{asset}"].first ||
- Dir["#{CONFIG.dir}/**#{asset}"].first
+ Dir[ "#{CONFIG.pwd}#{asset}"].first ||
+ Dir[ "#{theme.dir}#{asset}"].first ||
+ Dir[ "#{common.dir}#{asset}"].first ||
+ Dir["#{CONFIG.pwd}/**#{asset}"].first
end
def convert_styles(dir)
if Dir.exist?("#{dir}/styles") && !Dir.exist?("#{dir}/css")
Dir.chdir(dir) { `sass --update styles:css` }
@@ -54,11 +54,11 @@
protected
def build_theme(title)
Theme.new.tap do |t|
- dir = File.expand_path("~/.slideoff/#{title}")
+ dir = File.expand_path("#{CONFIG.dir}/themes/#{title}")
if File.exists?(dir)
t.dir = dir
else
t.dir = File.expand_path("../../../themes/#{title}", __FILE__)
end
@@ -70,10 +70,10 @@
end
end
def sections
@parts.map.with_index do |(dir, options), section_num|
- raw = Dir["#{CONFIG.dir}/#{dir}/**/*.md"].sort.map do |f|
+ raw = Dir["#{CONFIG.pwd}/#{dir}/**/*.md"].sort.map do |f|
File.read(f)
end.join("\n\n")
parts = raw.split(/!SLIDE */)
parts.delete('')
slide_num_diff = [options["show_chapter"], options["show_toc"]].count(true)