diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee
index 4fd474a6..075ceb31 100644
--- a/assets/javascripts/templates/pages/news_tmpl.coffee
+++ b/assets/javascripts/templates/pages/news_tmpl.coffee
@@ -33,7 +33,10 @@ newsItem = (date, news) ->
result
app.news = [
- [ 1415491200000, # November 9, 2014
+ [ 1416096000000, # November 16, 2014
+ """ New Python 2 documentation """
+ ], [
+ 1415491200000, # November 9, 2014
""" New design
Feedback welcome on Twitter and GitHub. """
], [
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 0f9db3e8..e334c79a 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -42,6 +42,7 @@
._icon-ruby:before { background-position: -3rem -5rem; }
._icon-rails:before { background-position: -4rem -5rem; }
._icon-python:before { background-position: 0 -6rem; }
+._icon-python2:before { background-position: 0 -6rem; }
._icon-git:before { background-position: -1rem -6rem; }
._icon-redis:before { background-position: -2rem -6rem; }
._icon-postgresql:before { background-position: -3rem -6rem; }
diff --git a/lib/docs/filters/python2/entries.rb b/lib/docs/filters/python2/entries.rb
new file mode 100644
index 00000000..e0916243
--- /dev/null
+++ b/lib/docs/filters/python2/entries.rb
@@ -0,0 +1,87 @@
+module Docs
+ class Python2
+ class EntriesFilter < Docs::EntriesFilter
+ REPLACE_TYPES = {
+ 'compiler package' => 'Compiler',
+ 'Cryptographic' => 'Cryptography',
+ 'Custom Interpreters' => 'Interpreters',
+ 'Data Compression & Archiving' => 'Data Compression',
+ 'Generic Operating System' => 'Operating System',
+ 'Graphical User Interfaces with Tk' => 'Tk',
+ 'Internet Data Handling' => 'Internet Data',
+ 'Internet Protocols & Support' => 'Internet',
+ 'Interprocess Communication & Networking' => 'Networking',
+ 'MacOSA' => 'Mac OS',
+ 'Program Frameworks' => 'Frameworks',
+ 'Structured Markup Processing Tools' => 'Structured Markup' }
+
+ def get_name
+ name = at_css('h1').content
+ name.remove! %r{\A[\d\.]+ } # remove list number
+ name.remove! "\u{00B6}" # remove pilcrow sign
+ name.remove! %r{ [\u{2013}\u{2014}].+\z} # remove text after em/en dash
+ name.remove! 'Built-in'
+ name.strip!
+ name
+ end
+
+ def get_type
+ return 'Logging' if slug.start_with? 'library/logging'
+
+ type = at_css('.related a[accesskey="U"]').content
+
+ if type == 'The Python Standard Library'
+ type = at_css('h1').content
+ elsif type.include?('I/O') || %w(select selectors).include?(name)
+ type = 'Input/ouput'
+ elsif type.start_with? '18'
+ type = 'Internet Data Handling'
+ elsif type.include? 'Mac'
+ type = 'Mac OS'
+ end
+
+ type.remove! %r{\A\d+\.\s+} # remove list number
+ type.remove! "\u{00b6}" # remove paragraph character
+ type.sub! ' and ', ' & '
+ [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.remove!(str) }
+
+ REPLACE_TYPES[type] || type
+ end
+
+ def include_default_entry?
+ !at_css('.body > .section:only-child > .toctree-wrapper:last-child') && !type.in?(%w(Language Superseded SunOS))
+ end
+
+ def additional_entries
+ return [] if root_page? || !include_default_entry? || name == 'errno'
+ clean_id_attributes
+ entries = []
+
+ css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node|
+ entries << [node['id'], node['id']]
+ end
+
+ css('.data > dt[id]').each do |node|
+ if node['id'].split('.').last.upcase! # skip constants
+ entries << [node['id'], node['id']]
+ end
+ end
+
+ css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node|
+ entries << [node['id'] + '()', node['id']]
+ end
+
+ entries
+ end
+
+ def clean_id_attributes
+ css('.section > .target[id]').each do |node|
+ if dt = node.at_css('+ dl > dt')
+ dt['id'] ||= node['id'].remove(/\w+\-/)
+ end
+ node.remove
+ end
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/python2.rb b/lib/docs/scrapers/python2.rb
new file mode 100644
index 00000000..a9f730b9
--- /dev/null
+++ b/lib/docs/scrapers/python2.rb
@@ -0,0 +1,29 @@
+module Docs
+ class Python2 < FileScraper
+ self.name = 'Python 2'
+ self.slug = 'python2'
+ self.version = '2.7.8'
+ self.type = 'sphinx'
+ self.dir = '/Users/Thibaut/DevDocs/Docs/Python2' # downloaded from docs.python.org/2.7/download.html
+ self.base_url = 'http://docs.python.org/2.7/'
+ self.root_path = 'library/index.html'
+
+ html_filters.push 'python2/entries', 'python/clean_html'
+
+ options[:only_patterns] = [/\Alibrary\//]
+
+ options[:skip] = %w(
+ library/2to3.html
+ library/formatter.html
+ library/index.html
+ library/intro.html
+ library/undoc.html
+ library/unittest.mock-examples.html
+ library/sunau.html)
+
+ options[:attribution] = <<-HTML
+ © 1990–2014 Python Software Foundation
+ Licensed under the PSF License.
+ HTML
+ end
+end