Add Drupal 8 documentation

pull/447/merge
Thibaut Courouble 9 years ago
parent 800622099f
commit c8c5a47692

@ -1,4 +1,6 @@
._drupal { ._drupal {
h3 { @extend %block-heading; } h3 { @extend %block-heading; }
.signature { @extend %note, %note-blue; } .signature { @extend %note, %note-blue; }
span.api-deprecated { @extend %label, %label-red; }
} }

@ -11,13 +11,23 @@ module Docs
end end
def other def other
css('.element-invisible', '#sidebar-first', '#api-alternatives', '#aside', '.comments', '.view-filters', css('.element-invisible',
'#api-function-signature tr:not(.active)', '.ctools-collapsible-container', 'img[width="13"]').remove '#sidebar-first',
'#api-alternatives',
'#aside',
'.comments',
'.view-filters',
'#api-function-signature tr:not(.active)',
'.ctools-collapsible-container',
'img[width="13"]',
'a:contains("Expanded class hierarchy")',
'a:contains("All classes that implement")'
).remove
at_css('#main').replace(at_css('.content')) at_css('#main').replace(at_css('.content'))
at_css('#page-heading').replace(at_css('#page-subtitle')) at_css('#page-heading').replace(at_css('#page-subtitle'))
css('th.views-field > a', '.content', 'ins').each do |node| css('th.views-field > a', '.content', 'ins', '.view', '.view-content', 'div.item-list').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end
@ -26,11 +36,14 @@ module Docs
node['data-language'] = 'php' node['data-language'] = 'php'
end end
# Replaces the signature table from api.drupal.org with a simple pre tag
css('#api-function-signature').each do |table| css('#api-function-signature').each do |table|
signature = table.css('.signature').first.at_css('code').inner_html signature = table.css('.signature').first.at_css('code').inner_html
table.replace '<pre class="signature">' + signature + '</pre>' table.replace '<pre class="signature">' + signature + '</pre>'
end end
css('table[class]', 'tr[class]', 'td[class]', 'th[class]').each do |node|
node.remove_attribute('class')
end
end end
end end
end end

@ -3,14 +3,25 @@ module Docs
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
name = at_css('#page-subtitle').content name = at_css('#page-subtitle').content
name.remove! %r{(abstract|public|static|protected|final|function|class|constant|interface|property|global)\s+} name.remove! %r{(abstract|public|static|protected|private|final|function|class|constant|interface|property|global|trait)\s+}
name name
end end
def get_type def get_type
links = css('.breadcrumb > a') if subpath =~ /Drupal!Core!([^!]+)!/ ||
type = links.length > 1 ? links[1].content.strip : name subpath =~ /Drupal!Component!([^!]+)!/ ||
type.split(/[\.\-]/).first subpath =~ /core!modules!([^!\/]+)/ ||
subpath =~ /core!includes!([^!\/]+)/
$1.underscore
elsif subpath =~ /Drupal!Core/
'core'
elsif subpath =~ /Drupal!Component/
'component'
elsif subpath =~ /core!themes/
'themes'
else
css('.breadcrumb > a')[1].content
end
end end
def include_default_entry? def include_default_entry?

@ -17,29 +17,23 @@ module Docs
options[:skip_link] = ->(link) { link['href'] =~ /[\?&]order/ } options[:skip_link] = ->(link) { link['href'] =~ /[\?&]order/ }
options[:skip_patterns] = [ options[:skip_patterns] = [
/test/i,
/_update_[0-9]{4}/,
/\/group\/updates\-\d/, /\/group\/updates\-\d/,
/_update_[0-9]{4}/, # Skip update functions /interface\/implements/,
/\/class\/hierarchy\//, # Skip class hierarchy listings /\/(class|interface|trait)\/hierarchy\//,
/\/function\/calls\//, # Skip function calls listings /\/(class|interface|trait)\/uses\//,
/\/function\/invokes\//, # Skip function invokations listings /\/(class|interface|trait)\/references\//,
/\/function\/overrides\//, # Skip function overrides listings /\/(class|interface|trait)\/annotations\//,
/\/function\/references\//, # Skip function references listings /\/function\/calls\//,
/\/function\/implementations\//, # Skip hook implementation listings /\/function\/invokes\//,
/\/function\/theme_references\//, # Skip hook references listings /\/function\/overrides\//,
/\.test\//, # Skip test files /\/function\/references\//,
/_test\//, # Skip test files /\/function\/implementations\//,
/\.test\.module\//, # Skip test files /\/function\/theme_references\//,
/_test\.module\//, # Skip test files
/_test_/, # Skip test files
/_test\./, # Skip test files
/tests/,
/testing/,
/upgrade/, /upgrade/,
/DRUPAL_ROOT/, /DRUPAL_ROOT/,
/simpletest/,
/constant\/constants/, /constant\/constants/,
/interface\/implements/,
/interface\/hierarchy/,
/theme_invokes/ /theme_invokes/
] ]
@ -49,6 +43,43 @@ module Docs
Drupal is a registered trademark of Dries Buytaert. Drupal is a registered trademark of Dries Buytaert.
HTML HTML
version '8' do
self.release = '8.1.7'
self.root_path = '8.1.x'
self.initial_paths = %w(groups/8.1.x groups/8.1.x?page=1)
options[:only_patterns] = [
/\/class\/[^\/]+\/8\.1\.x\z/,
/\/group\/[^\/]+\/8\.1\.x\z/,
/\/function\/[^\/]+\/8\.1\.x\z/,
/\/constant\/[^\/]+\/8\.1\.x\z/,
/\/interface\/[^\/]+\/8\.1\.x\z/,
/\/property\/[^\/]+\/8\.1\.x\z/,
/\/global\/[^\/]+\/8\.1\.x\z/,
/\/trait\/[^\/]+\/8\.1\.x\z/,
/modules.*\/8\.1\.x\z/,
/includes.*\/8\.1\.x\z/,
/\A[\w\-\.]+\.php\/8\.1\.x\z/
]
options[:skip] = %w(index.php/8.1.x update.php/8.1.x)
options[:skip_patterns] += [
/[^\w\-\.].*\.php\/8\.1\.x\z/,
/\!src\!/,
/migrate/,
/Assertion/,
/listing_page/,
/update_api/,
/vendor/,
/deprecated/,
/namespace/,
/\.yml/,
/Plugin/,
/\.theme\//
]
end
version '7' do version '7' do
self.release = '7.50' self.release = '7.50'
self.root_path = '7.x' self.root_path = '7.x'

Loading…
Cancel
Save