[devdocsgjs/main: 60/239] Add Prettier documentation (2.5.1)
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 60/239] Add Prettier documentation (2.5.1)
- Date: Fri, 8 Apr 2022 07:47:35 +0000 (UTC)
commit d49eea4640360a8f979ac516c73399c4f7dcbf83
Author: Simon Legner <Simon Legner gmail com>
Date: Tue Dec 7 23:23:34 2021 +0100
Add Prettier documentation (2.5.1)
https://prettier.io/
assets/javascripts/news.json | 1 +
.../javascripts/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(+)
---
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: <a href=\"/prettier/\">Prettier</a>",
"Renamed documentation: <a href=\"/dom/\">Web APIs</a>"
],
[
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<br>© 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 00000000..212eae80
Binary files /dev/null and b/public/icons/docs/prettier/16.png differ
diff --git a/public/icons/docs/prettier/16 2x png b/public/icons/docs/prettier/16 2x png
new file mode 100644
index 00000000..7c0f3cc0
Binary files /dev/null and b/public/icons/docs/prettier/16 2x png differ
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]