Browse Source

Add Julia documentation

Thibaut Courouble 9 years ago
parent
commit
8e35fa3a2a

BIN
assets/images/docs.png


BIN
assets/images/docs@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2016-07-24",
-    "New documentation: <a href=\"/crystal/\">Crystal</a>"
+    "New documentations: <a href=\"/julia/\">Julia</a> and <a href=\"/crystal/\">Crystal</a>"
   ], [
     "2016-07-03",
     "New documentations: <a href=\"/cmake/\">CMake</a> and <a href=\"/matplotlib/\">Matplotlib</a>"

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -255,6 +255,11 @@ credits = [
     'jQuery Foundation and other contributors',
     'MIT',
     'https://raw.githubusercontent.com/jquery/api.jqueryui.com/master/LICENSE.txt'
+  ], [
+    'Julia',
+    '2009-2015 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors',
+    'MIT',
+    'https://raw.githubusercontent.com/JuliaLang/julia/master/LICENSE.md'
   ], [
     'Knockout.js',
     'Steven Sanderson, the Knockout.js team, and other contributors',

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -131,6 +131,7 @@
 ._icon-opentsdb:before      { background-position: -4rem -8rem; }
 ._icon-q:before             { background-position: -5rem -8rem; }
 ._icon-crystal:before       { background-position: -6rem -8rem; @extend %darkIconFix !optional; }
+._icon-julia:before         { background-position: -7rem -8rem; @extend %darkIconFix !optional; }
 ._icon-react_native:before  { background-position: 0 -9rem; }
 ._icon-phalcon:before       { background-position: -1rem -9rem; }
 ._icon-matplotlib:before    { background-position: -2rem -9rem; }

+ 11 - 0
lib/docs/filters/julia/clean_html.rb

@@ -0,0 +1,11 @@
+module Docs
+  class Julia
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('.document .section')
+
+        doc
+      end
+    end
+  end
+end

+ 34 - 0
lib/docs/filters/julia/entries.rb

@@ -0,0 +1,34 @@
+module Docs
+  class Julia
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        name = at_css('.document h1').content
+        name.remove! "\u{00B6}"
+        name
+      end
+
+      def get_type
+        if slug.start_with?('manual')
+          'Manual'
+        else
+          name
+        end
+      end
+
+      def additional_entries
+        return [] unless slug.start_with?('stdlib')
+        entries = []
+
+        css('.function dt[id]').each do |node|
+          entries << [node['id'].remove('Base.') + '()', node['id']]
+        end
+
+        css('.data dt[id]').each do |node|
+          entries << [node['id'].remove('Base.'), node['id']]
+        end
+
+        entries
+      end
+    end
+  end
+end

+ 20 - 0
lib/docs/scrapers/julia.rb

@@ -0,0 +1,20 @@
+module Docs
+  class Julia < UrlScraper
+    self.type = 'sphinx_simple'
+    self.release = '0.4.6'
+    self.base_url = 'http://docs.julialang.org/en/release-0.4/'
+    self.links = {
+      home: 'http://julialang.org/',
+      code: 'https://github.com/JuliaLang/julia'
+    }
+
+    html_filters.push 'julia/entries', 'julia/clean_html', 'sphinx/clean_html'
+
+    options[:only_patterns] = [/\Amanual\//, /\Astdlib\//]
+
+    options[:attribution] = <<-HTML
+      &copy; 2009&ndash;2015 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

BIN
public/icons/docs/julia/16.png


BIN
public/icons/docs/julia/16@2x.png


+ 1 - 0
public/icons/docs/julia/SOURCE

@@ -0,0 +1 @@
+http://julialang.org/favicon.ico