django_rest_framework: finish scraper and filters

pull/1003/head
Jasper van Merle 6 years ago
parent 14049dac0c
commit cbe38c8f36

@ -231,6 +231,11 @@ credits = [
'Django Software Foundation and individual contributors',
'BSD',
'https://raw.githubusercontent.com/django/django/master/LICENSE'
], [
'Django REST Framework',
'2011-present Encode OSS Ltd.',
'BSD',
'https://raw.githubusercontent.com/encode/django-rest-framework/master/LICENSE.md'
], [
'Docker',
'2019 Docker, Inc.<br>Docker and the Docker logo are trademarks of Docker, Inc.',

@ -1,14 +1,14 @@
module Docs
class RestFramework
class DjangoRestFramework
class CleanHtmlFilter < Docs::Filter
def call
css('hr').remove
css('.badges').remove
css('pre').attr('data-language', 'python')
css('h1').attr('style', nil)
css('h1').remove_attribute('style')
css('.promo a').remove_attribute('style')
# Translate source files links to DevDocs links
links = Nokogiri::XML::Node.new('p', doc)
@ -20,6 +20,7 @@ module Docs
node['class'] = '_links-link'
links.add_child(node)
end
doc.add_child(links)
doc

@ -1,7 +1,6 @@
module Docs
class RestFramework
class DjangoRestFramework
class EntriesFilter < Docs::EntriesFilter
def get_name
name = css('h1').first.content
name.slice! 'Tutorial '

@ -1,8 +1,8 @@
module Docs
class RestFramework < Mkdocs
class DjangoRestFramework < Mkdocs
self.name = 'Django REST Framework'
self.release = '3.9.2'
self.slug = 'rest_framework'
self.release = '3.9.3'
self.slug = 'django_rest_framework'
self.base_url = 'https://www.django-rest-framework.org/'
self.root_path = 'index.html'
self.links = {
@ -10,7 +10,7 @@ module Docs
code: 'https://github.com/encode/django-rest-framework'
}
html_filters.push 'rest_framework/clean_html', 'rest_framework/entries'
html_filters.push 'django_rest_framework/clean_html', 'django_rest_framework/entries'
options[:skip_patterns] = [
/\Atopics\//,
@ -18,8 +18,12 @@ module Docs
]
options[:attribution] = <<-HTML
Copyright 2011&ndash;present Encode OSS Ltd<br>
Copyright 2011&ndash;present Encode OSS Ltd.<br>
Licensed under the BSD License.
HTML
def get_latest_version(opts)
get_latest_github_release('encode', 'django-rest-framework', opts)
end
end
end

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Loading…
Cancel
Save