From 55214c528844fb8245d8c13c0e07c20442c5205c Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 19 Oct 2025 11:48:23 +0200 Subject: [PATCH 1/2] Add Bun documentation (1.3.0) --- lib/docs/filters/bun/clean_html.rb | 43 +++++++++++++++++++++++++++++ lib/docs/filters/bun/entries.rb | 30 ++++++++++++++++++++ lib/docs/filters/core/images.rb | 1 + lib/docs/scrapers/bun.rb | 32 +++++++++++++++++++++ public/icons/docs/bun/16.png | Bin 0 -> 662 bytes public/icons/docs/bun/16@2x.png | Bin 0 -> 1528 bytes public/icons/docs/bun/SOURCE | 2 ++ 7 files changed, 108 insertions(+) create mode 100644 lib/docs/filters/bun/clean_html.rb create mode 100644 lib/docs/filters/bun/entries.rb create mode 100644 lib/docs/scrapers/bun.rb create mode 100644 public/icons/docs/bun/16.png create mode 100644 public/icons/docs/bun/16@2x.png create mode 100644 public/icons/docs/bun/SOURCE diff --git a/lib/docs/filters/bun/clean_html.rb b/lib/docs/filters/bun/clean_html.rb new file mode 100644 index 0000000000..90dca441d8 --- /dev/null +++ b/lib/docs/filters/bun/clean_html.rb @@ -0,0 +1,43 @@ +module Docs + class Bun + class CleanHtmlFilter < Filter + def call + @doc = at_css('section > .w-full') + + header = at_css('header:has(h1)') + if header + header.content = header.at_css('h1').content + header.name = 'h1' + end + + css('.CodeBlockTab').remove + css('.CopyIcon').remove + css('svg').remove + css('a:contains("Edit on GitHub")').remove + css('a:contains("Previous")').remove + css('a:contains("Next")').remove + + css('pre').each do |node| + node.content = node.content + node['data-language'] = 'typescript' + node.remove_attribute('style') + end + + css('.font-mono').each do |node| + node.name = 'code' + end + + css('.font-mono.text-blue-600').each do |node| + node[:class] = 'token keyword' + end + + css('*[class]').each do |node| + next if node.name == 'code' + node.remove_attribute('class') + end + + doc + end + end + end +end diff --git a/lib/docs/filters/bun/entries.rb b/lib/docs/filters/bun/entries.rb new file mode 100644 index 0000000000..7ae0e1b4ae --- /dev/null +++ b/lib/docs/filters/bun/entries.rb @@ -0,0 +1,30 @@ +module Docs + class Bun + class EntriesFilter < Docs::EntriesFilter + def get_name + name = at_css('h1') ? at_css('h1').content : at_css('h2').content + name + end + + def get_type + slug.split('/').first + end + + def additional_entries + if slug.start_with?('cli') + css('h2[id]').each_with_object [] do |node, entries| + name = get_name + " " + node.content.strip + entries << [name, node['id']] + end + elsif slug.start_with?('api') + css('h2[id]').each_with_object [] do |node, entries| + name = get_name + ": " + node.content.strip + entries << [name, node['id']] + end + else + [] + end + end + end + end +end diff --git a/lib/docs/filters/core/images.rb b/lib/docs/filters/core/images.rb index f63016e332..5d945522b9 100644 --- a/lib/docs/filters/core/images.rb +++ b/lib/docs/filters/core/images.rb @@ -31,6 +31,7 @@ def call self.class.cache[src] = false + next if src.start_with? 'data:image/' url = Docs::URL.parse(src) url.scheme = 'https' if url.scheme.nil? next unless url.scheme == 'http' || url.scheme == 'https' diff --git a/lib/docs/scrapers/bun.rb b/lib/docs/scrapers/bun.rb new file mode 100644 index 0000000000..e161cf3d4f --- /dev/null +++ b/lib/docs/scrapers/bun.rb @@ -0,0 +1,32 @@ +module Docs + class Bun < UrlScraper + self.name = 'Bun' + self.type = 'simple' + self.slug = 'bun' + self.links = { + home: 'https://leafletjs.com/', + code: 'https://github.com/oven-sh/bun' + } + self.release = '1.3.0' + self.base_url = "https://bun.com/docs/" + self.root_path = 'installation' + + html_filters.push 'bun/clean_html', 'bun/entries' + + # https://bun.com/docs/project/licensing + options[:attribution] = <<-HTML + © bun.com, oven-sh, Jarred Sumner
+ Licensed under the MIT License. + HTML + + options[:skip_patterns] = [/^project/] + options[:fix_urls] = ->(url) do + url.sub! %r{.md$}, '' + url + end + + def get_latest_version(opts) + tags = get_github_tags('oven-sh', 'bun', opts) + end + end +end diff --git a/public/icons/docs/bun/16.png b/public/icons/docs/bun/16.png new file mode 100644 index 0000000000000000000000000000000000000000..7d6d524b124c1d5aa8ec16e5b789e8a95e963c0f GIT binary patch literal 662 zcmV;H0%`q;P)VHXU&)r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QP&8T9 z;!L0LwaTM)VAnd#x&J<_zT-~J`S@Kp%*EglQ{>9xoemv90~5aZz+JqZ3?WBj?eot( zCMFlnhLf7G8jGMVNrlv6IElCxaO$vc-6C07W-I9tmyod6UU~+dbrk8aoX`YkM)|gL z7p|)iM-FxkhjjrwJT7w=uOWXXitr#|yuVSD76Dce9brMD6ml1o>ExhwQIsu5qc#&i zeEM$hm3Nb;$Z^Ai1bcaU;_HvzLV0!!&{QohDsa$T6p>`%Bda_j$ji#bHiLk|4VrXp zTQ&!yIakLJf0vvzE+)$e{CvFe)I;}T^OBk34A*Hg&}l40x1|)YltAJvG?!(eIx`C4 zJJ;gt58lAgzx`PjbjL~_Bc~OQkOBfC_VKTO{5`I}YCP_{{U$tc=PkI6+clauV86b7 zWTD=;$Tspvaz^1nULo Date: Sun, 19 Oct 2025 11:49:49 +0200 Subject: [PATCH 2/2] bun: add news entry --- assets/javascripts/news.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 89c7490a0d..1f821abae4 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2025-10-19", - "New documentations: Lit, Graphviz" + "New documentations: Lit, Graphviz, Bun" ], [ "2025-07-14",