Method: Jdoc::Generator#call

Defined in:
lib/jdoc/generator.rb

#callString

Note:

Add some fix to adapt to GitHub anchor style

Generates Markdown or HTML documentation from JSON schema

Returns:

  • (String)

    Generated text



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jdoc/generator.rb', line 26

def call
  markdown = markdown_renderer.result(schema: schema)
  if @html
    html = markdown_parser.render(markdown)
    html =  html_renderer.result(body: html)
    html.gsub(/id="(.+)"/) {|text| text.tr("/:", "") }
  else
    markdown
  end
rescue Jdoc::Link::ExampleNotFound => exception
  abort("Error: #{exception.to_s}")
end