From d239d0bf27090db7456767897fc94a7de0834b69 Mon Sep 17 00:00:00 2001 From: cerredz <422michaelcerreto@gmail.com> Date: Fri, 15 May 2026 21:06:39 -0400 Subject: [PATCH 1/3] Add Cycle.js documentation scraper --- lib/docs/filters/cyclejs/clean_html.rb | 24 ++++++++ lib/docs/filters/cyclejs/entries.rb | 26 ++++++++ lib/docs/scrapers/cyclejs.rb | 84 ++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 lib/docs/filters/cyclejs/clean_html.rb create mode 100644 lib/docs/filters/cyclejs/entries.rb create mode 100644 lib/docs/scrapers/cyclejs.rb diff --git a/lib/docs/filters/cyclejs/clean_html.rb b/lib/docs/filters/cyclejs/clean_html.rb new file mode 100644 index 0000000000..b09f079a4f --- /dev/null +++ b/lib/docs/filters/cyclejs/clean_html.rb @@ -0,0 +1,24 @@ +module Docs + class Cyclejs + class CleanHtmlFilter < Filter + def call + css('br').remove + + css('pre > code').each do |node| + parent = node.parent + if node['class'] && node['class'] =~ /language-(\w+)/ + parent['data-language'] = Regexp.last_match(1) + end + parent.content = node.content.strip + end + + css('table[style]', 'tr[style]', 'td[style]', 'th[style]').remove_attr('style') + css('img').each do |node| + node['alt'] = node['alt'].presence || '' + end + + doc + end + end + end +end diff --git a/lib/docs/filters/cyclejs/entries.rb b/lib/docs/filters/cyclejs/entries.rb new file mode 100644 index 0000000000..5317a9c616 --- /dev/null +++ b/lib/docs/filters/cyclejs/entries.rb @@ -0,0 +1,26 @@ +module Docs + class Cyclejs + class EntriesFilter < Docs::EntriesFilter + def get_name + title = at_css('h1') + name = title ? title.content.strip : subpath.sub(/\.html\z/, '').titleize + name = 'Cycle.js' if root_page? + name = 'API Reference' if slug == 'api/index' + name + end + + def get_type + slug.start_with?('api/') ? 'API' : 'Guide' + end + + def additional_entries + css('h2[id], h3[id]').map do |node| + name = node.content.strip + name.sub!(/\A#\s*/, '') + name.sub!(/\s+#\z/, '') + [name, node['id']] + end + end + end + end +end diff --git a/lib/docs/scrapers/cyclejs.rb b/lib/docs/scrapers/cyclejs.rb new file mode 100644 index 0000000000..df27d7c147 --- /dev/null +++ b/lib/docs/scrapers/cyclejs.rb @@ -0,0 +1,84 @@ +require 'redcarpet' + +module Docs + class Cyclejs < UrlScraper + self.name = 'Cycle.js' + self.slug = 'cyclejs' + self.type = 'cyclejs' + self.release = '23.1.0' + self.base_url = 'https://cycle.js.org/' + self.root_path = 'index.html' + self.initial_paths = %w( + getting-started.html + model-view-intent.html + streams.html + drivers.html + components.html + basic-examples.html + dialogue.html + releases.html + api/index.html + api/run.html + api/rxjs-run.html + api/most-run.html + api/dom.html + api/html.html + api/http.html + api/history.html + api/isolate.html + api/state.html + ) + + self.links = { + home: 'https://cycle.js.org/', + code: 'https://github.com/cyclejs/cyclejs' + } + + html_filters.push 'cyclejs/clean_html', 'cyclejs/entries' + + options[:only_patterns] = [ + /\Aindex\.html\z/, + /\Agetting-started\.html\z/, + /\Amodel-view-intent\.html\z/, + /\Astreams\.html\z/, + /\Adrivers\.html\z/, + /\Acomponents\.html\z/, + /\Abasic-examples\.html\z/, + /\Adialogue\.html\z/, + /\Areleases\.html\z/, + /\Aapi\// + ] + + options[:attribution] = <<-HTML + © 2014–present Cycle.js contributors.
+ Licensed under the MIT License. + HTML + + def get_latest_version(opts) + get_npm_version('@cycle/dom', opts) + end + + private + + def parse(response) + document = Parser.new(response.body).html + markdown = document.at_css('script#markdown') + + return super unless markdown + + html = markdown_renderer.render(markdown.content.strip) + title = document.at_css('title').try(:content).try(:strip) + [Parser.new("#{title}#{html}").html, title] + end + + def markdown_renderer + @markdown_renderer ||= Redcarpet::Markdown.new( + Redcarpet::Render::HTML.new(with_toc_data: true), + autolink: true, + fenced_code_blocks: true, + no_intra_emphasis: true, + tables: true + ) + end + end +end From 5ea476be5b7b786cc3cf111650b614a3cbf0363c Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Tue, 26 May 2026 18:52:10 +0200 Subject: [PATCH 2/3] Update Cycle.js documentation (23.1.0) --- lib/docs/filters/cyclejs/clean_html.rb | 5 ++--- lib/docs/filters/cyclejs/entries.rb | 3 ++- lib/docs/scrapers/cyclejs.rb | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/docs/filters/cyclejs/clean_html.rb b/lib/docs/filters/cyclejs/clean_html.rb index b09f079a4f..cfafee84b9 100644 --- a/lib/docs/filters/cyclejs/clean_html.rb +++ b/lib/docs/filters/cyclejs/clean_html.rb @@ -2,13 +2,12 @@ module Docs class Cyclejs class CleanHtmlFilter < Filter def call + return "

Cycle.js

A functional and reactive JavaScript framework for predictable code

" if root_page? css('br').remove css('pre > code').each do |node| parent = node.parent - if node['class'] && node['class'] =~ /language-(\w+)/ - parent['data-language'] = Regexp.last_match(1) - end + parent['data-language'] = 'javascript' parent.content = node.content.strip end diff --git a/lib/docs/filters/cyclejs/entries.rb b/lib/docs/filters/cyclejs/entries.rb index 5317a9c616..b7149201c3 100644 --- a/lib/docs/filters/cyclejs/entries.rb +++ b/lib/docs/filters/cyclejs/entries.rb @@ -6,6 +6,7 @@ def get_name name = title ? title.content.strip : subpath.sub(/\.html\z/, '').titleize name = 'Cycle.js' if root_page? name = 'API Reference' if slug == 'api/index' + name.delete_suffix! ' - source' name end @@ -18,7 +19,7 @@ def additional_entries name = node.content.strip name.sub!(/\A#\s*/, '') name.sub!(/\s+#\z/, '') - [name, node['id']] + [get_name + ': ' + name, node['id']] end end end diff --git a/lib/docs/scrapers/cyclejs.rb b/lib/docs/scrapers/cyclejs.rb index df27d7c147..284e4f50e7 100644 --- a/lib/docs/scrapers/cyclejs.rb +++ b/lib/docs/scrapers/cyclejs.rb @@ -49,6 +49,7 @@ class Cyclejs < UrlScraper /\Aapi\// ] + options[:download_images] = false options[:attribution] = <<-HTML © 2014–present Cycle.js contributors.
Licensed under the MIT License. From dc085c149f2bce95fa1a83b5a800321b12c05e4e Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Tue, 26 May 2026 18:54:45 +0200 Subject: [PATCH 3/3] Update Cycle.js documentation (23.1.0) --- public/icons/docs/cyclejs/16.png | Bin 0 -> 638 bytes public/icons/docs/cyclejs/16@2x.png | Bin 0 -> 1377 bytes public/icons/docs/cyclejs/SOURCE | 1 + 3 files changed, 1 insertion(+) create mode 100644 public/icons/docs/cyclejs/16.png create mode 100644 public/icons/docs/cyclejs/16@2x.png create mode 100644 public/icons/docs/cyclejs/SOURCE diff --git a/public/icons/docs/cyclejs/16.png b/public/icons/docs/cyclejs/16.png new file mode 100644 index 0000000000000000000000000000000000000000..b870a7a67842145e434b9805b5b1e345a2632ea9 GIT binary patch literal 638 zcmV-^0)hRBP)3vDTF5lvAy#P6*kVdIt%T>6vzC2oxi zjm8~nj2nr@M2#9WpcqODw58C#v@>&Ev=xL9PjWJuOzxAMd+!)kRfg*L9?$mPQnNLZ zz!8ZhmZLKkOC**=3|Hh1)8-Z-$MmVY#cJ9nG%;QsP6Q_o7YI%*P6exi)jsR`k$f<7 z1laC(dDW`1?;?^w==(lBF+?K7YKXj|2$B@)}9&b0P{lbZkt43&`tco0awfUIRKV;!<2> zE??#>O@$Lw!z!uEPzlZ>59>Rm-UASufQ3?-LKvP25F=bqX2?*a5=$B}zeC9)y_q~7ynr$NiwGmEV%%bRs-b&pz*`H4KY3pqR>z}HU7i{{>$fFIqI zcM9J;eAsOwi3m&OBBd}yhdc3nr^UwM;i+P;%FAY(Mig<7&+)X;!stLe*xKe%eV0*3 zZjO&}F%vWTDF*1NveMpX&pH5dfeZiuTfIK_*MIXfJ;V%~=}+##Fy>$yhP##G-#gQB z#A3NfIGlq+{p8Vyt^@;bqY>Z-SM}PRn=uh+(K!>RieoK Y0mp0!V(JzcGynhq07*qoM6N<$f;^obaR2}S literal 0 HcmV?d00001 diff --git a/public/icons/docs/cyclejs/16@2x.png b/public/icons/docs/cyclejs/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..7e8be668a4795d606b3a989e0fc9fdda884a9de5 GIT binary patch literal 1377 zcmV-n1)lneP)|r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z7H|u<``wM$N-ZP}!P jo4&`pn>89ae|qhIfRCpYpAOb!00000NkvXXu0mjflh2_x literal 0 HcmV?d00001 diff --git a/public/icons/docs/cyclejs/SOURCE b/public/icons/docs/cyclejs/SOURCE new file mode 100644 index 0000000000..eb89497c99 --- /dev/null +++ b/public/icons/docs/cyclejs/SOURCE @@ -0,0 +1 @@ +https://cycle.js.org/img/cyclejs_logo.svg