Unified · Split
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Prettier | 2 | class Prettier |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('.post') | 5 | @doc = at_css('article .markdown') |
| 6 | 6 | ||
| 7 | if root_page? | 7 | if root_page? |
| 8 | at_css('h1').content = 'React Native Documentation' | 8 | at_css('h1').content = 'React Native Documentation' |
| @@ -34,10 +34,12 @@ module Docs · 25 unmodified lines | |||
| 34 | node.replace(node.at_css('pre.highlight')) | 34 | node.replace(node.at_css('pre.highlight')) |
| 35 | end | 35 | end |
| 36 | 36 | ||
| 37 | css('.prism').each do |node| | 37 | css('.prism-code').each do |node| |
| 38 | node.name = 'pre' | 38 | node.name = 'pre' |
| 39 | node['data-language'] = node['class'][/(?<=language\-)(\w+)/] | 39 | node['data-language'] = node['class'][/(?<=language\-)(\w+)/] |
| 40 | node.content = node.content | 40 | node.content = node.css('.token-line').map(&:content).join("\n") |
| 41 | node.remove_attribute('class') | ||
| 42 | node.remove_attribute('style') | ||
| 41 | end | 43 | end |
| 42 | 44 | ||
| 43 | css('pre > code.hljs').each do |node| | 45 | css('pre > code.hljs').each do |node| |
| @@ -6,9 +6,9 @@ module Docs · 5 unmodified lines | |||
| 6 | end | 6 | end |
| 7 | 7 | ||
| 8 | def type | 8 | def type |
| 9 | link = at_css('.navListItemActive') | 9 | link = at_css('.menu__link--active') |
| 10 | section = link.ancestors('.navGroup').first | 10 | section = link.ancestors('.theme-doc-sidebar-item-category-level-1').first |
| 11 | type = section.at_css('h3').content.strip | 11 | type = section.at_css('.menu__link--sublist').content.strip |
| 12 | return name if type == 'Configuring Prettier' | 12 | return name if type == 'Configuring Prettier' |
| 13 | return name if type == 'Usage' | 13 | return name if type == 'Usage' |
| 14 | type | 14 | type |
| @@ -16,9 +16,8 @@ module Docs · 1 unmodified line | |||
| 16 | 16 | ||
| 17 | def additional_entries | 17 | def additional_entries |
| 18 | entries = [] | 18 | entries = [] |
| 19 | css('.mainContainer h2').each do |node| | 19 | css('h2').each do |node| |
| 20 | id = node.at_css('.anchor')['id'] | 20 | entries << [node.text, node['id']] |
| 21 | entries << [node.text, id] | ||
| 22 | end | 21 | end |
| 23 | entries | 22 | entries |
| 24 | end | 23 | end |
| @@ -2,8 +2,8 @@ module Docs · 1 unmodified line | |||
| 2 | class Prettier < UrlScraper | 2 | class Prettier < UrlScraper |
| 3 | self.name = 'Prettier' | 3 | self.name = 'Prettier' |
| 4 | self.type = 'simple' | 4 | self.type = 'simple' |
| 5 | self.release = '3.4.2' | 5 | self.release = '3.5.3' |
| 6 | self.base_url = 'https://prettier.io/docs/en/' | 6 | self.base_url = 'https://prettier.io/docs/' |
| 7 | self.links = { | 7 | self.links = { |
| 8 | home: 'https://prettier.io/', | 8 | home: 'https://prettier.io/', |
| 9 | code: 'https://github.com/prettier/prettier' | 9 | code: 'https://github.com/prettier/prettier' |
| @@ -12,11 +12,10 @@ module Docs · 2 unmodified lines | |||
| 12 | # Docusaurus like react_native | 12 | # Docusaurus like react_native |
| 13 | html_filters.push 'prettier/entries', 'prettier/clean_html' | 13 | html_filters.push 'prettier/entries', 'prettier/clean_html' |
| 14 | 14 | ||
| 15 | options[:container] = '.docMainWrapper' | ||
| 16 | |||
| 17 | options[:attribution] = <<-HTML | 15 | options[:attribution] = <<-HTML |
| 18 | © James Long and contributors | 16 | © James Long and contributors |
| 19 | HTML | 17 | HTML |
| 18 | options[:skip_patterns] = [ /^next/ ] | ||
| 20 | 19 | ||
| 21 | def get_latest_version(opts) | 20 | def get_latest_version(opts) |
| 22 | get_npm_version('prettier', opts) | 21 | get_npm_version('prettier', opts) |