History

Update Next.js documentation (14.2.4)

Simon Legner committed 2 years ago

Commit 524e2e11 parent ab9382e4 files · +31 −14Browse files

Unified · Split

4 files
  1. assets/javascripts/news.json +1 −1
  2. lib/docs/filters/nextjs/clean_html.rb +11 −0
  3. lib/docs/filters/nextjs/entries.rb +10 −10
  4. lib/docs/scrapers/nextjs.rb +9 −3
assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
1[1[
2 [2 [
3 "2024-02-20",3 "2024-02-20",
4 "New documentation: <a href=\"/nextjs/\">Nextjs</a>"4 "New documentation: <a href=\"/nextjs/\">Next.js</a>"
5 ],5 ],
6 [6 [
7 "2024-01-24",7 "2024-01-24",
lib/docs/filters/nextjs/clean_html.rb+11−0
@@ -2,6 +2,8 @@ module Docs · 1 unmodified line
2 class Nextjs2 class Nextjs
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 @doc = at_css('.prose')
6
5 css('.zola-anchor').remove7 css('.zola-anchor').remove
6 doc.prepend_child("<h1>NextJS2</h1>") if root_page?8 doc.prepend_child("<h1>NextJS2</h1>") if root_page?
7 css('div:contains("NEWS:")').remove9 css('div:contains("NEWS:")').remove
@@ -12,6 +14,15 @@ module Docs · 4 unmodified lines
12 css('div.feedback_inlineTriggerWrapper__o7yUx').remove14 css('div.feedback_inlineTriggerWrapper__o7yUx').remove
13 css('header').remove #remove links from the top of the page15 css('header').remove #remove links from the top of the page
14 css('nav').remove16 css('nav').remove
17
18 css('h1, h2, h3, h4').each { |node| node.content = node.content }
19
20 css('pre > code').each do |node|
21 node.parent['data-language'] = 'typescript'
22 node.parent.content = node.parent.content
23 end
24 css('div[class^="code-block_header"]').remove
25
15 doc26 doc
16 end27 end
17 end28 end
lib/docs/filters/nextjs/entries.rb+10−10
@@ -14,25 +14,25 @@ module Docs · 13 unmodified lines
14 end14 end
15 15
16 def get_type16 def get_type
17 if subpath.include?('/architecture')17 if slug.start_with?('architecture')
18 'Architecture'18 'Architecture'
19 elsif subpath.include?('/community')19 elsif slug.start_with?('community')
20 'Community'20 'Community'
21 elsif subpath.include?('/getting-started')21 elsif slug.start_with?('getting-started')
22 'Getting Started'22 'Getting Started'
23 elsif subpath.include?('/messages')23 elsif slug.start_with?('messages')
24 'Messages'24 'Messages'
25 elsif subpath.include?('/app/building-your-application')25 elsif slug.start_with?('app/building-your-application')
26 'Using App Router: Building your application'26 'Using App Router: Building your application'
27 elsif subpath.include?('/app/api-reference')27 elsif slug.start_with?('app/api-reference')
28 'Using App Router: api-reference'28 'Using App Router: api-reference'
29 elsif subpath.include?('/app')29 elsif slug.start_with?('app')
30 'Using App Router'30 'Using App Router'
31 elsif subpath.include?('/pages/building-your-application')31 elsif slug.start_with?('pages/building-your-application')
32 'Using Pages Router: Building your application'32 'Using Pages Router: Building your application'
33 elsif subpath.include?('/pages/api-reference')33 elsif slug.start_with?('pages/api-reference')
34 'Using Pages Router: api-reference'34 'Using Pages Router: api-reference'
35 elsif subpath.include?('/pages')35 elsif slug.start_with?('pages')
36 'Using Pages Router'36 'Using Pages Router'
37 else37 else
38 get_name38 get_name
lib/docs/scrapers/nextjs.rb+9−3
@@ -1,8 +1,9 @@
1module Docs1module Docs
2 class Nextjs < UrlScraper2 class Nextjs < UrlScraper
3 self.name = 'NextJS'3 self.name = 'Next.js'
4 self.slug = 'nextjs'
4 self.type = 'simple'5 self.type = 'simple'
5 self.release = 'v14.1.0'6 self.release = '14.2.4'
6 self.base_url = 'https://nextjs.org/docs'7 self.base_url = 'https://nextjs.org/docs'
7 self.initial_paths = %w(reference/)8 self.initial_paths = %w(reference/)
8 self.links = {9 self.links = {
@@ -11,10 +12,15 @@ module Docs · 2 unmodified lines
11 }12 }
12 13
13 html_filters.push 'nextjs/entries', 'nextjs/clean_html'14 html_filters.push 'nextjs/entries', 'nextjs/clean_html'
15 options[:download_images] = false
14 16
15 options[:attribution] = <<-HTML17 options[:attribution] = <<-HTML
16 &copy; 2024 Vercel, Inc.18 &copy; 2024 Vercel, Inc.<br>
17 Licensed under the MIT License.19 Licensed under the MIT License.
18 HTML20 HTML
21
22 def get_latest_version(opts)
23 get_npm_version('next', opts)
24 end
19 end25 end
20end26end