Remove dependency on tent-apidoc
This commit is contained in:
parent
101f7f49d1
commit
e8ac6de51f
5 changed files with 334 additions and 135 deletions
|
@ -1,9 +1,11 @@
|
|||
require 'tent-apidoc'
|
||||
require 'yaml'
|
||||
|
||||
class ApiExampleFilter < Nanoc::Filter
|
||||
identifier :api_example
|
||||
type :text
|
||||
|
||||
DATA = YAML.load(File.read('content/docs/api_examples.yaml'))
|
||||
|
||||
def run(content, params={})
|
||||
content.gsub(/\{(\w+) example\}/) { api_example($1) }.gsub(/\{(\w+) var\}/) { api_var($1) }
|
||||
end
|
||||
|
@ -11,10 +13,10 @@ class ApiExampleFilter < Nanoc::Filter
|
|||
private
|
||||
|
||||
def api_example(id)
|
||||
TentApiDoc.examples[id.to_sym]
|
||||
DATA[:examples][id.to_sym]
|
||||
end
|
||||
|
||||
def api_var(id)
|
||||
TentApiDoc.variables[id.to_sym]
|
||||
DATA[:variables][id.to_sym]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue