From a9843261b968933d1d871a948a2626fe2cbae89f Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 5 Dec 2021 00:46:39 +0100 Subject: [PATCH] Add esbuild documentation --- assets/javascripts/news.json | 4 +++ .../templates/pages/about_tmpl.coffee | 5 +++ lib/docs/filters/esbuild/clean_html.rb | 19 ++++++++++++ lib/docs/filters/esbuild/entries.rb | 21 +++++++++++++ lib/docs/scrapers/esbuild.rb | 29 ++++++++++++++++++ public/icons/docs/esbuild/16.png | Bin 0 -> 460 bytes public/icons/docs/esbuild/16@2x.png | Bin 0 -> 756 bytes public/icons/docs/esbuild/SOURCE | 1 + 8 files changed, 79 insertions(+) create mode 100644 lib/docs/filters/esbuild/clean_html.rb create mode 100644 lib/docs/filters/esbuild/entries.rb create mode 100644 lib/docs/scrapers/esbuild.rb create mode 100644 public/icons/docs/esbuild/16.png create mode 100644 public/icons/docs/esbuild/16@2x.png create mode 100644 public/icons/docs/esbuild/SOURCE diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index a8217c2b..f011506e 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2021-12-05", + "New documentation: esbuild" + ], [ "2021-12-04", "New documentation: Vite" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index e5349e9c..144b4622 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -291,6 +291,11 @@ credits = [ '2010-2021 Ericsson AB', 'Apache', 'https://raw.githubusercontent.com/erlang/otp/maint/LICENSE.txt' + ], [ + 'esbulid', + '2020 Evan Wallace', + 'MIT', + 'https://raw.githubusercontent.com/evanw/esbuild/blob/master/LICENSE.md' ], [ 'ESLint', 'OpenJS Foundation and other contributors', diff --git a/lib/docs/filters/esbuild/clean_html.rb b/lib/docs/filters/esbuild/clean_html.rb new file mode 100644 index 00000000..068c17cb --- /dev/null +++ b/lib/docs/filters/esbuild/clean_html.rb @@ -0,0 +1,19 @@ +module Docs + class Esbuild + class CleanHtmlFilter < Filter + def call + css('figure.bench').remove + css('.permalink').remove + css('.switcher').remove + css('pre').each do |node| + node.content = node.content + node['data-language'] = 'javascript' + node['data-language'] = 'sh' if node['class'] && node['class'].include?('cli') + node['data-language'] = 'go' if node['class'] && node['class'].include?('go') + node['class'] = nil + end + doc + end + end + end +end diff --git a/lib/docs/filters/esbuild/entries.rb b/lib/docs/filters/esbuild/entries.rb new file mode 100644 index 00000000..26cce239 --- /dev/null +++ b/lib/docs/filters/esbuild/entries.rb @@ -0,0 +1,21 @@ +module Docs + class Esbuild + class EntriesFilter < Docs::EntriesFilter + def name + at_css('h1').content + end + def type + at_css('h1').content + end + + def additional_entries + entries = [] + type = at_css('h1').content + css('h2[id], h3[id]').each do |node| + entries << [node.content.gsub(/^#/, ''), node['id'], type] + end + entries + end + end + end +end diff --git a/lib/docs/scrapers/esbuild.rb b/lib/docs/scrapers/esbuild.rb new file mode 100644 index 00000000..c495518e --- /dev/null +++ b/lib/docs/scrapers/esbuild.rb @@ -0,0 +1,29 @@ +module Docs + class Esbuild < UrlScraper + self.name = 'esbuild' + self.slug = 'esbuild' + self.type = 'simple' + self.links = { + home: 'https://esbuild.github.io/', + code: 'https://github.com/evanw/esbuild' + } + + options[:container] = 'main' + options[:root_title] = 'esbuild' + + options[:attribution] = <<-HTML + © 2020 Evan Wallace
+ Licensed under the MIT License. + HTML + + version do + self.release = '0.14.2' + self.base_url = 'https://esbuild.github.io/' + html_filters.push 'esbuild/clean_html', 'esbuild/entries' + end + + def get_latest_version(opts) + get_npm_version('esbuild', opts) + end + end +end diff --git a/public/icons/docs/esbuild/16.png b/public/icons/docs/esbuild/16.png new file mode 100644 index 0000000000000000000000000000000000000000..c2891b011f74a05e823f1306f4402348f2882bdb GIT binary patch literal 460 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!WQl7;NpOBzNqJ&XDnogBxn5>o zc5!lIL8@MUQTpt6Hc~)EoCO|{#S9FLdLYbLT`1)X6r3F36XFV_|DR#_f0g0?ZHE8n z82(>i_tp$Vte{Nyy1cNJ>f?e4Z=~be3#MkY6wZD;v9( zwvKLZ--L;ir%ao^d(Yl|m#d{$ICrb(y_J*xbHesy)pAds zAENJ9J^gl3w)9l10>6Lh CCczB= literal 0 HcmV?d00001 diff --git a/public/icons/docs/esbuild/16@2x.png b/public/icons/docs/esbuild/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..9b233f85e3e7d473b1aca7686e76b3e1f5366e80 GIT binary patch literal 756 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSM@i<$9TU z*~Q6;1*v-ZMd`EO*+>BuaTa()7Bes~#eguQunngH@n42XaXhzK$X6bEu42%-|s zMq?nWgloaZ_<4%)%>kw-yOlLUI(q9n*Kn1P*xlZTg2R6HL%HKn|tt+8GNfbciq@|OyW+N;;HcShOD{9Ps(-AGz32W zZd~c&{PE`@$!8C?oM4gt_Ho}2>%D*H6uWls?f?4UanI88^%K83E9_Y0>Sj`<+EQV1 z{A`!Nre~JB7*fC0zuUL6=~=~>6-p-(r!RQvUfE^E6R_e%bDvWy+w?!apXV>Q+4`V~dL64f{q^3B5}D$fE&A=t_p>k9XD5