From f37088a82ec22980baf10aa6c059af66d1e8d74a Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 9 Jul 2026 17:58:59 +0200 Subject: [PATCH 1/4] Update JavaScript documentation --- lib/docs/scrapers/mdn/javascript.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/docs/scrapers/mdn/javascript.rb b/lib/docs/scrapers/mdn/javascript.rb index 87ce6430ed..913da9a418 100644 --- a/lib/docs/scrapers/mdn/javascript.rb +++ b/lib/docs/scrapers/mdn/javascript.rb @@ -3,7 +3,7 @@ class Javascript < Mdn prepend FixInternalUrlsBehavior prepend FixRedirectionsBehavior - # release = '2026-05-26' + # release = '2026-07-08' self.name = 'JavaScript' self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference' self.links = { From 08d71f133116732ad6973bb9a5b9689e28cabb88 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 9 Jul 2026 19:43:12 +0200 Subject: [PATCH 2/4] Add MapLibre GL JS documentation --- assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_maplibre_gl.scss | 17 +++++++ lib/docs/filters/maplibre_gl/clean_html.rb | 32 +++++++++++++ lib/docs/filters/maplibre_gl/container.rb | 9 ++++ lib/docs/filters/maplibre_gl/entries.rb | 52 +++++++++++++++++++++ lib/docs/scrapers/maplibre_gl.rb | 45 ++++++++++++++++++ public/icons/docs/maplibre_gl/16.png | Bin 0 -> 736 bytes public/icons/docs/maplibre_gl/16@2x.png | Bin 0 -> 1217 bytes public/icons/docs/maplibre_gl/SOURCE | 1 + 9 files changed, 157 insertions(+) create mode 100644 assets/stylesheets/pages/_maplibre_gl.scss create mode 100644 lib/docs/filters/maplibre_gl/clean_html.rb create mode 100644 lib/docs/filters/maplibre_gl/container.rb create mode 100644 lib/docs/filters/maplibre_gl/entries.rb create mode 100644 lib/docs/scrapers/maplibre_gl.rb create mode 100644 public/icons/docs/maplibre_gl/16.png create mode 100644 public/icons/docs/maplibre_gl/16@2x.png create mode 100644 public/icons/docs/maplibre_gl/SOURCE diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 7ea6d0fe48..5dd9f6c99b 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -76,6 +76,7 @@ @use 'pages/love'; @use 'pages/lua'; @use 'pages/gnu_make'; +@use 'pages/maplibre_gl'; @use 'pages/mariadb'; @use 'pages/mdn'; @use 'pages/meteor'; diff --git a/assets/stylesheets/pages/_maplibre_gl.scss b/assets/stylesheets/pages/_maplibre_gl.scss new file mode 100644 index 0000000000..513943e9f1 --- /dev/null +++ b/assets/stylesheets/pages/_maplibre_gl.scss @@ -0,0 +1,17 @@ +@use 'global/classes'; + +._maplibre_gl { + > h1 { @extend %block-heading; } + > h2 { @extend %block-heading; } + > h3 { @extend %block-label, %label-blue; } + + code { @extend %label; } + + .admonition { @extend %note; } + .admonition.tip { @extend %note-green; } + .admonition.note, .admonition.info { @extend %note-blue; } + .admonition.warning { @extend %note-orange; } + .admonition-title { + font-weight: var(--bolderFontWeight); + } +} diff --git a/lib/docs/filters/maplibre_gl/clean_html.rb b/lib/docs/filters/maplibre_gl/clean_html.rb new file mode 100644 index 0000000000..126a1f475d --- /dev/null +++ b/lib/docs/filters/maplibre_gl/clean_html.rb @@ -0,0 +1,32 @@ +module Docs + class MaplibreGl + class CleanHtmlFilter < Filter + def call + # Anchor icons next to headings. + css('.headerlink').remove + + # The TypeDoc pages carry a "Defined in: " paragraph on + # every member; it points at a pinned commit and adds noise. + css('p').each do |node| + node.remove if node.content.start_with?('Defined in:') + end + + # MkDocs Material renders highlighted code as + #
…lots of spans…
+ # with per-line anchors. Flatten each block to its plain text and tag + # the language so DevDocs can re-highlight it. + css('div.highlight').each do |node| + language = node['class'][/language-(\w+)/, 1] + pre = node.at_css('pre') + next unless pre + + pre['data-language'] = language if language + pre.content = pre.at_css('code').content + node.replace(pre) + end + + doc + end + end + end +end diff --git a/lib/docs/filters/maplibre_gl/container.rb b/lib/docs/filters/maplibre_gl/container.rb new file mode 100644 index 0000000000..d16eb0e1ad --- /dev/null +++ b/lib/docs/filters/maplibre_gl/container.rb @@ -0,0 +1,9 @@ +module Docs + class MaplibreGl + class ContainerFilter < Filter + def call + at_css '.md-content__inner' + end + end + end +end diff --git a/lib/docs/filters/maplibre_gl/entries.rb b/lib/docs/filters/maplibre_gl/entries.rb new file mode 100644 index 0000000000..61b36da220 --- /dev/null +++ b/lib/docs/filters/maplibre_gl/entries.rb @@ -0,0 +1,52 @@ +module Docs + class MaplibreGl + class EntriesFilter < Docs::EntriesFilter + # Sections of a TypeDoc class page whose members are worth indexing + # individually. + MEMBER_SECTIONS = %w(Constructors Properties Methods Events Accessors).freeze + + def get_name + at_css('h1').content.strip + end + + def get_type + # DevDocs lower-cases paths, so match against the lower-cased segments. + case path + when %r{api/classes/} then 'Classes' + when %r{api/functions/} then 'Functions' + when %r{api/type-aliases/} then 'Type Aliases' + when %r{api/interfaces/} then 'Interfaces' + when %r{api/enumerations/} then 'Enumerations' + when %r{api/variables/} then 'Variables' + when %r{\Aguides/} then 'Guides' + else 'Miscellaneous' + end + end + + def additional_entries + return [] unless class_page? + + entries = [] + section = nil + + css('h2, h3').each do |node| + if node.name == 'h2' + section = node.content.strip + elsif MEMBER_SECTIONS.include?(section) + member = node.content.strip.sub(/\(\)\z/, '').sub(/\?\z/, '') + next if member.empty? + entries << ["#{get_name}.#{member}", "#{path}##{node['id']}"] + end + end + + entries + end + + private + + def class_page? + path.include?('api/classes/') + end + end + end +end diff --git a/lib/docs/scrapers/maplibre_gl.rb b/lib/docs/scrapers/maplibre_gl.rb new file mode 100644 index 0000000000..6188a8d61d --- /dev/null +++ b/lib/docs/scrapers/maplibre_gl.rb @@ -0,0 +1,45 @@ +module Docs + class MaplibreGl < UrlScraper + self.name = 'MapLibre GL JS' + self.slug = 'maplibre_gl' + self.type = 'maplibre_gl' + self.release = '5.24.0' + self.base_url = 'https://maplibre.org/maplibre-gl-js/docs/' + self.root_path = '/' + self.links = { + home: 'https://maplibre.org/maplibre-gl-js/docs/', + code: 'https://github.com/maplibre/maplibre-gl-js' + } + + html_filters.push 'maplibre_gl/container', 'maplibre_gl/clean_html', 'maplibre_gl/entries' + + # Only scrape the TypeDoc-generated API reference and the guides. + # The examples (200+ interactive demos) and the embedded style + # specification are excluded as they aren't API reference material. + options[:only_patterns] = [ + %r{\AAPI/classes/}, + %r{\AAPI/functions/}, + %r{\AAPI/type-aliases/}, + %r{\AAPI/interfaces/}, + %r{\AAPI/enumerations/}, + %r{\AAPI/variables/}, + %r{\Aguides/} + ] + + # The site's navigation links point at the `www.` host, which then + # redirects (301) to the bare domain used by `base_url`. Rewrite them so + # they are recognised as internal URLs and get followed. + options[:fix_urls] = ->(url) do + url.sub(%r{\Ahttps://www\.maplibre\.org/}, 'https://maplibre.org/') + end + + options[:attribution] = <<-HTML + © MapLibre contributors
+ Licensed under the 3-Clause BSD License. + HTML + + def get_latest_version(opts) + get_npm_version('maplibre-gl', opts) + end + end +end diff --git a/public/icons/docs/maplibre_gl/16.png b/public/icons/docs/maplibre_gl/16.png new file mode 100644 index 0000000000000000000000000000000000000000..00c1db8283e46efdbca9c5942171da7d9524b59a GIT binary patch literal 736 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Lb6AYF9SoB8UsT^3j@P1pisjL z28L1t28LG&3=CE?7#PG0=Ijcz0ZJST@Ck9%j9rC>G-6ijCa&|UJ()P=zD~m0*a^2A zH~+0(`=fg8_qYjn97_*2Z2FTm=eb4B4vXv^nRA{wl^s%#S?S+&u6gT!wdfU|H75d^ z&%0F~ZQT4Xy6>iT{Fe3>T`Gx%nxXX_dG&{9byk7pOr4ZbM0CZfbE! zVr~I$J!>|62Sv3cNKbHnT1k0gQ7S`udAVL@UUqSEVnM22eo^}DcQ#T$MJqgA977~7 z$M(1LH5mxB-99u`v2T~wjsQWy?_z~}{|C?H>)E(-NqPJ~?|04|!pvWcIovpAFIu{Z z!KbI=hwkmd9PbjA&OOnePKmC6)upTQ$uunABzleRHkJpn_xYOE-G3}~;a`G8+v1N) zJRD3?3(uqpiZrNwHi=dF!rh=3{BRWB8diJ!tMJpHk?YEz| n{(J1)bx$hh73+Rq|DQ3imG_ZQ)$Hv+H#2y;`njxgN@xNA1RNnm literal 0 HcmV?d00001 diff --git a/public/icons/docs/maplibre_gl/16@2x.png b/public/icons/docs/maplibre_gl/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..49f4b9e98801229a838cf280442dd01fe977ef80 GIT binary patch literal 1217 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7e6l0AZa85pY67#JE_7#My5g&JNk zFq9fFFuY1&V6d9Oz#v{QXIG#N0|Vo{0G|+7&Dd3%F{?o&3R;QEU8Mn&)rbSB)QADA zhq70yN3R5m7^QA_7d>GF>y%Ri<}f25nZ&aLuj!=^umsheCYjub6T$`$E^*A~Z#?p#W9bFm zgf+mp`}=&NK9CYE3GxeOV6O>_%)r2R7=#&*=dVZs3bL1Y`ns~eV&@dpRQ7)cOdbpjswJ)wB`Jv|saDBF zsX&Us$iT=<*T7uYz%soc5!lIL8@MUQTpt6Hc~+E zF7$M946!&}d--MfWd{L<4;y_aIxsSp2Ww;)i%GbMFgYzq;t>fs6`Cg+_|AFZopx8t zH7Dku&92nHIceGF%+0@VpH#_bW00%ZGpXP5kh*Av920}cDc3WqT~C}El5U=lIjldu z!F|v9or?pz(+QCfBWP-&SE=bB%Ywah|7iiwYl zy?-3oNKOl5^3%2Q#?A?_0vbr zLnl|hoO#pVWB&dpKe+6cD@|G^xail_f7i_t++q&`QQI;9tx>j|Hkg`)=#+i=3t>qrlifJ w(|6DREn;<88uO}bo@89Z@ziyXzopr0HfX Date: Thu, 9 Jul 2026 19:44:34 +0200 Subject: [PATCH 3/4] maplibre_gl: news entry --- assets/javascripts/news.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 6753637e29..38bd3ed1d6 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2026-07-09", + "New documentation: MapLibre GL JS" + ], [ "2026-07-08", "New documentation: Odin" From 3bc46ea00b8227c7edcaa6eed50ffbc6e55ba335 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Thu, 9 Jul 2026 19:47:26 +0200 Subject: [PATCH 4/4] maplibre_gl: use :container --- lib/docs/filters/maplibre_gl/container.rb | 9 --------- lib/docs/scrapers/maplibre_gl.rb | 4 +++- 2 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 lib/docs/filters/maplibre_gl/container.rb diff --git a/lib/docs/filters/maplibre_gl/container.rb b/lib/docs/filters/maplibre_gl/container.rb deleted file mode 100644 index d16eb0e1ad..0000000000 --- a/lib/docs/filters/maplibre_gl/container.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Docs - class MaplibreGl - class ContainerFilter < Filter - def call - at_css '.md-content__inner' - end - end - end -end diff --git a/lib/docs/scrapers/maplibre_gl.rb b/lib/docs/scrapers/maplibre_gl.rb index 6188a8d61d..a36ca6d3d5 100644 --- a/lib/docs/scrapers/maplibre_gl.rb +++ b/lib/docs/scrapers/maplibre_gl.rb @@ -11,7 +11,9 @@ class MaplibreGl < UrlScraper code: 'https://github.com/maplibre/maplibre-gl-js' } - html_filters.push 'maplibre_gl/container', 'maplibre_gl/clean_html', 'maplibre_gl/entries' + html_filters.push 'maplibre_gl/clean_html', 'maplibre_gl/entries' + + options[:container] = '.md-content__inner' # Only scrape the TypeDoc-generated API reference and the guides. # The examples (200+ interactive demos) and the embedded style