Update and improve Drupal documentation (7.50)

pull/438/head
Thibaut Courouble 9 years ago
parent 33187426d9
commit a120b88545

@ -1,6 +0,0 @@
#= require views/pages/base
class app.views.DrupalPage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('pre.php'), 'php'
return

@ -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 =

@ -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

@ -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?

@ -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
&copy; 2001&ndash;2015 by the original authors<br>
&copy; 2001&ndash;2016 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
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

Loading…
Cancel
Save