From 2b8d9b6c338befe97487cd2c4d470bae36a71094 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sun, 17 Nov 2024 14:13:11 +0100 Subject: [PATCH] Update OCaml documentation (5.2) --- docs/file-scrapers.md | 11 ----------- lib/docs/filters/ocaml/clean_html.rb | 2 ++ lib/docs/scrapers/ocaml.rb | 13 +++++++++---- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/docs/file-scrapers.md b/docs/file-scrapers.md index 3078e176..2f8fd8f3 100644 --- a/docs/file-scrapers.md +++ b/docs/file-scrapers.md @@ -157,17 +157,6 @@ curl https://numpy.org/doc/$VERSION/numpy-html.zip | \ bsdtar --extract --file=- --directory=docs/numpy~$VERSION/ ``` -## OCaml - -Download from https://www.ocaml.org/docs/ the HTML reference: -https://v2.ocaml.org/releases/4.14/ocaml-4.14-refman-html.tar.gz -and extract it as `docs/ocaml`: - -```sh -curl https://v2.ocaml.org/releases/$VERSION/ocaml-$VERSION-refman-html.tar.gz | \ -tar xz --transform 's/htmlman/ocaml/' --directory docs/ -``` - ## OpenGL ```sh diff --git a/lib/docs/filters/ocaml/clean_html.rb b/lib/docs/filters/ocaml/clean_html.rb index 70bac845..83bb86a0 100644 --- a/lib/docs/filters/ocaml/clean_html.rb +++ b/lib/docs/filters/ocaml/clean_html.rb @@ -3,6 +3,8 @@ module Docs class CleanHtmlFilter < Filter def call + css('#sidebar').remove + css('pre').each do |node| span = node.at_css('span[id]') node['id'] = span['id'] if span diff --git a/lib/docs/scrapers/ocaml.rb b/lib/docs/scrapers/ocaml.rb index c26572ac..4718546f 100644 --- a/lib/docs/scrapers/ocaml.rb +++ b/lib/docs/scrapers/ocaml.rb @@ -1,5 +1,5 @@ module Docs - class Ocaml < FileScraper + class Ocaml < UrlScraper self.name = 'OCaml' self.type = 'ocaml' self.root_path = 'index.html' @@ -16,15 +16,20 @@ module Docs options[:skip_patterns] = [ /\Acompilerlibref\//, - /\Alibref\/type_/, - /\Alibref\/Stdlib\.\w+\.html/, + /\Aapi\/type_/, + /\Aapi\/Stdlib\.\w+\.html/, ] options[:attribution] = <<-HTML - © 1995-2022 INRIA. + © 1995-2024 INRIA. HTML version '' do + self.release = '5.2' + self.base_url = "https://ocaml.org/manual/#{self.release}/" + end + + version '5.0' do self.release = '5.0' self.base_url = "https://v2.ocaml.org/releases/#{self.release}/htmlman/" end