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 @@
11 [
22 [
33 "2024-02-20",
4− "New documentation: <a href=\"/nextjs/\">Nextjs</a>"
4+ "New documentation: <a href=\"/nextjs/\">Next.js</a>"
55 ],
66 [
77 "2024-01-24",
lib/docs/filters/nextjs/clean_html.rb+11−0
@@ -2,6 +2,8 @@ module Docs · 1 unmodified line
22 class Nextjs
33 class CleanHtmlFilter < Filter
44 def call
5+ @doc = at_css('.prose')
6+
57 css('.zola-anchor').remove
68 doc.prepend_child("<h1>NextJS2</h1>") if root_page?
79 css('div:contains("NEWS:")').remove
@@ -12,6 +14,15 @@ module Docs · 4 unmodified lines
1214 css('div.feedback_inlineTriggerWrapper__o7yUx').remove
1315 css('header').remove #remove links from the top of the page
1416 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+
1526 doc
1627 end
1728 end
lib/docs/filters/nextjs/entries.rb+10−10
@@ -14,25 +14,25 @@ module Docs · 13 unmodified lines
1414 end
1515
1616 def get_type
17− if subpath.include?('/architecture')
17+ if slug.start_with?('architecture')
1818 'Architecture'
19− elsif subpath.include?('/community')
19+ elsif slug.start_with?('community')
2020 'Community'
21− elsif subpath.include?('/getting-started')
21+ elsif slug.start_with?('getting-started')
2222 'Getting Started'
23− elsif subpath.include?('/messages')
23+ elsif slug.start_with?('messages')
2424 'Messages'
25− elsif subpath.include?('/app/building-your-application')
25+ elsif slug.start_with?('app/building-your-application')
2626 'Using App Router: Building your application'
27− elsif subpath.include?('/app/api-reference')
27+ elsif slug.start_with?('app/api-reference')
2828 'Using App Router: api-reference'
29− elsif subpath.include?('/app')
29+ elsif slug.start_with?('app')
3030 'Using App Router'
31− elsif subpath.include?('/pages/building-your-application')
31+ elsif slug.start_with?('pages/building-your-application')
3232 'Using Pages Router: Building your application'
33− elsif subpath.include?('/pages/api-reference')
33+ elsif slug.start_with?('pages/api-reference')
3434 'Using Pages Router: api-reference'
35− elsif subpath.include?('/pages')
35+ elsif slug.start_with?('pages')
3636 'Using Pages Router'
3737 else
3838 get_name
lib/docs/scrapers/nextjs.rb+9−3
@@ -1,8 +1,9 @@
11 module Docs
22 class Nextjs < UrlScraper
3− self.name = 'NextJS'
3+ self.name = 'Next.js'
4+ self.slug = 'nextjs'
45 self.type = 'simple'
5− self.release = 'v14.1.0'
6+ self.release = '14.2.4'
67 self.base_url = 'https://nextjs.org/docs'
78 self.initial_paths = %w(reference/)
89 self.links = {
@@ -11,10 +12,15 @@ module Docs · 2 unmodified lines
1112 }
1213
1314 html_filters.push 'nextjs/entries', 'nextjs/clean_html'
15+ options[:download_images] = false
1416
1517 options[:attribution] = <<-HTML
16− &copy; 2024 Vercel, Inc.
18+ &copy; 2024 Vercel, Inc.<br>
1719 Licensed under the MIT License.
1820 HTML
21+
22+ def get_latest_version(opts)
23+ get_npm_version('next', opts)
24+ end
1925 end
2026 end