diff --git a/assets/javascripts/views/pages/drupal.coffee b/assets/javascripts/views/pages/drupal.coffee
deleted file mode 100644
index 502b2200..00000000
--- a/assets/javascripts/views/pages/drupal.coffee
+++ /dev/null
@@ -1,6 +0,0 @@
-#= require views/pages/base
-
-class app.views.DrupalPage extends app.views.BasePage
- prepare: ->
- @highlightCode @findAll('pre.php'), 'php'
- return
diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee
index 5f5b11de..c9ea3fde 100644
--- a/assets/javascripts/views/pages/simple.coffee
+++ b/assets/javascripts/views/pages/simple.coffee
@@ -10,6 +10,7 @@ app.views.AngularPage =
app.views.AngularjsPage =
app.views.CakephpPage =
app.views.ChaiPage =
+app.views.DrupalPage =
app.views.ElixirPage =
app.views.EmberPage =
app.views.ExpressPage =
diff --git a/lib/docs/filters/drupal/clean_html.rb b/lib/docs/filters/drupal/clean_html.rb
index 726577d1..dadddc40 100644
--- a/lib/docs/filters/drupal/clean_html.rb
+++ b/lib/docs/filters/drupal/clean_html.rb
@@ -17,12 +17,13 @@ module Docs
at_css('#main').replace(at_css('.content'))
at_css('#page-heading').replace(at_css('#page-subtitle'))
- css('th.views-field > a', '.content').each do |node|
+ css('th.views-field > a', '.content', 'ins').each do |node|
node.before(node.children).remove
end
css('pre').each do |node|
node.content = node.content
+ node['data-language'] = 'php'
end
# Replaces the signature table from api.drupal.org with a simple pre tag
diff --git a/lib/docs/filters/drupal/entries.rb b/lib/docs/filters/drupal/entries.rb
index 50979500..867b5534 100644
--- a/lib/docs/filters/drupal/entries.rb
+++ b/lib/docs/filters/drupal/entries.rb
@@ -3,13 +3,14 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('#page-subtitle').content
- name.remove! %r{(abstract|public|static|protected|final|function|class)\s+}
+ name.remove! %r{(abstract|public|static|protected|final|function|class|constant|interface|property|global)\s+}
name
end
def get_type
- type = css('.breadcrumb > a')[1].content.strip
- type.split('.').first
+ links = css('.breadcrumb > a')
+ type = links.length > 1 ? links[1].content.strip : name
+ type.split(/[\.\-]/).first
end
def include_default_entry?
diff --git a/lib/docs/scrapers/drupal.rb b/lib/docs/scrapers/drupal.rb
index 7efdd616..09843d79 100644
--- a/lib/docs/scrapers/drupal.rb
+++ b/lib/docs/scrapers/drupal.rb
@@ -1,11 +1,10 @@
module Docs
class Drupal < UrlScraper
self.type = 'drupal'
- self.release = '7.40'
self.base_url = 'https://api.drupal.org/api/drupal/'
- self.initial_paths = %w(groups groups?page=1)
self.links = {
- home: 'https://www.drupal.org/'
+ home: 'https://www.drupal.org/',
+ code: 'http://cgit.drupalcode.org/drupal'
}
html_filters.push 'drupal/entries', 'drupal/clean_html', 'title'
@@ -15,19 +14,11 @@ module Docs
options[:title] = false
options[:root_title] = 'Drupal'
- options[:only_patterns] = [
- /\/class\/[^\/]+/,
- /\/group\/[^\/]+/,
- /\/function\/[^\/]+/]
-
options[:skip_link] = ->(link) { link['href'] =~ /[\?&]order/ }
options[:skip_patterns] = [
- /\/group\/updates\-7/,
- /\/group\/updates\-6/,
+ /\/group\/updates\-\d/,
/_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
@@ -35,18 +26,46 @@ module Docs
/\/function\/references\//, # Skip function references listings
/\/function\/implementations\//, # Skip hook implementation listings
/\/function\/theme_references\//, # Skip hook references listings
- /\.test\/function\// # Skip test files
+ /\.test\//, # Skip test files
+ /_test\//, # Skip test files
+ /\.test\.module\//, # Skip test files
+ /_test\.module\//, # Skip test files
+ /_test_/, # Skip test files
+ /_test\./, # Skip test files
+ /tests/,
+ /testing/,
+ /upgrade/,
+ /DRUPAL_ROOT/,
+ /simpletest/,
+ /constant\/constants/,
+ /interface\/implements/,
+ /interface\/hierarchy/,
+ /theme_invokes/
]
- options[:fix_urls] = ->(url) do
- url.remove! %r{/7$}
- url
- end
-
options[:attribution] = <<-HTML
- © 2001–2015 by the original authors
+ © 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
HTML
+
+ version '7' do
+ self.release = '7.50'
+ self.root_path = '7.x'
+ self.initial_paths = %w(groups/7.x groups/7.x?page=1)
+
+ options[:only_patterns] = [
+ /\/class\/[^\/]+\/7\.x\z/,
+ /\/group\/[^\/]+\/7\.x\z/,
+ /\/function\/[^\/]+\/7\.x\z/,
+ /\/constant\/[^\/]+\/7\.x\z/,
+ /\/interface\/[^\/]+\/7\.x\z/,
+ /\/property\/[^\/]+\/7\.x\z/,
+ /\/global\/[^\/]+\/7\.x\z/,
+ /modules.*\/7\.x\z/,
+ /includes.*\/7\.x\z/,
+ /\A[\w\-\.]+\.php\/7\.x\z/
+ ]
+ end
end
end