From 10a63346501befb44dea63f18a0718d2d36d8dee Mon Sep 17 00:00:00 2001 From: aodhan Date: Mon, 29 Jan 2024 16:13:28 -0800 Subject: [PATCH 1/8] files --- assets/javascripts/news.json | 4 ++++ lib/docs/filters/nextjs/clean_html.rb | 14 ++++++++++++++ lib/docs/filters/nextjs/entries.rb | 13 +++++++++++++ lib/docs/scrapers/nextjs.rb | 10 ++++++++++ public/icons/docs/nextjs/16.png | Bin 0 -> 537 bytes public/icons/docs/nextjs/16@2x.png | Bin 0 -> 1359 bytes public/icons/docs/nextjs/SOURCE | 2 ++ 7 files changed, 43 insertions(+) create mode 100644 lib/docs/filters/nextjs/clean_html.rb create mode 100644 lib/docs/filters/nextjs/entries.rb create mode 100644 lib/docs/scrapers/nextjs.rb create mode 100644 public/icons/docs/nextjs/16.png create mode 100644 public/icons/docs/nextjs/16@2x.png create mode 100644 public/icons/docs/nextjs/SOURCE diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 043a0401..435ecaa5 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2024-01-24", + "New documentation: Nextjs" + ], [ "2024-01-12", "New documentation: Hammerspoon" diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb new file mode 100644 index 00000000..2897b002 --- /dev/null +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -0,0 +1,14 @@ +module Docs + class Nextjs + class CleanHtmlFilter < Filter + def call + css('.zola-anchor').remove + doc.prepend_child("

htmx

") if root_page? + css('div:contains("NEWS:")').remove + css('h2:contains("sponsors"), #sponsor-table').remove + end + doc + + end + end +end diff --git a/lib/docs/filters/nextjs/entries.rb b/lib/docs/filters/nextjs/entries.rb new file mode 100644 index 00000000..ab14276b --- /dev/null +++ b/lib/docs/filters/nextjs/entries.rb @@ -0,0 +1,13 @@ +module Docs + class Nextjs + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + get_name + end + end + end +end \ No newline at end of file diff --git a/lib/docs/scrapers/nextjs.rb b/lib/docs/scrapers/nextjs.rb new file mode 100644 index 00000000..b678caa4 --- /dev/null +++ b/lib/docs/scrapers/nextjs.rb @@ -0,0 +1,10 @@ +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/) + html_filters.push 'nextjs/entries', 'nextjs/clean_html' + end +end \ No newline at end of file diff --git a/public/icons/docs/nextjs/16.png b/public/icons/docs/nextjs/16.png new file mode 100644 index 0000000000000000000000000000000000000000..41e7ff4d90fad34bed25a719a9dad73d249dc750 GIT binary patch literal 537 zcmV+!0_OdRP)^uQ+Emx|^rzrzwfZbck`o4oU6LfHTCF|@z_nT}{V(9h zCO(sTy^c&KGkq)&MUnA59{@$8QO0qcA7``KscD+vDW#>|ZufF$BZ?yS`#naZ5jc(m z0B{_K`FsvpmVMUS?e@jTt=tU@#E!kiR<<1$CT11+qQeqH0>Cs z?>G+2=kx4vIIv2k!T_*#yUj#V42-2|n!^L&KKqr;W`kz4iOFPwWHO1xVgX8NxQy|l zD87EB3(K-F91bxakFj2_10($1*Bh@W$}d95?J?nbp8xLm`*2+s-EKDkCWPD+MH%pd zApBNU_5GeWpU=qUa=2VB0D#-=hDM`-LZN_SvFJBQr_=9*kQD$x*Y$6Oq^c@wwOT9^ ziQI*x{|{>3+wf|f6lJ!{$Px8iA3Tx9*++QAuG$W b0`-3YOiJ%0RMtZJ00000NkvXXu0mjfzh?b} literal 0 HcmV?d00001 diff --git a/public/icons/docs/nextjs/16@2x.png b/public/icons/docs/nextjs/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..e35d18e294a4deb1ca68e615990f0eaf473914c4 GIT binary patch literal 1359 zcmV-V1+e;wP)sU&PRW_dGiB19;ORR=niNPo<>cV_NB2#sKWulptUW$wA>`|i2t+_{IK z0YoAZkq{CvO>?+VC=5|by8$pk5EeyI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IZbzTbo}mgI>$`Y zT&&fcHgv|3NW{i*Tu|5b;bO5kxY?c)K@b+LR_kM)=cgEB^Ut0=`=?%?{{nQb|7?XQ RH8lVL002ovPDHLkV1kzqn0o*K literal 0 HcmV?d00001 diff --git a/public/icons/docs/nextjs/SOURCE b/public/icons/docs/nextjs/SOURCE new file mode 100644 index 00000000..178b8630 --- /dev/null +++ b/public/icons/docs/nextjs/SOURCE @@ -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 \ No newline at end of file From 903fac58c242bca8d4d928e286b0feac1cd786a8 Mon Sep 17 00:00:00 2001 From: Mike Murphy Date: Mon, 5 Feb 2024 17:28:23 -0800 Subject: [PATCH 2/8] Fixed compile error in nextjs/clean_html.rb --- lib/docs/filters/nextjs/clean_html.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index 2897b002..4f4f6240 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -6,9 +6,8 @@ module Docs doc.prepend_child("

htmx

") if root_page? css('div:contains("NEWS:")').remove css('h2:contains("sponsors"), #sponsor-table').remove - end doc - + end end end end From aafcac1fdec05b144b044b621987a039217f2259 Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 10 Feb 2024 17:46:41 -0800 Subject: [PATCH 3/8] Now generates output, still need to perfect filters --- lib/docs/scrapers/nextjs.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/docs/scrapers/nextjs.rb b/lib/docs/scrapers/nextjs.rb index b678caa4..299eb70c 100644 --- a/lib/docs/scrapers/nextjs.rb +++ b/lib/docs/scrapers/nextjs.rb @@ -1,10 +1,20 @@ module Docs class Nextjs < UrlScraper - self.name = 'nextjs`' + self.name = 'nextjs' self.type = 'simple' self.release = 'v14.1.0' self.base_url = 'https://nextjs.org/docs' - self.initial_paths = %w(reference/) - html_filters.push 'nextjs/entries', 'nextjs/clean_html' + 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 \ No newline at end of file +end From deb5f816549329f09299a6c044e8cd230c4e2f2b Mon Sep 17 00:00:00 2001 From: murphnomer Date: Tue, 13 Feb 2024 19:25:07 -0800 Subject: [PATCH 4/8] Fixed project name --- lib/docs/filters/nextjs/clean_html.rb | 2 +- lib/docs/scrapers/nextjs.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index 4f4f6240..2ff629df 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -3,7 +3,7 @@ module Docs class CleanHtmlFilter < Filter def call css('.zola-anchor').remove - doc.prepend_child("

htmx

") if root_page? + doc.prepend_child("

NextJS

") if root_page? css('div:contains("NEWS:")').remove css('h2:contains("sponsors"), #sponsor-table').remove doc diff --git a/lib/docs/scrapers/nextjs.rb b/lib/docs/scrapers/nextjs.rb index 299eb70c..a20cf800 100644 --- a/lib/docs/scrapers/nextjs.rb +++ b/lib/docs/scrapers/nextjs.rb @@ -1,6 +1,6 @@ module Docs class Nextjs < UrlScraper - self.name = 'nextjs' + self.name = 'NextJS' self.type = 'simple' self.release = 'v14.1.0' self.base_url = 'https://nextjs.org/docs' From a1d4f87fc4860305027b4c1ecfa61c949b492ea2 Mon Sep 17 00:00:00 2001 From: Yen Ton Date: Tue, 20 Feb 2024 00:24:38 -0800 Subject: [PATCH 5/8] get nextjs types by subpath, removed the sticky menu --- lib/docs/filters/nextjs/clean_html.rb | 3 ++- lib/docs/filters/nextjs/entries.rb | 34 ++++++++++++++++++++------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index 2ff629df..8c290d58 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -3,9 +3,10 @@ module Docs class CleanHtmlFilter < Filter def call css('.zola-anchor').remove - doc.prepend_child("

NextJS

") if root_page? + doc.prepend_child("

NextJS2

") if root_page? css('div:contains("NEWS:")').remove css('h2:contains("sponsors"), #sponsor-table').remove + css('div.sticky').remove #remove the floating menu doc end end diff --git a/lib/docs/filters/nextjs/entries.rb b/lib/docs/filters/nextjs/entries.rb index ab14276b..fc785d1c 100644 --- a/lib/docs/filters/nextjs/entries.rb +++ b/lib/docs/filters/nextjs/entries.rb @@ -1,13 +1,29 @@ module Docs - class Nextjs - class EntriesFilter < Docs::EntriesFilter - def get_name - at_css('h1').content - end + class Nextjs + class EntriesFilter < Docs::EntriesFilter + def get_name + name = at_css('h1').content + name.strip! + name + end - def get_type - get_name - 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') + 'Using App Router' + elsif subpath.include?('/pages') + 'Using Pages Router' + else + get_name end + end end -end \ No newline at end of file + end +end From da6cab72d0666a74df40988525d8de8f0d3edf0f Mon Sep 17 00:00:00 2001 From: aodhan Date: Sat, 24 Feb 2024 09:52:31 -0800 Subject: [PATCH 6/8] removed footer --- lib/docs/filters/nextjs/clean_html.rb | 2 ++ package-lock.json | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 package-lock.json diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index 8c290d58..e86f421c 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -7,6 +7,8 @@ module Docs css('div:contains("NEWS:")').remove css('h2:contains("sponsors"), #sponsor-table').remove css('div.sticky').remove #remove the floating menu + css('footer').remove + css('div.feedback_inlineTriggerWrapper__o7yUx').remove doc end end diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..c77b993a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "devdocs", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From 54ec89c2ed2c9d67acd96e0d139bc16dbdce1add Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 26 Feb 2024 22:16:15 -0800 Subject: [PATCH 7/8] Removed Previous and Next links from bottom of pages --- lib/docs/filters/nextjs/clean_html.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index e86f421c..ab5d6164 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -9,6 +9,8 @@ module Docs css('div.sticky').remove #remove the floating menu 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 From e3aa27cc31242c594fcf337c269b3ffa60ca7472 Mon Sep 17 00:00:00 2001 From: Yen Ton Date: Sun, 3 Mar 2024 01:01:03 -0800 Subject: [PATCH 8/8] sorted sub-subsection by subsection --- lib/docs/filters/nextjs/clean_html.rb | 1 + lib/docs/filters/nextjs/entries.rb | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index ab5d6164..6197de17 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -7,6 +7,7 @@ module Docs 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 diff --git a/lib/docs/filters/nextjs/entries.rb b/lib/docs/filters/nextjs/entries.rb index fc785d1c..4e67f00d 100644 --- a/lib/docs/filters/nextjs/entries.rb +++ b/lib/docs/filters/nextjs/entries.rb @@ -4,7 +4,13 @@ module Docs def get_name name = at_css('h1').content name.strip! - name + #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 @@ -16,8 +22,16 @@ module Docs '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