[devdocsgjs/main: 844/1867] django_rest_framework: finish scraper and filters
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 844/1867] django_rest_framework: finish scraper and filters
- Date: Fri, 19 Nov 2021 23:47:32 +0000 (UTC)
commit cbe38c8f362999cd67f4cb1dc060556abb79fdec
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Tue Aug 20 12:01:41 2019 +0200
django_rest_framework: finish scraper and filters
assets/javascripts/templates/pages/about_tmpl.coffee | 5 +++++
.../clean_html.rb | 7 ++++---
.../{rest_framework => django_rest_framework}/entries.rb | 5 ++---
.../django_rest_framework.rb} | 14 +++++++++-----
lib/docs/scrapers/{ => mkdocs}/mkdocs.rb | 0
.../docs/{rest_framework => django_rest_framework}/16.png | Bin
.../{rest_framework => django_rest_framework}/16 2x png | Bin
.../docs/{rest_framework => django_rest_framework}/SOURCE | 0
8 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 5fc27d3c..b2df2c21 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -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.',
diff --git a/lib/docs/filters/rest_framework/clean_html.rb
b/lib/docs/filters/django_rest_framework/clean_html.rb
similarity index 82%
rename from lib/docs/filters/rest_framework/clean_html.rb
rename to lib/docs/filters/django_rest_framework/clean_html.rb
index 87d048b9..67c131bb 100644
--- a/lib/docs/filters/rest_framework/clean_html.rb
+++ b/lib/docs/filters/django_rest_framework/clean_html.rb
@@ -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
diff --git a/lib/docs/filters/rest_framework/entries.rb b/lib/docs/filters/django_rest_framework/entries.rb
similarity index 95%
rename from lib/docs/filters/rest_framework/entries.rb
rename to lib/docs/filters/django_rest_framework/entries.rb
index 53b2fce0..d583af9e 100644
--- a/lib/docs/filters/rest_framework/entries.rb
+++ b/lib/docs/filters/django_rest_framework/entries.rb
@@ -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 '
@@ -46,7 +45,7 @@ module Docs
next
end
entries << [node.content, node['id'], local_type]
- elsif accepted_headers.include? node.content
+ elsif accepted_headers.include? node.content
in_category = true
elsif endings.any? { |word| node.content.ends_with?(word) }
entries << [node.content, node['id'], local_type]
diff --git a/lib/docs/scrapers/rest_framework.rb b/lib/docs/scrapers/mkdocs/django_rest_framework.rb
similarity index 56%
rename from lib/docs/scrapers/rest_framework.rb
rename to lib/docs/scrapers/mkdocs/django_rest_framework.rb
index d81c22ab..ad88b2c7 100644
--- a/lib/docs/scrapers/rest_framework.rb
+++ b/lib/docs/scrapers/mkdocs/django_rest_framework.rb
@@ -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–present Encode OSS Ltd<br>
+ Copyright 2011–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
diff --git a/lib/docs/scrapers/mkdocs.rb b/lib/docs/scrapers/mkdocs/mkdocs.rb
similarity index 100%
rename from lib/docs/scrapers/mkdocs.rb
rename to lib/docs/scrapers/mkdocs/mkdocs.rb
diff --git a/public/icons/docs/rest_framework/16.png b/public/icons/docs/django_rest_framework/16.png
similarity index 100%
rename from public/icons/docs/rest_framework/16.png
rename to public/icons/docs/django_rest_framework/16.png
diff --git a/public/icons/docs/rest_framework/16 2x png b/public/icons/docs/django_rest_framework/16 2x png
similarity index 100%
rename from public/icons/docs/rest_framework/16 2x png
rename to public/icons/docs/django_rest_framework/16 2x png
diff --git a/public/icons/docs/rest_framework/SOURCE b/public/icons/docs/django_rest_framework/SOURCE
similarity index 100%
rename from public/icons/docs/rest_framework/SOURCE
rename to public/icons/docs/django_rest_framework/SOURCE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]