History

Update OCaml documentation (5.2)

Simon Legner committed 1 year ago

Commit 2b8d9b61 parent 6ccf04a3 files · +11 −15Browse files

Unified · Split

3 files
  1. docs/file-scrapers.md +0 −11
  2. lib/docs/filters/ocaml/clean_html.rb +2 −0
  3. lib/docs/scrapers/ocaml.rb +9 −4
docs/file-scrapers.md+0−11
@@ -157,17 +157,6 @@ curl https://numpy.org/doc/$VERSION/numpy-html.zip | \ · 156 unmodified lines
157157 bsdtar --extract --file=- --directory=docs/numpy~$VERSION/
158158 ```
159159
160−## OCaml
161−
162−Download from https://www.ocaml.org/docs/ the HTML reference:
163−https://v2.ocaml.org/releases/4.14/ocaml-4.14-refman-html.tar.gz
164−and extract it as `docs/ocaml`:
165−
166−```sh
167−curl https://v2.ocaml.org/releases/$VERSION/ocaml-$VERSION-refman-html.tar.gz | \
168−tar xz --transform 's/htmlman/ocaml/' --directory docs/
169−```
170−
171160 ## OpenGL
172161
173162 ```sh
lib/docs/filters/ocaml/clean_html.rb+2−0
@@ -3,6 +3,8 @@ module Docs · 2 unmodified lines
33 class CleanHtmlFilter < Filter
44 def call
55
6+ css('#sidebar').remove
7+
68 css('pre').each do |node|
79 span = node.at_css('span[id]')
810 node['id'] = span['id'] if span
lib/docs/scrapers/ocaml.rb+9−4
@@ -1,5 +1,5 @@
11 module Docs
2− class Ocaml < FileScraper
2+ class Ocaml < UrlScraper
33 self.name = 'OCaml'
44 self.type = 'ocaml'
55 self.root_path = 'index.html'
@@ -16,15 +16,20 @@ module Docs · 10 unmodified lines
1616
1717 options[:skip_patterns] = [
1818 /\Acompilerlibref\//,
19− /\Alibref\/type_/,
20− /\Alibref\/Stdlib\.\w+\.html/,
19+ /\Aapi\/type_/,
20+ /\Aapi\/Stdlib\.\w+\.html/,
2121 ]
2222
2323 options[:attribution] = <<-HTML
24− &copy; 1995-2022 INRIA.
24+ &copy; 1995-2024 INRIA.
2525 HTML
2626
2727 version '' do
28+ self.release = '5.2'
29+ self.base_url = "https://ocaml.org/manual/#{self.release}/"
30+ end
31+
32+ version '5.0' do
2833 self.release = '5.0'
2934 self.base_url = "https://v2.ocaml.org/releases/#{self.release}/htmlman/"
3035 end