mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
commit
ab9382ee5b
8 changed files with 94 additions and 0 deletions
|
@ -1,4 +1,8 @@
|
||||||
[
|
[
|
||||||
|
[
|
||||||
|
"2024-02-20",
|
||||||
|
"New documentation: <a href=\"/nextjs/\">Nextjs</a>"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"2024-01-24",
|
"2024-01-24",
|
||||||
"New documentation: <a href=\"/playwright/\">Playwright</a>"
|
"New documentation: <a href=\"/playwright/\">Playwright</a>"
|
||||||
|
|
19
lib/docs/filters/nextjs/clean_html.rb
Normal file
19
lib/docs/filters/nextjs/clean_html.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
module Docs
|
||||||
|
class Nextjs
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
css('.zola-anchor').remove
|
||||||
|
doc.prepend_child("<h1>NextJS2</h1>") if root_page?
|
||||||
|
css('div:contains("NEWS:")').remove
|
||||||
|
css('h2:contains("sponsors"), #sponsor-table').remove
|
||||||
|
css('div.sticky').remove #remove the floating menu
|
||||||
|
css('div.-mt-4').remove #remove the navigation line
|
||||||
|
css('footer').remove
|
||||||
|
css('div.feedback_inlineTriggerWrapper__o7yUx').remove
|
||||||
|
css('header').remove #remove links from the top of the page
|
||||||
|
css('nav').remove
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
43
lib/docs/filters/nextjs/entries.rb
Normal file
43
lib/docs/filters/nextjs/entries.rb
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
module Docs
|
||||||
|
class Nextjs
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
def get_name
|
||||||
|
name = at_css('h1').content
|
||||||
|
name.strip!
|
||||||
|
#name
|
||||||
|
subpath_items = subpath.split('/', -1)
|
||||||
|
if subpath_items.length >= 5
|
||||||
|
subpath_items[3].capitalize + ': ' + name # e.g. Routing: Defining Routes
|
||||||
|
else
|
||||||
|
name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_type
|
||||||
|
if subpath.include?('/architecture')
|
||||||
|
'Architecture'
|
||||||
|
elsif subpath.include?('/community')
|
||||||
|
'Community'
|
||||||
|
elsif subpath.include?('/getting-started')
|
||||||
|
'Getting Started'
|
||||||
|
elsif subpath.include?('/messages')
|
||||||
|
'Messages'
|
||||||
|
elsif subpath.include?('/app/building-your-application')
|
||||||
|
'Using App Router: Building your application'
|
||||||
|
elsif subpath.include?('/app/api-reference')
|
||||||
|
'Using App Router: api-reference'
|
||||||
|
elsif subpath.include?('/app')
|
||||||
|
'Using App Router'
|
||||||
|
elsif subpath.include?('/pages/building-your-application')
|
||||||
|
'Using Pages Router: Building your application'
|
||||||
|
elsif subpath.include?('/pages/api-reference')
|
||||||
|
'Using Pages Router: api-reference'
|
||||||
|
elsif subpath.include?('/pages')
|
||||||
|
'Using Pages Router'
|
||||||
|
else
|
||||||
|
get_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
20
lib/docs/scrapers/nextjs.rb
Normal file
20
lib/docs/scrapers/nextjs.rb
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
module Docs
|
||||||
|
class Nextjs < UrlScraper
|
||||||
|
self.name = 'NextJS'
|
||||||
|
self.type = 'simple'
|
||||||
|
self.release = 'v14.1.0'
|
||||||
|
self.base_url = 'https://nextjs.org/docs'
|
||||||
|
self.initial_paths = %w(reference/)
|
||||||
|
self.links = {
|
||||||
|
home: 'https://www.nextjs.org/',
|
||||||
|
code: 'https://github.com/vercel/next.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
html_filters.push 'nextjs/entries', 'nextjs/clean_html'
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
© 2024 Vercel, Inc.
|
||||||
|
Licensed under the MIT License.
|
||||||
|
HTML
|
||||||
|
end
|
||||||
|
end
|
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"name": "devdocs",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
BIN
public/icons/docs/nextjs/16.png
Normal file
BIN
public/icons/docs/nextjs/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 537 B |
BIN
public/icons/docs/nextjs/16@2x.png
Normal file
BIN
public/icons/docs/nextjs/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
2
public/icons/docs/nextjs/SOURCE
Normal file
2
public/icons/docs/nextjs/SOURCE
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
https://assets.vercel.com/image/upload/v1662130559/nextjs/Icon_dark_background.png
|
||||||
|
https://github.com/vercel/next.js/blob/canary/examples/cms-enterspeed/public/favicon/favicon.ico
|
Loading…
Reference in a new issue