Browse Source

Add Deno documentation (1.17.2)

Simon Legner 3 years ago
parent
commit
f19a61aa1b

+ 4 - 0
assets/javascripts/news.json

@@ -1,4 +1,8 @@
 [
+  [
+    "2022-01-09",
+    "New documentation: <a href=\"/deno/\">Deno</a>"
+  ],
   [
     "2021-12-29",
     "New documentation: <a href=\"/point_cloud_library/\">PointCloudLibrary</a>"

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

@@ -232,6 +232,11 @@ credits = [
     '2012 the Dart project authors',
     'CC BY-SA',
     'https://creativecommons.org/licenses/by-sa/4.0/'
+  ], [
+    'Deno',
+    '2018–2021 the Deno authors',
+    'MIT',
+    'https://raw.githubusercontent.com/denoland/manual/main/LICENSE'
   ], [
     'Django',
     'Django Software Foundation and individual contributors',

+ 22 - 0
lib/docs/filters/deno/clean_html.rb

@@ -0,0 +1,22 @@
+module Docs
+  class Deno
+    class CleanHtmlFilter < Filter
+      def call
+        if root_page?
+          @doc = at_css('h2[id]').parent.parent
+        else
+          @doc = at_css('article')
+        end
+
+        css('*[aria-label="Anchor"]').remove
+        css('*[class]').remove_attribute('class')
+        css('pre').each do |node|
+          node['data-language'] = 'typescript'
+        end
+        xpath('//a[text()="[src]"]').remove
+        
+        doc
+      end
+    end
+  end
+end

+ 15 - 0
lib/docs/filters/deno/entries.rb

@@ -0,0 +1,15 @@
+module Docs
+  class Deno
+    class EntriesFilter < Docs::EntriesFilter
+
+      def get_name
+        at_css('h1').content
+      end
+
+      def get_type
+        'Deno CLI APIs'
+      end
+
+    end
+  end
+end

+ 23 - 0
lib/docs/scrapers/deno.rb

@@ -0,0 +1,23 @@
+module Docs
+  class Deno < UrlScraper
+    self.name = 'Deno'
+    self.type = 'simple'
+    self.release = '1.17.2'
+    self.base_url = 'https://doc.deno.land/deno/stable/'
+    self.links = {
+      home: 'https://deno.land/',
+      code: 'https://github.com/denoland/deno'
+    }
+
+    html_filters.push 'deno/entries', 'deno/clean_html'
+
+    # https://github.com/denoland/manual/blob/main/LICENSE
+    options[:attribution] = <<-HTML
+      &copy; 2018–2021 the Deno authors
+    HTML
+
+    def get_latest_version(opts)
+      get_latest_github_release('denoland', 'deno', opts)
+      end
+  end
+end

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


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


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

@@ -0,0 +1 @@
+https://doc.deno.land/static/apple-touch-icon.png