Use Mkdocs as base for RestFramework

pull/1003/head
Emil Maruszczak 6 years ago
parent 14623be628
commit 8fdaf8a33c

@ -1,5 +1,19 @@
module Docs module Docs
class Mkdocs < Scraper class Mkdocs < UrlScraper
self.abstract = true self.abstract = true
self.type = 'mkdocs'
html_filters.push 'mkdocs/clean_html'
private
def handle_response(response)
# Some scrapped urls don't have ending slash
# which leads to page duplication
if !response.url.path.ends_with?('/') && !response.url.path.ends_with?('index.html')
response.url.path << '/'
end
super
end
end end
end end

@ -1,5 +1,5 @@
module Docs module Docs
class RestFramework < UrlScraper class RestFramework < Mkdocs
self.name = 'Django REST Framework' self.name = 'Django REST Framework'
self.release = '3.9.2' self.release = '3.9.2'
self.slug = 'rest_framework' self.slug = 'rest_framework'
@ -11,7 +11,7 @@ module Docs
code: 'https://github.com/encode/django-rest-framework' code: 'https://github.com/encode/django-rest-framework'
} }
html_filters.push 'mkdocs/clean_html', 'rest_framework/clean_html', 'rest_framework/entries' html_filters.push 'rest_framework/clean_html', 'rest_framework/entries'
options[:skip_patterns] = [ options[:skip_patterns] = [
/\Atopics\//, /\Atopics\//,
@ -22,16 +22,5 @@ module Docs
Copyright 2011&ndash;present Encode OSS Ltd<br> Copyright 2011&ndash;present Encode OSS Ltd<br>
Licensed under the BSD License. Licensed under the BSD License.
HTML HTML
private
def handle_response(response)
# Some scrapped urls don't have ending slash
# which leads to page duplication
if !response.url.path.ends_with?('/') && !response.url.path.ends_with?('index.html')
response.url.path << '/'
end
super
end
end end
end end

Loading…
Cancel
Save