Add API example generator via tent-apidoc

This commit is contained in:
Jonathan Rudenberg 2012-09-04 16:13:19 -04:00
parent 89e20162ed
commit 9b4d94cd2f
4 changed files with 138 additions and 8 deletions

16
lib/api_example.rb Normal file
View file

@ -0,0 +1,16 @@
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