Sha256: 648ed56a3adfdf53e52f3e96191153f6a8e27979b51c76a5bdbb84ac35d52373

Contents?: true

Size: 398 Bytes

Versions: 3

Compression:

Stored size: 398 Bytes

Contents

module Troy
  module Helpers
    def h(content)
      CGI.escapeHTML(content)
    end

    def partial(name, locals = {})
      path = site.root.join("partials/_#{name}.erb")
      EmbeddedRuby.new(path.read, locals.merge(site: site)).render
    end

    def inline_file(path)
      site.root.join(path).read
    end

    def markdown(text)
      Troy::Markdown.new(text).to_html
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troy-0.0.26 lib/troy/helpers.rb
troy-0.0.25 lib/troy/helpers.rb
troy-0.0.24 lib/troy/helpers.rb