diff --git a/assets/images/icons.png b/assets/images/icons.png index 6dc96fad..50c24465 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index b6a7e356..29e3460d 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 41e888f1..9af1e0a3 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -117,6 +117,11 @@ credits = [ '2014 Michael Bostock', 'BSD', 'https://raw.github.com/mbostock/d3/master/LICENSE' + ], [ + 'Django', + 'Django Software Foundation and individual contributors', + 'BSD', + 'https://raw.githubusercontent.com/django/django/master/LICENSE' ], [ 'Ember.js', '2014 Yehuda Katz, Tom Dale and Ember.js contributors', diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index f2c74082..8b96b8e8 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -32,7 +32,10 @@ newsItem = (date, news) -> result app.news = [ - [ 1406419200000, # July 27, 2014 + [ 1407110400000, # August 4, 2014 + """ New Django documentation """, + ], [ + 1406419200000, # July 27, 2014 """ New Markdown documentation """, ], [ 1404518400000, # July 5, 2014 diff --git a/assets/javascripts/views/pages/sphinx.coffee b/assets/javascripts/views/pages/sphinx.coffee index cecc751c..1427c418 100644 --- a/assets/javascripts/views/pages/sphinx.coffee +++ b/assets/javascripts/views/pages/sphinx.coffee @@ -3,4 +3,5 @@ class app.views.SphinxPage extends app.views.BasePage afterRender: -> @highlightCode @findAll('pre.python'), 'python' + @highlightCode @findAll('pre.markup'), 'markup' return diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 775e1e47..69167033 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -63,3 +63,4 @@ ._icon-sinon:before { background-position: -4rem -9rem; } ._icon-cordova:before { background-position: 0 -10rem; } ._icon-markdown:before { background-position: -1rem -10rem; } +._icon-django:before { background-position: -2rem -10rem; } diff --git a/lib/docs/filters/django/clean_html.rb b/lib/docs/filters/django/clean_html.rb new file mode 100644 index 00000000..dfb26a14 --- /dev/null +++ b/lib/docs/filters/django/clean_html.rb @@ -0,0 +1,42 @@ +module Docs + class Django + class CleanHtmlFilter < Filter + def call + @doc = at_css('.yui-g') + + css('.section', 'a > em').each do |node| + node.before(node.children).remove + end + + css('tt', 'span.pre').each do |node| + node.name = 'code' + node.content = node.content + node.remove_attribute 'class' + end + + css('.headerlink').each do |node| + id = node['href'][1..-1] + node.parent['id'] ||= id + doc.at_css("span##{id}").try(:remove) + node.remove + end + + css('h1', 'h2', 'h3', 'dt').each do |node| + node.content = node.content + end + + css('div[class^="highlight-"]').each do |node| + node.name = 'pre' + node['class'] = case node['class'] + when 'highlight-python' then 'python' + when 'highlight-html+django' then 'markup' + else '' + end + node.content = node.at_css('pre').content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/django/entries.rb b/lib/docs/filters/django/entries.rb new file mode 100644 index 00000000..4cbbc971 --- /dev/null +++ b/lib/docs/filters/django/entries.rb @@ -0,0 +1,46 @@ +module Docs + class Django + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content.remove("\u{00b6}") + end + + def get_type + case subpath + when /\Atopics/ + 'Guides' + when /\Aintro/ + 'Guides: Intro' + when /\Ahowto/ + 'Guides: How-tos' + when /\Aref/ + 'API' + end + end + + def additional_entries + entries = [] + + css('dl.function', 'dl.class', 'dl.method', 'dl.attribute').each do |node| + next unless id = node.at_css('dt')['id'] + next unless name = id.dup.sub!('django.', '') + + path = name.split('.') + type = "django.#{path.first}" + type << ".#{path.second}" if %w(contrib db).include?(path.first) + + name.remove! 'contrib.' + name << '()' if node['class'].include?('method') || node['class'].include?('function') + + entries << [name, id, type] + end + + entries + end + + def include_default_entry? + at_css('#sidebar a[href="index"]') + end + end + end +end diff --git a/lib/docs/filters/django/fix_urls.rb b/lib/docs/filters/django/fix_urls.rb new file mode 100644 index 00000000..b3dc1453 --- /dev/null +++ b/lib/docs/filters/django/fix_urls.rb @@ -0,0 +1,10 @@ +module Docs + class Django + class FixUrlsFilter < Filter + def call + html.gsub! %r{#{Regexp.escape(Django.base_url)}([^"']+?)\.html}, "#{Django.base_url}\\1/" + html + end + end + end +end diff --git a/lib/docs/scrapers/django.rb b/lib/docs/scrapers/django.rb new file mode 100644 index 00000000..60526342 --- /dev/null +++ b/lib/docs/scrapers/django.rb @@ -0,0 +1,36 @@ +module Docs + class Django < FileScraper + self.name = 'Django' + self.type = 'sphinx' + self.version = '1.6.6' + self.dir = '/Users/Thibaut/DevDocs/Docs/Django' + self.base_url = 'https://docs.djangoproject.com/en/1.6/' + self.root_path = 'index.html' + + html_filters.push 'django/entries', 'django/clean_html' + text_filters.push 'django/fix_urls' + + options[:container] = '#bd' + + options[:skip] = %w( + contents.html + genindex.html + py-modindex.html + glossary.html + search.html + intro/whatsnext.html) + + options[:skip_patterns] = [ + /\Afaq\//, + /\Ainternals\//, + /\Amisc\//, + /\Areleases\//, + /\A_/, + /flattened\-index\.html/] + + options[:attribution] = <<-HTML + © Django Software Foundation and individual contributors
+ Licensed under the BSD License. + HTML + end +end diff --git a/public/icons/docs/django/16.png b/public/icons/docs/django/16.png new file mode 100644 index 00000000..c427ef42 Binary files /dev/null and b/public/icons/docs/django/16.png differ diff --git a/public/icons/docs/django/16@2x.png b/public/icons/docs/django/16@2x.png new file mode 100644 index 00000000..d9c143ea Binary files /dev/null and b/public/icons/docs/django/16@2x.png differ diff --git a/public/icons/docs/django/SOURCE b/public/icons/docs/django/SOURCE new file mode 100644 index 00000000..2eaa39c2 --- /dev/null +++ b/public/icons/docs/django/SOURCE @@ -0,0 +1 @@ +https://github.com/django/djangoproject.com/raw/master/static/favicon.ico