mirror of https://github.com/freeCodeCamp/devdocs
parent
5bb96f804a
commit
e1e4a626ff
@ -0,0 +1,11 @@
|
||||
module Docs
|
||||
class Padrino
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.summary_toggle').remove
|
||||
css('.inheritanceTree').remove
|
||||
at_css('#content')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,35 @@
|
||||
module Docs
|
||||
class Padrino
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('h1, h2').content
|
||||
name.remove! 'Class: '
|
||||
name.remove! 'Module: '
|
||||
end
|
||||
|
||||
def get_type
|
||||
type = name.dup
|
||||
type.remove! %r{#.+\z}
|
||||
type.split('::')[0..2].join('::')
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] if root_page?
|
||||
require 'cgi'
|
||||
|
||||
css('.summary_signature').inject [] do |entries, node|
|
||||
|
||||
name = node.children[1].attributes['title'].value
|
||||
name = CGI.unescape(name)
|
||||
|
||||
unless name.start_with?('_')
|
||||
name.prepend self.name
|
||||
entries << [name, self.name.gsub('::','/').downcase.strip + node.children[1].attributes['href'].value.slice(/\#.*/)] unless entries.any? { |entry| entry[0] == name }
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Padrino < UrlScraper
|
||||
self.name = 'padrino'
|
||||
self.slug = 'padrino'
|
||||
self.type = 'ruby'
|
||||
self.version = 'master'
|
||||
self.release = '0.13.2'
|
||||
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<br>
|
||||
Licensed under the Creative Commons Attribution License.
|
||||
HTML
|
||||
end
|
||||
end
|
Loading…
Reference in new issue