Sfoglia il codice sorgente

Add sanctuary-def documentation (0.22.0)

Jan Christoph Ebersbach 2 anni fa
parent
commit
27b491b471

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -115,6 +115,7 @@
         'pages/rust',
         'pages/rxjs',
         'pages/sanctuary',
+        'pages/sanctuary_def',
         'pages/scala',
         'pages/sinon',
         'pages/sphinx',

+ 7 - 0
assets/stylesheets/pages/_sanctuary_def.scss

@@ -0,0 +1,7 @@
+._sanctuary_def {
+  @extend %simple;
+
+  pre > code {
+    font-size: inherit;
+  }
+}

+ 13 - 0
lib/docs/filters/sanctuary_def/clean_html.rb

@@ -0,0 +1,13 @@
+module Docs
+  class SanctuaryDef
+    class CleanHtmlFilter < Filter
+      def call
+        # Make headers bigger by transforming them into a bigger variant
+        css('h3').each { |node| node.name = 'h2' }
+        css('h4').each { |node| node.name = 'h3' }
+
+        doc
+      end
+    end
+  end
+end

+ 24 - 0
lib/docs/filters/sanctuary_def/entries.rb

@@ -0,0 +1,24 @@
+module Docs
+  class SanctuaryDef
+    class EntriesFilter < Docs::EntriesFilter
+      # The entire reference is one big page, so get_name and get_type are not necessary
+      def additional_entries
+        entries = []
+        type = ""
+
+        css("h3, h4").each do |node|
+          case node.name
+          when "h3"
+            type = node.text
+          when "h4"
+            name = node.text.split(' :: ')[0]
+            id = node.attributes["id"].value
+            entries << [name, id, type]
+          end
+        end
+
+        entries
+      end
+    end
+  end
+end

+ 30 - 0
lib/docs/scrapers/sanctuary_def.rb

@@ -0,0 +1,30 @@
+module Docs
+
+  class SanctuaryDef < Github
+    self.name = "Sanctuary Def"
+    self.slug = "sanctuary_def"
+    self.type = "sanctuary_def"
+    self.release = "0.22.0"
+    self.base_url = "https://github.com/sanctuary-js/sanctuary-def/blob/v#{self.release}/README.md"
+    self.links = {
+      home: "https://github.com/sanctuary-js/sanctuary-def",
+      code: "https://github.com/sanctuary-js/sanctuary-def",
+    }
+
+    # html_filters.push "sanctuary_def/entries"
+    html_filters.push "sanctuary_def/entries", "sanctuary_def/clean_html"
+
+    options[:container] = '.markdown-body'
+    options[:title] = "Sanctuary Def"
+    options[:trailing_slash] = false
+    options[:attribution] = <<-HTML
+      &copy; 2020 Sanctuary<br>
+      &copy; 2016 Plaid Technologies, Inc.<br>
+      Licensed under the MIT License.
+    HTML
+
+    def get_latest_version(opts)
+      get_npm_version("sanctuary-def", opts)
+    end
+  end
+end

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


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


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

@@ -0,0 +1 @@
+https://github.com/sanctuary-js/sanctuary-logo/tree/v1.1.0