tent.io/lib/api_example.rb
2012-09-06 22:22:53 -04:00

16 lines
275 B
Ruby

require 'tent-apidoc'
class ApiExampleFilter < Nanoc::Filter
identifier :api_example
type :text
def run(content, params={})
content.gsub(/\{(\w+) example\}/) { api_example($1) }
end
private
def api_example(id)
TentApiDoc.examples[id.to_sym]
end
end