diff --git a/lib/docs/filters/padrino/clean_html.rb b/lib/docs/filters/padrino/clean_html.rb new file mode 100644 index 00000000..197ac410 --- /dev/null +++ b/lib/docs/filters/padrino/clean_html.rb @@ -0,0 +1,18 @@ +module Docs + class Padrino + class CleanHtmlFilter < Filter + def call + title = at_css('#filecontents h1') + @doc = at_css('#content') + + css('.highlight').each do |node| + node.name = 'pre' + node['data-lang'] = node.at_css('[data-lang]')['data-lang'] + node.content = node.content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/padrino/entries.rb b/lib/docs/filters/padrino/entries.rb new file mode 100644 index 00000000..0596e4ca --- /dev/null +++ b/lib/docs/filters/padrino/entries.rb @@ -0,0 +1,17 @@ +module Docs + class Padrino + class EntriesFilter < Docs::EntriesFilter + def get_name + node = at_css('h1') + result = node.content.strip + result << ' event' if type == 'Events' + result << '()' if node['class'].try(:include?, 'function') + result + end + + def get_type + return 'Ruby' + end + end + end +end diff --git a/lib/docs/scrapers/padrino.rb b/lib/docs/scrapers/padrino.rb new file mode 100644 index 00000000..15409509 --- /dev/null +++ b/lib/docs/scrapers/padrino.rb @@ -0,0 +1,20 @@ +module Docs + class Padrino < UrlScraper + self.name = 'padrino' + self.slug = 'padrino' + self.type = 'ruby' + self.version = 'master' + self.base_url = 'http://www.rubydoc.info/github/padrino/padrino-framework' + self.links = { + home: 'http://padrinorb.com/', + code: 'https://github.com/padrino/padrino-framework' + } + + html_filters.push 'padrino/clean_html', 'padrino/entries' + + options[:attribution] = <<-HTML + © Padrino contributors
+ Licensed under the Creative Commons Attribution License. + HTML + end +end