Unified · Split
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | [ |
| 2 | 2 | [ |
| 3 | 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 | 7 | "2024-01-24", |
| @@ -2,6 +2,8 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Nextjs |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | + @doc = at_css('.prose') | |
| 6 | + | |
| 5 | 7 | css('.zola-anchor').remove |
| 6 | 8 | doc.prepend_child("<h1>NextJS2</h1>") if root_page? |
| 7 | 9 | css('div:contains("NEWS:")').remove |
| @@ -12,6 +14,15 @@ module Docs · 4 unmodified lines | ||
| 12 | 14 | css('div.feedback_inlineTriggerWrapper__o7yUx').remove |
| 13 | 15 | css('header').remove #remove links from the top of the page |
| 14 | 16 | 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 | 26 | doc |
| 16 | 27 | end |
| 17 | 28 | end |
| @@ -14,25 +14,25 @@ module Docs · 13 unmodified lines | ||
| 14 | 14 | end |
| 15 | 15 | |
| 16 | 16 | def get_type |
| 17 | − if subpath.include?('/architecture') | |
| 17 | + if slug.start_with?('architecture') | |
| 18 | 18 | 'Architecture' |
| 19 | − elsif subpath.include?('/community') | |
| 19 | + elsif slug.start_with?('community') | |
| 20 | 20 | 'Community' |
| 21 | − elsif subpath.include?('/getting-started') | |
| 21 | + elsif slug.start_with?('getting-started') | |
| 22 | 22 | 'Getting Started' |
| 23 | − elsif subpath.include?('/messages') | |
| 23 | + elsif slug.start_with?('messages') | |
| 24 | 24 | 'Messages' |
| 25 | − elsif subpath.include?('/app/building-your-application') | |
| 25 | + elsif slug.start_with?('app/building-your-application') | |
| 26 | 26 | 'Using App Router: Building your application' |
| 27 | − elsif subpath.include?('/app/api-reference') | |
| 27 | + elsif slug.start_with?('app/api-reference') | |
| 28 | 28 | 'Using App Router: api-reference' |
| 29 | − elsif subpath.include?('/app') | |
| 29 | + elsif slug.start_with?('app') | |
| 30 | 30 | 'Using App Router' |
| 31 | − elsif subpath.include?('/pages/building-your-application') | |
| 31 | + elsif slug.start_with?('pages/building-your-application') | |
| 32 | 32 | 'Using Pages Router: Building your application' |
| 33 | − elsif subpath.include?('/pages/api-reference') | |
| 33 | + elsif slug.start_with?('pages/api-reference') | |
| 34 | 34 | 'Using Pages Router: api-reference' |
| 35 | − elsif subpath.include?('/pages') | |
| 35 | + elsif slug.start_with?('pages') | |
| 36 | 36 | 'Using Pages Router' |
| 37 | 37 | else |
| 38 | 38 | get_name |
| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Nextjs < UrlScraper |
| 3 | − self.name = 'NextJS' | |
| 3 | + self.name = 'Next.js' | |
| 4 | + self.slug = 'nextjs' | |
| 4 | 5 | self.type = 'simple' |
| 5 | − self.release = 'v14.1.0' | |
| 6 | + self.release = '14.2.4' | |
| 6 | 7 | self.base_url = 'https://nextjs.org/docs' |
| 7 | 8 | self.initial_paths = %w(reference/) |
| 8 | 9 | self.links = { |
| @@ -11,10 +12,15 @@ module Docs · 2 unmodified lines | ||
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | html_filters.push 'nextjs/entries', 'nextjs/clean_html' |
| 15 | + options[:download_images] = false | |
| 14 | 16 | |
| 15 | 17 | options[:attribution] = <<-HTML |
| 16 | − © 2024 Vercel, Inc. | |
| 18 | + © 2024 Vercel, Inc.<br> | |
| 17 | 19 | Licensed under the MIT License. |
| 18 | 20 | HTML |
| 21 | + | |
| 22 | + def get_latest_version(opts) | |
| 23 | + get_npm_version('next', opts) | |
| 24 | + end | |
| 19 | 25 | end |
| 20 | 26 | end |