From 8bbbb9e6342b821ba4a8af6a550ab3face0b962e Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 2 Oct 2022 16:06:26 +0200 Subject: [PATCH] Add Svelte documentation (3.50.1) --- assets/javascripts/news.json | 4 +++ .../templates/pages/about_tmpl.coffee | 5 ++++ lib/docs/filters/svelte/clean_html.rb | 11 +++++++ lib/docs/filters/svelte/entries.rb | 27 +++++++++++++++++ lib/docs/scrapers/svelte.rb | 28 ++++++++++++++++++ public/icons/docs/svelte/16.png | Bin 0 -> 954 bytes public/icons/docs/svelte/16@2x.png | Bin 0 -> 1373 bytes public/icons/docs/svelte/SOURCE | 1 + 8 files changed, 76 insertions(+) create mode 100644 lib/docs/filters/svelte/clean_html.rb create mode 100644 lib/docs/filters/svelte/entries.rb create mode 100644 lib/docs/scrapers/svelte.rb create mode 100644 public/icons/docs/svelte/16.png create mode 100644 public/icons/docs/svelte/16@2x.png create mode 100644 public/icons/docs/svelte/SOURCE diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 73d07cc1..e596a931 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2022-10-02", + "New documentation: Svelte" + ], [ "2022-09-21", "Added HTTP/3 to HTTP" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 161cd8c7..cda606e4 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -871,6 +871,11 @@ credits = [ '2009-2012 Statsmodels Developers
© 2006-2008 Scipy Developers
© 2006 Jonathan E. Taylor', 'BSD', 'https://raw.githubusercontent.com/statsmodels/statsmodels/master/LICENSE.txt' + ], [ + 'Svelte', + '2016–2022 Rich Harris and contributors', + 'MIT', + 'https://raw.githubusercontent.com/sveltejs/svelte/master/LICENSE.md' ], [ 'Symfony', '2004-2017 Fabien Potencier', diff --git a/lib/docs/filters/svelte/clean_html.rb b/lib/docs/filters/svelte/clean_html.rb new file mode 100644 index 00000000..579b27b7 --- /dev/null +++ b/lib/docs/filters/svelte/clean_html.rb @@ -0,0 +1,11 @@ +module Docs + class Svelte + class CleanHtmlFilter < Filter + def call + @doc = at_css('main > .content') + at_css('h1').content = 'Svelte' + doc + end + end + end +end diff --git a/lib/docs/filters/svelte/entries.rb b/lib/docs/filters/svelte/entries.rb new file mode 100644 index 00000000..ab7236ff --- /dev/null +++ b/lib/docs/filters/svelte/entries.rb @@ -0,0 +1,27 @@ +module Docs + class Svelte + class EntriesFilter < Docs::EntriesFilter + def get_type + 'Svelte' + end + + def additional_entries + type = 'Svelte' + subtype = nil + css('h2, h3, h4').each_with_object [] do |node, entries| + if node.name == 'h2' + type = node.content.strip + subtype = nil + elsif node.name == 'h3' + subtype = node.content.strip + subtype = nil unless subtype[/Component directives|Element directives/] + end + next if type == 'Before we begin' + name = node.content.strip + name.concat " (#{subtype})" if subtype && node.name == 'h4' + entries << [name, node['id'], subtype || type] + end + end + end + end +end diff --git a/lib/docs/scrapers/svelte.rb b/lib/docs/scrapers/svelte.rb new file mode 100644 index 00000000..822f1847 --- /dev/null +++ b/lib/docs/scrapers/svelte.rb @@ -0,0 +1,28 @@ +module Docs + class Svelte < UrlScraper + self.name = 'Svelte' + self.slug = 'svelte' + self.type = 'simple' + self.links = { + home: 'https://svelte.dev/', + code: 'https://github.com/sveltejs/svelte' + } + + options[:root_title] = 'Svelte' + + options[:attribution] = <<-HTML + © 2016–2022 Rich Harris and contributors
+ Licensed under the MIT License. + HTML + + options[:skip] = %w(team.html plugins/) + + self.release = '3.50.1' + self.base_url = 'https://svelte.dev/docs' + html_filters.push 'svelte/entries', 'svelte/clean_html' + + def get_latest_version(opts) + get_npm_version('svelte', opts) + end + end +end diff --git a/public/icons/docs/svelte/16.png b/public/icons/docs/svelte/16.png new file mode 100644 index 0000000000000000000000000000000000000000..d84820150d86b4ca095b40abbfcbacd74ecb5629 GIT binary patch literal 954 zcmZvadr(Ya7{eYQ-nVZGh$q4O*JM|!$j-xWk=H=&b;US-uHQa-}}v(^A$#Gl^(*eLPCg# zS|y92tJlEm=0x+{TtLWADw*2}*}@XinLvo-Fd?JU zj@2#;p@u7`*2rBy3HierKSOEKLPB^o(NQ`%wGj5d2qjoVKy%377-SrxqopnlTGK4~ zH-y%daR5UL2Ru}v%wS8mJ4R8Fp6Gyw0uG(>)TMb4rn<@lyY#Rg#*u8q`3+df^Ksvb z-*(XFQ7ts15IF)zbI{d+mK)fn!JP}p(n2u|H_OrS0S8l|bjJdM*l{>jfK(|=v+=zL zZBLL82(>46>v66K`Kz&*55p|G1R}IzOT$9a>-X z|H8T;=*FXL3oac%UL53t;%T-H`rD*jjF#Rc_t2HHkqfK4`nvBaee>FFi=~ZKuJ7ND z=bv~t!LzkSaKE^;UU<7{vW++KLtC($)qXqtBj>HC|MH`=LcDC=su3ZZ=rG>8NTqD4 zpZm2Y+St@Gscy_OV*=qT6bez2@A7&69yaln%(RU3p0D|Gv-5;{^XZbBJ(VZDqDk{; z-}KBMUweDIzkB;Q2`qbl{p`zOoL#b*NEM$sb7o0IT|+~_q|>L2iHSS-8Qs?OZ-PQ~ z%d~wLghk;zQN`8Xy{$8Ysy`oFW3rS_&+23J%r5zZDHRtt`1^F4Y;vDN-f_=61Y@JZ zd78^d+RoQzm$_6oiF{H{n)hw4iI3cPG(Jap>v&kRyHle!HK@9(baQ}ltHM$)$`7r} xwU3N?+-lHUEmyBxw_Y>Kw!K)>{N^5c$dHW2;N;iM<|O*TL@n3Ksv;8d{{Y&Dtvvt$ literal 0 HcmV?d00001 diff --git a/public/icons/docs/svelte/16@2x.png b/public/icons/docs/svelte/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d74293e1b3c5e88047475f9a17a6696d33fbf869 GIT binary patch literal 1373 zcmV-j1)}004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00007 zbV*G`2j&U_4h0(#{F1f+000JJOGiWi{{a60|De66lK=n&k4Z#9RCwCGmw9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y!6E literal 0 HcmV?d00001 diff --git a/public/icons/docs/svelte/SOURCE b/public/icons/docs/svelte/SOURCE new file mode 100644 index 00000000..b4d677f6 --- /dev/null +++ b/public/icons/docs/svelte/SOURCE @@ -0,0 +1 @@ +https://svelte.dev/favicon.png