Unified · Split
Binary file not shown.
Binary file not shown.
| @@ -138,6 +138,11 @@ credits = [ · 137 unmodified lines | |||
| 138 | '1997-2013 The PHP Documentation Group', | 138 | '1997-2013 The PHP Documentation Group', |
| 139 | 'CC BY', | 139 | 'CC BY', |
| 140 | 'http://creativecommons.org/licenses/by/3.0/' | 140 | 'http://creativecommons.org/licenses/by/3.0/' |
| 141 | ], [ | ||
| 142 | 'Python', | ||
| 143 | '1990-2013 Python Software Foundation<br>Python is a trademark of the Python Software Foundation.', | ||
| 144 | 'PSFL', | ||
| 145 | 'http://docs.python.org/3/license.html' | ||
| 141 | ], [ | 146 | ], [ |
| 142 | 'Ruby', | 147 | 'Ruby', |
| 143 | '1993-2013 Yukihiro Matsumoto', | 148 | '1993-2013 Yukihiro Matsumoto', |
| @@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines | |||
| 24 | result | 24 | result |
| 25 | 25 | ||
| 26 | app.news = [ | 26 | app.news = [ |
| 27 | [ 1384819200000, # November 19, 2013 | 27 | [ 1385424000000, # November 26, 2013 |
| 28 | """ New <a href="/python/">Python</a> documentation """ | ||
| 29 | ], [ | ||
| 30 | 1384819200000, # November 19, 2013 | ||
| 28 | """ New <a href="/rails/">Ruby on Rails</a> documentation """ | 31 | """ New <a href="/rails/">Ruby on Rails</a> documentation """ |
| 29 | ], [ | 32 | ], [ |
| 30 | 1384560000000, # November 16, 2013 | 33 | 1384560000000, # November 16, 2013 |
| @@ -35,7 +38,8 @@ app.news = [ · 4 unmodified lines | |||
| 35 | ], [ | 38 | ], [ |
| 36 | 1381276800000, # October 9, 2013 | 39 | 1381276800000, # October 9, 2013 |
| 37 | """ DevDocs is now available as a <a href="https://chrome.google.com/webstore/detail/devdocs/mnfehgbmkapmjnhcnbodoamcioleeooe">Chrome web app</a>. """ | 40 | """ DevDocs is now available as a <a href="https://chrome.google.com/webstore/detail/devdocs/mnfehgbmkapmjnhcnbodoamcioleeooe">Chrome web app</a>. """ |
| 38 | ], [ 1379808000000, # September 22, 2013 | 41 | ], [ |
| 42 | 1379808000000, # September 22, 2013 | ||
| 39 | """ New <a href="/php/">PHP</a> documentation """ | 43 | """ New <a href="/php/">PHP</a> documentation """ |
| 40 | ], [ | 44 | ], [ |
| 41 | 1378425600000, # September 6, 2013 | 45 | 1378425600000, # September 6, 2013 |
| @@ -0,0 +1,6 @@ | |||
| 1 | #= require views/pages/base | ||
| 2 | |||
| 3 | class app.views.SphinxPage extends app.views.BasePage | ||
| 4 | afterRender: -> | ||
| 5 | @highlightCode @findAll('pre.python'), 'python' | ||
| 6 | return | ||
| @@ -38,5 +38,6 @@ · 37 unmodified lines | |||
| 38 | 'pages/php', | 38 | 'pages/php', |
| 39 | 'pages/rdoc', | 39 | 'pages/rdoc', |
| 40 | 'pages/rfc', | 40 | 'pages/rfc', |
| 41 | 'pages/sphinx', | ||
| 41 | 'pages/underscore', | 42 | 'pages/underscore', |
| 42 | 'pages/yard'; | 43 | 'pages/yard'; |
| @@ -153,7 +153,6 @@ · 152 unmodified lines | |||
| 153 | %lined-heading { | 153 | %lined-heading { |
| 154 | white-space: nowrap; | 154 | white-space: nowrap; |
| 155 | overflow: hidden; | 155 | overflow: hidden; |
| 156 | overflow-wrap: normal; | ||
| 157 | word-wrap: normal; | 156 | word-wrap: normal; |
| 158 | 157 | ||
| 159 | &:after { | 158 | &:after { |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | |||
| 4 | width: 1rem; | 4 | width: 1rem; |
| 5 | height: 1rem; | 5 | height: 1rem; |
| 6 | background-image: image-url('icons.png'); | 6 | background-image: image-url('icons.png'); |
| 7 | background-size: 5rem 6rem; | 7 | background-size: 5rem 7rem; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { | 10 | @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { |
| @@ -41,3 +41,4 @@ · 30 unmodified lines | |||
| 41 | ._icon-php:before { background-position: -2rem -5rem; } | 41 | ._icon-php:before { background-position: -2rem -5rem; } |
| 42 | ._icon-ruby:before { background-position: -3rem -5rem; } | 42 | ._icon-ruby:before { background-position: -3rem -5rem; } |
| 43 | ._icon-rails:before { background-position: -4rem -5rem; } | 43 | ._icon-rails:before { background-position: -4rem -5rem; } |
| 44 | ._icon-python:before { background-position: 0 -6rem; } | ||
| @@ -0,0 +1,26 @@ | |||
| 1 | ._sphinx { | ||
| 2 | h2, h3 { @extend %block-heading; } | ||
| 3 | dl:not(.docutils) > dt { @extend %block-label, %label-blue; } | ||
| 4 | dt + dt { margin-top: -.5em; } | ||
| 5 | |||
| 6 | .note, .admonition, .versionadded, .versionchanged, .deprecated-removed { @extend %note; } | ||
| 7 | .deprecated-removed { @extend %note-red; } | ||
| 8 | .versionmodified { font-weight: bold; } | ||
| 9 | |||
| 10 | p > code, li > code { @extend %label; } | ||
| 11 | |||
| 12 | .admonition-title { | ||
| 13 | float: left; | ||
| 14 | margin: 0 .5em 0 0; | ||
| 15 | font-weight: bold; | ||
| 16 | |||
| 17 | &:after { content: ':'; } | ||
| 18 | } | ||
| 19 | |||
| 20 | .admonition > dl { | ||
| 21 | clear: left; | ||
| 22 | margin: 0; | ||
| 23 | } | ||
| 24 | |||
| 25 | ul.simple { margin: 1em 0; } | ||
| 26 | } | ||
| @@ -0,0 +1,68 @@ | |||
| 1 | module Docs | ||
| 2 | class Python | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | @doc = at_css '.body > .section' | ||
| 6 | |||
| 7 | # Clean inline code elements | ||
| 8 | |||
| 9 | css('tt.literal').each do |node| | ||
| 10 | node.before(node.children).remove | ||
| 11 | end | ||
| 12 | |||
| 13 | css('tt', 'span.pre').each do |node| | ||
| 14 | node.name = 'code' | ||
| 15 | node.remove_attribute 'class' | ||
| 16 | end | ||
| 17 | |||
| 18 | root_page? ? root : other | ||
| 19 | |||
| 20 | doc | ||
| 21 | end | ||
| 22 | |||
| 23 | def root | ||
| 24 | at_css('h1').content = 'Python' | ||
| 25 | css('> p').remove | ||
| 26 | end | ||
| 27 | |||
| 28 | def other | ||
| 29 | css('.headerlink', 'hr').remove | ||
| 30 | |||
| 31 | # Clean headings | ||
| 32 | |||
| 33 | at_css('h1').tap do |node| | ||
| 34 | node.content = node.content.sub!(/\A[\d\.]+/) { |str| @levelRegexp = /\A#{str}/; '' } | ||
| 35 | end | ||
| 36 | |||
| 37 | css('h2', 'h3', 'h4').each do |node| | ||
| 38 | node.css('a').each do |link| | ||
| 39 | link.before(link.children).remove | ||
| 40 | end | ||
| 41 | node.child.content = node.child.content.sub @levelRegexp, '' | ||
| 42 | end | ||
| 43 | |||
| 44 | css('dt').each do |node| | ||
| 45 | node.content = node.content | ||
| 46 | end | ||
| 47 | |||
| 48 | # Remove blockquotes | ||
| 49 | css('blockquote').each do |node| | ||
| 50 | node.before(node.children).remove | ||
| 51 | end | ||
| 52 | |||
| 53 | # Remove code highlighting | ||
| 54 | css('.highlight-python3').each do |node| | ||
| 55 | pre = node.at_css('pre') | ||
| 56 | pre.content = pre.content | ||
| 57 | pre['class'] = 'python' | ||
| 58 | node.replace(pre) | ||
| 59 | end | ||
| 60 | |||
| 61 | # Remove <table> border attribute | ||
| 62 | css('table[border]').each do |node| | ||
| 63 | node.remove_attribute 'border' | ||
| 64 | end | ||
| 65 | end | ||
| 66 | end | ||
| 67 | end | ||
| 68 | end | ||
| @@ -0,0 +1,82 @@ | |||
| 1 | module Docs | ||
| 2 | class Python | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | REPLACE_TYPES = { | ||
| 5 | 'Cryptographic' => 'Cryptography', | ||
| 6 | 'Custom Interpreters' => 'Interpreters', | ||
| 7 | 'Data Compression & Archiving' => 'Data Compression', | ||
| 8 | 'Generic Operating System' => 'Operating System', | ||
| 9 | 'Graphical User Interfaces with Tk' => 'Tk', | ||
| 10 | 'Internet Data Handling' => 'Internet Data', | ||
| 11 | 'Internet Protocols & Support' => 'Internet', | ||
| 12 | 'Interprocess Communication & Networking' => 'Networking', | ||
| 13 | 'Program Frameworks' => 'Frameworks', | ||
| 14 | 'Structured Markup Processing Tools' => 'Structured Markup' } | ||
| 15 | |||
| 16 | def get_name | ||
| 17 | name = at_css('h1').content | ||
| 18 | name.sub! %r{\A[\d\.]+ }, '' # remove list number | ||
| 19 | name.sub! %r{ \u{2014}.+\z}, '' # remove text after em dash | ||
| 20 | name | ||
| 21 | end | ||
| 22 | |||
| 23 | def get_type | ||
| 24 | return 'Logging' if slug.start_with? 'library/logging' | ||
| 25 | |||
| 26 | type = at_css('.related a[accesskey="U"]').content | ||
| 27 | |||
| 28 | if type == 'The Python Standard Library' | ||
| 29 | type = at_css('h1').content | ||
| 30 | elsif type.start_with? '19' | ||
| 31 | type = 'Internet Data Handling' | ||
| 32 | end | ||
| 33 | |||
| 34 | type.sub! %r{\A\d+\.\s+}, '' # remove list number | ||
| 35 | type.sub! "\u{00b6}", '' # remove paragraph character | ||
| 36 | type.sub! ' and ', ' & ' | ||
| 37 | [' Services', ' Modules', ' Specific', 'Python '].each { |str| type.sub! str, '' } | ||
| 38 | |||
| 39 | REPLACE_TYPES[type] || type | ||
| 40 | end | ||
| 41 | |||
| 42 | def include_default_entry? | ||
| 43 | name !~ /[A-Z]/ && !skip? # skip non-module names | ||
| 44 | end | ||
| 45 | |||
| 46 | def additional_entries | ||
| 47 | return [] if root_page? || skip? || name == 'errno' | ||
| 48 | clean_id_attributes | ||
| 49 | entries = [] | ||
| 50 | |||
| 51 | css('.class > dt[id]', '.exception > dt[id]', '.attribute > dt[id]').each do |node| | ||
| 52 | entries << [node['id'], node['id']] | ||
| 53 | end | ||
| 54 | |||
| 55 | css('.data > dt[id]').each do |node| | ||
| 56 | if node['id'].split('.').last.upcase! # skip constants | ||
| 57 | entries << [node['id'], node['id']] | ||
| 58 | end | ||
| 59 | end | ||
| 60 | |||
| 61 | css('.function > dt[id]', '.method > dt[id]', '.classmethod > dt[id]').each do |node| | ||
| 62 | entries << [node['id'] + '()', node['id']] | ||
| 63 | end | ||
| 64 | |||
| 65 | entries | ||
| 66 | end | ||
| 67 | |||
| 68 | def skip? | ||
| 69 | type == 'Language' | ||
| 70 | end | ||
| 71 | |||
| 72 | def clean_id_attributes | ||
| 73 | css('.section > .target[id]').each do |node| | ||
| 74 | if dt = node.at_css('+ dl > dt') | ||
| 75 | dt['id'] ||= node['id'].sub(/\w+\-/, '') | ||
| 76 | end | ||
| 77 | node.remove | ||
| 78 | end | ||
| 79 | end | ||
| 80 | end | ||
| 81 | end | ||
| 82 | end | ||
| @@ -0,0 +1,27 @@ | |||
| 1 | module Docs | ||
| 2 | class Python < FileScraper | ||
| 3 | self.version = '3.3.3' | ||
| 4 | self.type = 'sphinx' | ||
| 5 | self.dir = '/Users/Thibaut/DevDocs/Docs/Python' # downloaded from docs.python.org/3/download.html | ||
| 6 | self.base_url = 'http://docs.python.org/3/' | ||
| 7 | self.root_path = 'library/index.html' | ||
| 8 | |||
| 9 | html_filters.push 'python/entries', 'python/clean_html' | ||
| 10 | |||
| 11 | options[:only_patterns] = [/\Alibrary\//] | ||
| 12 | |||
| 13 | options[:skip] = %w( | ||
| 14 | library/2to3.html | ||
| 15 | library/formatter.html | ||
| 16 | library/index.html | ||
| 17 | library/intro.html | ||
| 18 | library/undoc.html | ||
| 19 | library/unittest.mock-examples.html | ||
| 20 | library/sunau.html) | ||
| 21 | |||
| 22 | options[:attribution] = <<-HTML | ||
| 23 | © 1990–2013 Python Software Foundation<br> | ||
| 24 | Licensed under the PSF License. | ||
| 25 | HTML | ||
| 26 | end | ||
| 27 | end | ||
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | |||
| 1 | http://www.python.org/community/logos/ | ||