Add some app examples

This commit is contained in:
Jonathan Rudenberg 2012-09-05 22:35:31 -04:00
parent 966052ce82
commit 3fedbc2a71
3 changed files with 29 additions and 139 deletions

View file

@ -5,7 +5,7 @@ class ApiExampleFilter < Nanoc::Filter
type :text
def run(content, params={})
content.gsub(/\{(\w+) example\}/) { api_example($1) }
content.gsub(/\{(\w+) example\}/) { api_example($1) }.gsub(/\{(\w+) var\}/) { api_var($1) }
end
private
@ -13,4 +13,8 @@ class ApiExampleFilter < Nanoc::Filter
def api_example(id)
TentApiDoc.examples[id.to_sym]
end
def api_var(id)
TentApiDoc.variables[id.to_sym]
end
end