|
|
|
@ -1,38 +1,26 @@
|
|
|
|
|
module Docs
|
|
|
|
|
class Drupal < UrlScraper
|
|
|
|
|
self.name = 'Drupal'
|
|
|
|
|
self.type = 'drupal'
|
|
|
|
|
self.version = '7.37'
|
|
|
|
|
self.version = '7.38'
|
|
|
|
|
self.base_url = 'https://api.drupal.org/api/drupal/'
|
|
|
|
|
self.initial_paths = %w(
|
|
|
|
|
groups
|
|
|
|
|
groups?page=1)
|
|
|
|
|
|
|
|
|
|
html_filters.replace 'normalize_paths', 'drupal/normalize_paths'
|
|
|
|
|
html_filters.replace 'internal_urls', 'drupal/internal_urls'
|
|
|
|
|
self.initial_paths = %w(groups groups?page=1)
|
|
|
|
|
self.links = {
|
|
|
|
|
home: 'https://www.drupal.org/'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html_filters.push 'drupal/entries', 'drupal/clean_html', 'title'
|
|
|
|
|
|
|
|
|
|
options[:container] = '#page'
|
|
|
|
|
options[:decode_and_clean_paths] = true
|
|
|
|
|
options[:container] = '#page-inner'
|
|
|
|
|
options[:title] = false
|
|
|
|
|
options[:root_title] = 'Drupal - Open Source CMS | Drupal.org'
|
|
|
|
|
options[:root_title] = 'Drupal'
|
|
|
|
|
|
|
|
|
|
options[:only_patterns] = [
|
|
|
|
|
/\/class\/[^\/]+/,
|
|
|
|
|
/\/group\/[^\/]+/,
|
|
|
|
|
/\/function\/[^\/]+/]
|
|
|
|
|
|
|
|
|
|
options[:skip_link] = ->(link) {
|
|
|
|
|
begin
|
|
|
|
|
return unless q = URL.parse(link['href']).query
|
|
|
|
|
Hash[URI.decode_www_form(q)].has_key? "order"
|
|
|
|
|
rescue URI::InvalidURIError
|
|
|
|
|
false
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
options[:skip] = %w(
|
|
|
|
|
'modules-system-system.install/group/updates-7.x-extra/7',
|
|
|
|
|
'modules-system-system.install/group/updates-6.x-to-7.x/7')
|
|
|
|
|
options[:skip_link] = ->(link) { link['href'] =~ /[\?&]order/ }
|
|
|
|
|
|
|
|
|
|
options[:skip_patterns] = [
|
|
|
|
|
/\/group\/updates\-7/,
|
|
|
|
@ -40,26 +28,25 @@ module Docs
|
|
|
|
|
/_update_[0-9]{4}/, # Skip update functions
|
|
|
|
|
/\/[4-6](\.[0-9])*$/, # Skip previous versions
|
|
|
|
|
/\/[8-9](\.[0-9])*$/, # Skip future versions
|
|
|
|
|
/\/class\/hierarchy\//, # Skip class hierarchy listings
|
|
|
|
|
/\/function\/calls\//, # Skip function calls listings
|
|
|
|
|
/\/function\/invokes\//, # Skip function invokations listings
|
|
|
|
|
/\/function\/overrides\//, # Skip function overrides listings
|
|
|
|
|
/\/function\/references\//, # Skip function references listings
|
|
|
|
|
/\/function\/implementations\//, # Skip hook implementation listings
|
|
|
|
|
/\/function\/theme_references\//, # Skip hook references listings
|
|
|
|
|
/\.test\/function\// # Skip test files
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
options[:fix_urls] = ->(url) do
|
|
|
|
|
url.sub! /\/7$/, '' # Remove the version indicator from the current version
|
|
|
|
|
url.remove! %r{/7$}
|
|
|
|
|
url
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
options[:attribution] = <<-HTML
|
|
|
|
|
© 2000–2015 by the individual contributors.<br>
|
|
|
|
|
Licensed under the Creative Commons License, Attribution-ShareAlike2.0.<br>
|
|
|
|
|
© 2001–2015 by the original authors<br>
|
|
|
|
|
Licensed under the GNU General Public License, version 2 and later.<br>
|
|
|
|
|
Drupal is a registered trademark of Dries Buytaert.
|
|
|
|
|
HTML
|
|
|
|
|
|
|
|
|
|
# Method used at several places to fix special characters at urls from api.drupal.org
|
|
|
|
|
def self.fixUri(path)
|
|
|
|
|
p = path.gsub /%21|!|%2b|%3b|%3a/i, '-' # !+;:
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|