From d49eea4640360a8f979ac516c73399c4f7dcbf83 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Tue, 7 Dec 2021 23:23:34 +0100 Subject: [PATCH] Add Prettier documentation (2.5.1) https://prettier.io/ --- assets/javascripts/news.json | 1 + .../templates/pages/about_tmpl.coffee | 5 ++++ lib/docs/filters/prettier/entries.rb | 27 ++++++++++++++++++ lib/docs/scrapers/prettier.rb | 25 ++++++++++++++++ public/icons/docs/prettier/16.png | Bin 0 -> 941 bytes public/icons/docs/prettier/16@2x.png | Bin 0 -> 1528 bytes public/icons/docs/prettier/SOURCE | 1 + 7 files changed, 59 insertions(+) create mode 100644 lib/docs/filters/prettier/entries.rb create mode 100644 lib/docs/scrapers/prettier.rb create mode 100644 public/icons/docs/prettier/16.png create mode 100644 public/icons/docs/prettier/16@2x.png create mode 100644 public/icons/docs/prettier/SOURCE diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index f5abd69c..c935a4ee 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,6 +1,7 @@ [ [ "2021-12-07", + "New documentation: Prettier", "Renamed documentation: Web APIs" ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 5cbc121d..856dd9a6 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -666,6 +666,11 @@ credits = [ '1996-2021 The PostgreSQL Global Development Group
© 1994 The Regents of the University of California', 'PostgreSQL', 'https://www.postgresql.org/about/licence/' + ], [ + 'Prettier', + 'James Long and contributors', + 'MIT', + 'https://raw.githubusercontent.com/prettier/prettier/main/LICENSE ' ], [ 'Puppeteer', '2021 Google Inc', diff --git a/lib/docs/filters/prettier/entries.rb b/lib/docs/filters/prettier/entries.rb new file mode 100644 index 00000000..c3411a05 --- /dev/null +++ b/lib/docs/filters/prettier/entries.rb @@ -0,0 +1,27 @@ +module Docs + class Prettier + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').children.select(&:text?).map(&:content).join.strip + end + + def type + link = at_css('.navListItemActive') + section = link.ancestors('.navGroup').first + type = section.at_css('h3').content.strip + return name if type == 'Configuring Prettier' + return name if type == 'Usage' + type + end + + def additional_entries + entries = [] + css('.mainContainer h2').each do |node| + id = node.at_css('.anchor')['id'] + entries << [node.text, id] + end + entries + end + end + end +end diff --git a/lib/docs/scrapers/prettier.rb b/lib/docs/scrapers/prettier.rb new file mode 100644 index 00000000..7027d9fa --- /dev/null +++ b/lib/docs/scrapers/prettier.rb @@ -0,0 +1,25 @@ +module Docs + class Prettier < UrlScraper + self.name = 'Prettier' + self.type = 'simple' + self.release = '2.5.1' + self.base_url = 'https://prettier.io/docs/en/' + self.links = { + home: 'https://prettier.io/', + code: 'https://github.com/prettier/prettier' + } + + # Docusaurus like react_native + html_filters.push 'prettier/entries', 'react_native/clean_html' + + options[:container] = '.docMainWrapper' + + options[:attribution] = <<-HTML + © James Long and contributors + HTML + + def get_latest_version(opts) + get_npm_version('prettier', opts) + end + end +end diff --git a/public/icons/docs/prettier/16.png b/public/icons/docs/prettier/16.png new file mode 100644 index 0000000000000000000000000000000000000000..212eae801dd835bf8119e493a2419c04a3defedb GIT binary patch literal 941 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!YKdz^NlIc#s#R`&N@iLmgOP!e zp{}8ku7P=ok&%^=p_PfLwt<0_fkB$?Uk;!KmUKs7M+SzC{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5lwdFM^mS!_%EK-uYI5g-g%<+@ zHPD<{LW9OKMa9FPk{MgCbip6T(nettH}CbsI9PRgcsDFLA=0b%w& zKxO_}S?(n%?oByCjk&=^scwPM?n)MpYCvPHoow@R?TZR*3kpoK3N?dcTwJ3wqN?(u zE8U#K%%T$YT)b6G?UYUJCA3UTZOuAMY$jCL7N%IKm{_S>I4K(0Bv?DOyLz>`dX+f1 zX&71STe##Wl$NDbMF*!V7}}}<)fif(Mp*V2+4dFMR;Af!m|00^851k>YCVu`vy4%`();L=0w~2y1E6#COgI? z*(c?BWmecF<|)~@s+u_{S-V(f7g^>Nnk6Lq+c~s*d31QXN88zj`NikPRQh`*C>aC8 z#M!{YEiNSA)6=%6%%-oxwy(l&LZw|{inW@hlZvUmzPW2|bY)&_MM+X+c1)3}t+Roh zgORa1OpoAdTfs;tc1Ik7R0T6gZ)+U(u4 zwWj9pA7-XTCdY${3lkp-P7J(gxUuk~f+%OF=Sj_#nJ*=0M&7hkXuPxMPt&1Ak0xE( z^r_2h!9u3ctEO8^zkcQIE%V(p^{hkVv}@bG^_^SyZeCnuWaNadeg8Ox)qUqZ;$>4X zUgkI3F8P^G+>QfpEQ_C?jo(lp_&!O2p|YbP0 Hl+XkK+rT%y literal 0 HcmV?d00001 diff --git a/public/icons/docs/prettier/16@2x.png b/public/icons/docs/prettier/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..7c0f3cc019cbb7b1cb4bf2fb7d697dfabc1f7cde GIT binary patch literal 1528 zcmWksX;2df6khRwqS%fga)c172_YAo&2Bck*(=$E5Xde8QNVhDAb5dTqkY-PVSiex?tkFZ-uE@8~|*P0f68JfLDQ$FaiK;K>!%d2LSwY z0GLtU+?PoN7Qrq%XAK^n5*#@lJ5peI2>?NNosMj4j1rDfz|l!ij6x@d37M6XrSKBW zEKWAWgLs?FZIXTY8!GzSxNmBv{NKA3b1~G_>K`b7` zqLi=$rJC$qvz<#r2%Qmbsv_IHRC_Je?xov(Oq-W>@`hM7D#tBJgjGRUXCjo}OZjVQ zCx^zWP`S|(rz7Ik1_Q|xbSA-MLbyFviNs?j{&1^$UOq-}ZNgV4Yfqo@_Uv&r${-4N zRXF|avJ@^}V=&U0u_`252}dblzlZAZ(xnAhtP+-?Op?)(WVFgKbF>;s(-Zscj;1v3 zKsw)?#|o`z$Sq(@rJA z#wd|Q7_r(6DX9jV-GDQwNCk^DXp{oVah9B@?e6w|y{>SpNR4Vt=^_obY!QCH)B50; z_0e(bnLVZ?1WCkLEz22cr%KPpX$<0IO#bd6YD-0p3|ht75>)WY0<6QwGz&CBAc<*N zbX5&4xEaAsR=G*RqnTe6twaQ~ZKewD@KTKets{_GX<1}d4Jo*(z;U$)Tv#MCm{163 z5yFBH6l|2J5UG~LT$S=!PmCR(YRg);6H4W$blfzXdz zoNlxHX+HO0AP{$_-D1i%Tq(?#1cA`upkmiVRp&~%aG<&-Jm}2%za007{>#FSMT|2f z$ekeb`Rb|xcSLyjXZbt#?*4RFb(2Jy*mX$K)zR8{By`;J(b1U3c|YTL--eOU+qeHV zG3+nr2QTN&XamYTXF9eW-QU~W>+$bH2E|j|GfOKHu01~4)4jgDyxjHiy44fUMvSJ0 zXRh8kuB@!{!?EJXNO9z+Ez?#`Teur?hW8_z1Kbm; z->Fgf#^Wj~L2J*k*=$BkiiCyS)IAK1g1QBb?s~2Jpo=eCNPQ3y5jmYbCQnk2@9XS8 zGEKB)&K;y@E#rJJ_|xqvYm18Oy&i9+l5N_%eY?ZR+Dc}GxGr)#_f3BOZsYe)nsBS+2S=U9+d9xWv}MihSHE9tI+y=wAZd2wxC_5ZThiC=VzaX64^$2P zHGCzfbAC_XrF;ELkebs|mb+dY%R5{4rZy}VExjM)S~GOFbdGOCKcx9>5>ya8=pI(C zFCIH}V(HLTN!X4ta^uTqba{D0|TWa6KQ|`1;%Lzp2Py`en_9 zqqkZff*vJM%hvY>gQ~0dNWWiT8fQs{^;-ZdM|nETfk#- z+5Emu!=pWapud*g@7tW18XV31QvPIYtLNnyUGdM-vBIaJ{Vl|T|5pBcYxv5+t_{_9 z>OSjQxC*HLr0IVDrP0)`_0MyJf$~eiA{kgwd2Yh^Rf|8yCjmf8_oLjG`yw2HpaFI( KZ#izx-}*mKN+=5e literal 0 HcmV?d00001 diff --git a/public/icons/docs/prettier/SOURCE b/public/icons/docs/prettier/SOURCE new file mode 100644 index 00000000..3e340ee6 --- /dev/null +++ b/public/icons/docs/prettier/SOURCE @@ -0,0 +1 @@ +https://prettier.io/icon.png