Class: Middleman::Renderers::KnitrTemplate

Inherits:
Tilt::KnitrTemplate
  • Object
show all
Defined in:
lib/middleman-knitr.rb

Overview

knitr template github.com/yihui/knitr

Instance Method Summary collapse

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/middleman-knitr.rb', line 10

def evaluate(scope, locals, &block)
        # Default figure path to knitr default
        @fig_path = "figure"
        # Set figure path relative to file if using Middleman, which tells us the filepath
        if (!scope.nil? && scope.is_a?(Middleman::Application))
            @fig_path = Pathname.new("#{scope.source_dir}/#{scope.current_page.url}/figure").relative_path_from(Pathname.new(scope.root)).to_s
        end
        super
end