lib/slippery/rake_tasks.rb in slippery-0.1.0 vs lib/slippery/rake_tasks.rb in slippery-0.2.0

- old
+ new

@@ -25,26 +25,37 @@ def presentation_names presentations.map {|path| [ path.basename(path.extname), path ] } end def markdown_to_hexp(infile, options = {}) + @infile = infile doc = Slippery::Document.new(infile.read) doc = Slippery::Presentation.new(doc, @options.merge(options)) - doc.process(*processors.reject {|pr| options[:skip_self_contained] && pr == Slippery::Processors::SelfContained}) + doc.process(*processors) end def processor(selector, &blk) processors << ->(node) do node.replace(selector) do |node| instance_exec(node, &blk) end end end - def self_contained - processors << Slippery::Processors::SelfContained + def include_assets + processors << method(:call_asset_packer) end + alias self_contained include_assets + + def call_asset_packer(doc) + AssetPacker::Processor::Local.new( + @infile.to_s, + @infile.dirname.join('assets'), + @infile + ).(doc) + end + def title(title) processor 'head' do |head| head <<= H[:title, title] end