From abec0d937512edd675d80faf2018e0aa5706f8f2 Mon Sep 17 00:00:00 2001 From: Jake Leahy Date: Sun, 28 Jan 2024 15:30:16 +1100 Subject: [PATCH 1/5] Update Nim version and copyright --- lib/docs/scrapers/nim.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/scrapers/nim.rb b/lib/docs/scrapers/nim.rb index 5a9d4f00..d24e19b2 100644 --- a/lib/docs/scrapers/nim.rb +++ b/lib/docs/scrapers/nim.rb @@ -1,7 +1,7 @@ module Docs class Nim < UrlScraper self.type = 'simple' - self.release = '1.4.8' + self.release = '2.0.2' self.base_url = 'https://nim-lang.org/docs/' self.root_path = 'overview.html' self.links = { @@ -14,7 +14,7 @@ module Docs options[:skip] = %w(theindex.html docgen.html tut1.html tut2.html tut3.html tools.html) options[:attribution] = <<-HTML - © 2006–2021 Andreas Rumpf
+ © 2006–2024 Andreas Rumpf
Licensed under the MIT License. HTML From c2a47b323fe0ceeab51bdbfc99e0d049e9e7cd16 Mon Sep 17 00:00:00 2001 From: Jake Leahy Date: Sun, 28 Jan 2024 15:30:48 +1100 Subject: [PATCH 2/5] Update regex now that table of contents is in different format Regex now removes anything that comes after [ or ( --- lib/docs/filters/nim/entries.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/docs/filters/nim/entries.rb b/lib/docs/filters/nim/entries.rb index 7461ab5f..e5ef24ef 100644 --- a/lib/docs/filters/nim/entries.rb +++ b/lib/docs/filters/nim/entries.rb @@ -55,7 +55,8 @@ module Docs css('.simple-toc-section a, .nested-toc-section a').each do |node| entry_name = node.content - entry_name.gsub!(/,.*/, '') + entry_name.gsub!(/(\(|\[).*/, '') + entry_id = slug + node['href'] entries << [entry_name, entry_id, name] end From 62d43fb87550593aa0ba14e70cdda62e897692c0 Mon Sep 17 00:00:00 2001 From: Jake Leahy Date: Sun, 28 Jan 2024 15:50:51 +1100 Subject: [PATCH 3/5] Change from replacement regex to actually searching for the name Makes it work in more scenarios, and also removes the stropping --- lib/docs/filters/nim/entries.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/nim/entries.rb b/lib/docs/filters/nim/entries.rb index e5ef24ef..27d32dfe 100644 --- a/lib/docs/filters/nim/entries.rb +++ b/lib/docs/filters/nim/entries.rb @@ -54,8 +54,8 @@ module Docs else css('.simple-toc-section a, .nested-toc-section a').each do |node| - entry_name = node.content - entry_name.gsub!(/(\(|\[).*/, '') + match = /^`(.*)`|^(\w+)/.match(node.content) + entry_name = match[1] || match[2] entry_id = slug + node['href'] entries << [entry_name, entry_id, name] From db655520a2b847fce7dcc3609e222f5b86a5ab8a Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 4 Feb 2024 19:26:42 +0100 Subject: [PATCH 4/5] nim: keep 1.4 docs --- lib/docs/scrapers/nim.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/docs/scrapers/nim.rb b/lib/docs/scrapers/nim.rb index d24e19b2..9001dbee 100644 --- a/lib/docs/scrapers/nim.rb +++ b/lib/docs/scrapers/nim.rb @@ -1,7 +1,6 @@ module Docs class Nim < UrlScraper self.type = 'simple' - self.release = '2.0.2' self.base_url = 'https://nim-lang.org/docs/' self.root_path = 'overview.html' self.links = { @@ -18,6 +17,14 @@ module Docs Licensed under the MIT License. HTML + version do + self.release = '2.0.2' + end + + version '1' do + self.release = '1.4.8' + end + def get_latest_version(opts) doc = fetch_doc('https://nim-lang.org/docs/overview.html', opts) doc.at_css('.container > .docinfo > tbody > tr:last-child > td').content.strip From e57c6f765a692a691339fc6c82da3067e848ffc3 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 4 Feb 2024 19:28:21 +0100 Subject: [PATCH 5/5] nim: improve additional_entries --- lib/docs/filters/nim/entries.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/docs/filters/nim/entries.rb b/lib/docs/filters/nim/entries.rb index 27d32dfe..1ec4609a 100644 --- a/lib/docs/filters/nim/entries.rb +++ b/lib/docs/filters/nim/entries.rb @@ -16,8 +16,10 @@ module Docs name.remove! ' User Guide' name.remove! ' User\'s manual' name.remove! %r{ \-.*} + name.remove! %r{\Asrc/} + name.remove! %r{\Astd/} name.strip! - name + name.split("/").last end def get_type @@ -58,7 +60,7 @@ module Docs entry_name = match[1] || match[2] entry_id = slug + node['href'] - entries << [entry_name, entry_id, name] + entries << ["#{entry_name} (#{name})", entry_id, name] end end