diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png
index d096eaa2..dfc88c68 100644
Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ
diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png
index 961063eb..07c8c9d4 100644
Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index 37bba8ec..aa7a99c8 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,5 +1,8 @@
[
[
+ "2018-07-29",
+ "New documentation: Pygame"
+ ], [
"2018-07-08",
"New documentations: Leaflet, Terraform and Koa"
], [
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index fef9a024..b3047573 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -545,6 +545,11 @@ credits = [
'1996-2018 The PostgreSQL Global Development Group
© 1994 The Regents of the University of California',
'PostgreSQL',
'https://www.postgresql.org/about/licence/'
+ ], [
+ 'Pygame',
+ 'Pygame Developpers',
+ 'LGPLv2.1',
+ 'https://raw.githubusercontent.com/pygame/pygame/master/LICENSE'
], [
'Python',
'2001-2018 Python Software Foundation
Python is a trademark of the Python Software Foundation.',
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index d7e24591..546cc26e 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -173,3 +173,4 @@
._icon-babel:before { background-position: -2rem -3rem; @extend %doc-icon-2; }
._icon-leaflet:before { background-position: -3rem -3rem; @extend %doc-icon-2; }
._icon-terraform:before { background-position: -4rem -3rem; @extend %doc-icon-2; }
+._icon-pygame:before { background-position: -5rem -3rem; @extend %doc-icon-2; }
diff --git a/lib/docs/filters/pygame/clean_html.rb b/lib/docs/filters/pygame/clean_html.rb
index 5e81fe2c..8ef7d2d6 100644
--- a/lib/docs/filters/pygame/clean_html.rb
+++ b/lib/docs/filters/pygame/clean_html.rb
@@ -2,23 +2,21 @@ module Docs
class Pygame
class CleanHtmlFilter < Filter
def call
-
@doc = at_css '.body'
if root_page?
# remove unneeded stuff
at_css('.modindex-jumpbox').remove
- css('[role="navigation"],.pcap, .cap, .footer').each do |node|
- node.remove
- end
+ css('[role="navigation"],.pcap, .cap, .footer').remove
# table -> list
list = at_css('table')
list.replace(list.children)
list.name = 'ul'
css('tr').each do |row|
row.name = 'li'
- row['class'] = ''
+ row.remove_attribute('class')
end
+ at_css('h1').content = 'Pygame'
return doc
end
@@ -26,11 +24,7 @@ module Docs
# .headerlink => ΒΆ after links
# .toc => table of content
# .tooltip-content => tooltips after links to functions
- if toremove = css('table.toc.docutils, .headerlink, .tooltip-content')
- toremove.each do |node|
- node.remove
- end
- end
+ css('table.toc.docutils, .headerlink, .tooltip-content').remove
# Remove wrapper .section
section = at_css('.section')
@@ -43,7 +37,7 @@ module Docs
pre = node.at_css('pre')
node.replace(pre)
# gets rid of the already existing syntax highlighting
- pre.inner_html = pre.inner_text
+ pre.content = pre.content
pre['class'] = 'language-python'
pre['data-language'] = "python"
end
@@ -97,6 +91,10 @@ module Docs
end
end
+ css('> dl', '> dl > dd', 'h1 code').each do |node|
+ node.before(node.children).remove
+ end
+
doc
end
end
diff --git a/lib/docs/filters/pygame/entries.rb b/lib/docs/filters/pygame/entries.rb
index 5d589a63..94c171b6 100644
--- a/lib/docs/filters/pygame/entries.rb
+++ b/lib/docs/filters/pygame/entries.rb
@@ -2,33 +2,27 @@ module Docs
class Pygame
class EntriesFilter < Docs::EntriesFilter
def get_name
- return 'pygame'
+ at_css('h1').content.remove('pygame.')
end
def get_type
at_css('h1').content
end
- def include_default_entry?
- return false
- end
-
def additional_entries
- return ['pygame'] if root_page?
+ return [] if root_page?
+
+ css('h1, h2, h3').each_with_object [] do |node, entries|
+ name = node['id'] || node['data-name']
- entries = []
- css('h1,h2,h3').each do |node|
- parentclass = node.parent['class']
- name = node['id']
- if not name
- name = node['data-name']
- elsif parentclass.include?('function') or parentclass.include?('method')
- name += '()'
+ if node.parent['class'].include?('function') or node.parent['class'].include?('method')
+ name << '()'
end
- name = name.sub('pygame.', '')
- entries << [name, node['id'], nil]
+
+ name.remove!('pygame.')
+
+ entries << [name, node['id']] unless name == self.name
end
- entries
end
end
end
diff --git a/lib/docs/scrapers/pygame.rb b/lib/docs/scrapers/pygame.rb
index 8dcc4515..9da3148d 100644
--- a/lib/docs/scrapers/pygame.rb
+++ b/lib/docs/scrapers/pygame.rb
@@ -1,15 +1,8 @@
module Docs
class Pygame < UrlScraper
-
self.type = 'simple'
-
- self.release = 'v1.9.4.dev0'
-
- self.initial_paths = ['py-modindex.html']
- self.base_url = 'https://www.pygame.org/docs/'
+ self.release = '1.9.4'
self.root_path = 'py-modindex.html'
- self.initial_paths = []
-
self.links = {
home: 'https://www.pygame.org/',
code: 'https://github.com/pygame/pygame'
@@ -20,7 +13,8 @@ module Docs
options[:only_patterns] = [/ref\//]
options[:attribution] = <<-HTML
- © Pygame Developpers.
+ © Pygame Developpers.
+ Licensed under the GNU LGPL License version 2.1.
HTML
end
end
diff --git a/public/icons/docs-2.pxm b/public/icons/docs-2.pxm
index 7549a0ab..82696ea8 100644
Binary files a/public/icons/docs-2.pxm and b/public/icons/docs-2.pxm differ
diff --git a/public/icons/docs-2@2x.pxm b/public/icons/docs-2@2x.pxm
index ea8fee7c..7bb215b3 100644
Binary files a/public/icons/docs-2@2x.pxm and b/public/icons/docs-2@2x.pxm differ
diff --git a/public/icons/docs/pygame/16.png b/public/icons/docs/pygame/16.png
index f6edae59..bf491003 100644
Binary files a/public/icons/docs/pygame/16.png and b/public/icons/docs/pygame/16.png differ
diff --git a/public/icons/docs/pygame/16@2x.png b/public/icons/docs/pygame/16@2x.png
index 9ef9a9e7..10d68ab4 100644
Binary files a/public/icons/docs/pygame/16@2x.png and b/public/icons/docs/pygame/16@2x.png differ