浏览代码

Merge remote-tracking branch 'origin/main' into zsh

Simon Legner 5 月之前
父节点
当前提交
4fb53e1591

+ 1 - 1
.github/workflows/build.yml

@@ -13,7 +13,7 @@ jobs:
     steps:
     - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
     - name: Set up Ruby
-      uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
+      uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
       with:
         bundler-cache: true # runs 'bundle install' and caches installed gems automatically
     - name: Run tests

+ 1 - 1
.github/workflows/schedule-doc-report.yml

@@ -11,7 +11,7 @@ jobs:
     steps:
     - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
     - name: Set up Ruby
-      uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
+      uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
       with:
         bundler-cache: true # runs 'bundle install' and caches installed gems automatically
     - name: Generate report

+ 1 - 1
.github/workflows/test.yml

@@ -11,7 +11,7 @@ jobs:
     steps:
     - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
     - name: Set up Ruby
-      uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
+      uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
       with:
         bundler-cache: true # runs 'bundle install' and caches installed gems automatically
     - name: Run tests

+ 2 - 2
Gemfile.lock

@@ -78,7 +78,7 @@ GEM
       byebug (~> 12.0)
       pry (>= 0.13, < 0.16)
     racc (1.8.1)
-    rack (2.2.16)
+    rack (2.2.17)
     rack-protection (3.2.0)
       base64 (>= 0.1.0)
       rack (~> 2.2, >= 2.2.4)
@@ -130,7 +130,7 @@ GEM
     strings-ansi (0.2.0)
     terminal-table (3.0.2)
       unicode-display_width (>= 1.1.1, < 3)
-    terser (1.2.5)
+    terser (1.2.6)
       execjs (>= 0.3.0, < 3)
     thin (1.8.2)
       daemons (~> 1.0, >= 1.0.9)

+ 4 - 0
assets/javascripts/news.json

@@ -3,6 +3,10 @@
     "2025-06-27",
     "New documentation: <a href=\"/zsh/\">Zsh</a>"
   ],
+  [
+    "2025-06-04",
+    "New documentation: <a href=\"/es_toolkit/\">es-toolkit</a>"
+  ],
   [
     "2025-05-28",
     "New documentation: <a href=\"/vertx/\">Vert.x</a>"

+ 6 - 0
docs/file-scrapers.md

@@ -59,6 +59,12 @@ curl -L https://github.com/erlang/otp/releases/download/OTP-$RELEASE/otp_doc_htm
 bsdtar --extract --file - --directory=docs/erlang\~$VERSION/
 ```
 
+## es-toolkit
+
+```sh
+git clone https://github.com/toss/es-toolkit docs/es_toolkit
+```
+
 ## Gnu
 
 ### Bash

+ 88 - 0
lib/docs/scrapers/es_toolkit.rb

@@ -0,0 +1,88 @@
+module Docs
+  class EsToolkit < FileScraper
+    self.name = "es-toolkit"
+    self.slug = "es_toolkit"
+    self.type = "simple"
+    self.links = {
+      code: "https://github.com/toss/es-toolkit",
+      home: "https://es-toolkit.slash.page",
+    }
+
+    options[:attribution] = <<-HTML
+      &copy; 2024-2025, Viva Republica<br>
+      Licensed under the MIT License.
+    HTML
+
+    def get_latest_version(opts)
+      get_github_tags("toss", "es-toolkit", opts).first["name"]
+    end
+
+    def build_pages(&block)
+      internal("docs/intro.md", path: "index", &block)
+      Dir.chdir(source_directory) do
+        Dir["docs/reference/**/*.md"]
+      end.each { internal(_1, &block) }
+    end
+
+    protected
+
+    def internal(filename, path: nil, &block)
+      path ||= filename[%r{docs/reference/(.*/.*).md$}, 1]
+
+      # calculate name/type
+      if path != "index"
+        name = filename[%r{([^/]+).md$}, 1]
+        type = path.split("/")[0..-2]
+        type = type.map(&:capitalize).join(" ")
+        # really bad way to sort
+        type = type.gsub(/^(Compat|Error)\b/, "\u2063\\1") #  U+2063 INVISIBLE SEPARATOR
+      else
+        name = type = nil
+      end
+
+      # now yield
+      entries = [Entry.new(name, path, type)]
+      output = render(filename)
+      store_path = "#{path}.html"
+      yield({entries:, output:, path:, store_path:})
+    end
+
+    # render/style HTML
+    def render(filename)
+      s = md.render(request_one(filename).body)
+
+      # kill all links, they don't work
+      s.gsub!(%r{<a href="[^"]+">(.*?)</a>}, "<span>\\1</span>")
+
+      # syntax highlighting
+      s.gsub!(%r{<pre><code class="typescript">}, "<pre data-language='typescript'><code class='typescript'>")
+
+      # h3 => h4
+      s.gsub!(%r{(</?h)3>}, "\\14>")
+
+      # manually add attribution
+      link = "#{self.class.links[:home]}#{filename.gsub(/^docs/,'').gsub(/md$/,'html')}"
+      s += <<~HTML
+        <div class="_attribution">
+          <p class="_attribution-p">
+            #{options[:attribution]}
+            <br>
+            <a href="#{link}" class="_attribution-link">
+              #{link}
+            </a>
+          </p>
+        </div>
+      HTML
+      s
+    end
+
+    def md
+      @md ||= Redcarpet::Markdown.new(
+        Redcarpet::Render::HTML,
+        autolink: true,
+        fenced_code_blocks: true,
+        tables: true
+      )
+    end
+  end
+end

二进制
public/icons/docs/es_toolkit/16.png


二进制
public/icons/docs/es_toolkit/16@2x.png


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

@@ -0,0 +1 @@
+https://es-toolkit.slash.page/favicon-100x100.png