History

Add Prettier documentation (2.5.1)

https://prettier.io/

Simon Legner committed 4 years ago

Commit d49eea41 parent 6ad07847 files · +57 −-2Browse files

Unified · Split

7 files
  1. assets/javascripts/news.json +1 −0
  2. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  3. lib/docs/filters/prettier/entries.rb +27 −0
  4. lib/docs/scrapers/prettier.rb +25 −0
  5. public/icons/docs/prettier/16.png +0 −0
  6. public/icons/docs/prettier/16@2x.png +0 −0
  7. public/icons/docs/prettier/SOURCE +1 −0
assets/javascripts/news.json+1−0
@@ -1,6 +1,7 @@
1[1[
2 [2 [
3 "2021-12-07",3 "2021-12-07",
4 "New documentation: <a href=\"/prettier/\">Prettier</a>",
4 "Renamed documentation: <a href=\"/dom/\">Web APIs</a>"5 "Renamed documentation: <a href=\"/dom/\">Web APIs</a>"
5 ],6 ],
6 [7 [
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -666,6 +666,11 @@ credits = [ · 665 unmodified lines
666 '1996-2021 The PostgreSQL Global Development Group<br>&copy; 1994 The Regents of the University of California',666 '1996-2021 The PostgreSQL Global Development Group<br>&copy; 1994 The Regents of the University of California',
667 'PostgreSQL',667 'PostgreSQL',
668 'https://www.postgresql.org/about/licence/'668 'https://www.postgresql.org/about/licence/'
669 ], [
670 'Prettier',
671 'James Long and contributors',
672 'MIT',
673 'https://raw.githubusercontent.com/prettier/prettier/main/LICENSE '
669 ], [674 ], [
670 'Puppeteer',675 'Puppeteer',
671 '2021 Google Inc',676 '2021 Google Inc',
lib/docs/filters/prettier/entries.rb+27−0
@@ -0,0 +1,27 @@
1module Docs
2 class Prettier
3 class EntriesFilter < Docs::EntriesFilter
4 def get_name
5 at_css('h1').children.select(&:text?).map(&:content).join.strip
6 end
7
8 def type
9 link = at_css('.navListItemActive')
10 section = link.ancestors('.navGroup').first
11 type = section.at_css('h3').content.strip
12 return name if type == 'Configuring Prettier'
13 return name if type == 'Usage'
14 type
15 end
16
17 def additional_entries
18 entries = []
19 css('.mainContainer h2').each do |node|
20 id = node.at_css('.anchor')['id']
21 entries << [node.text, id]
22 end
23 entries
24 end
25 end
26 end
27end
lib/docs/scrapers/prettier.rb+25−0
@@ -0,0 +1,25 @@
1module Docs
2 class Prettier < UrlScraper
3 self.name = 'Prettier'
4 self.type = 'simple'
5 self.release = '2.5.1'
6 self.base_url = 'https://prettier.io/docs/en/'
7 self.links = {
8 home: 'https://prettier.io/',
9 code: 'https://github.com/prettier/prettier'
10 }
11
12 # Docusaurus like react_native
13 html_filters.push 'prettier/entries', 'react_native/clean_html'
14
15 options[:container] = '.docMainWrapper'
16
17 options[:attribution] = <<-HTML
18 &copy; James Long and contributors
19 HTML
20
21 def get_latest_version(opts)
22 get_npm_version('prettier', opts)
23 end
24 end
25end
public/icons/docs/prettier/16.png+0−0

Binary file not shown.

public/icons/docs/prettier/16@2x.png+0−0

Binary file not shown.

public/icons/docs/prettier/SOURCE+1−0
@@ -0,0 +1 @@
1https://prettier.io/icon.png