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
157bsdtar --extract --file=- --directory=docs/numpy~$VERSION/157bsdtar --extract --file=- --directory=docs/numpy~$VERSION/
158```158```
159 159
160## OCaml
161
162Download from https://www.ocaml.org/docs/ the HTML reference:
163https://v2.ocaml.org/releases/4.14/ocaml-4.14-refman-html.tar.gz
164and extract it as `docs/ocaml`:
165
166```sh
167curl https://v2.ocaml.org/releases/$VERSION/ocaml-$VERSION-refman-html.tar.gz | \
168tar xz --transform 's/htmlman/ocaml/' --directory docs/
169```
170
171## OpenGL160## OpenGL
172 161
173```sh162```sh
lib/docs/filters/ocaml/clean_html.rb+2−0
@@ -3,6 +3,8 @@ module Docs · 2 unmodified lines
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 5
6 css('#sidebar').remove
7
6 css('pre').each do |node|8 css('pre').each do |node|
7 span = node.at_css('span[id]')9 span = node.at_css('span[id]')
8 node['id'] = span['id'] if span10 node['id'] = span['id'] if span
lib/docs/scrapers/ocaml.rb+9−4
@@ -1,5 +1,5 @@
1module Docs1module Docs
2 class Ocaml < FileScraper2 class Ocaml < UrlScraper
3 self.name = 'OCaml'3 self.name = 'OCaml'
4 self.type = 'ocaml'4 self.type = 'ocaml'
5 self.root_path = 'index.html'5 self.root_path = 'index.html'
@@ -16,15 +16,20 @@ module Docs · 10 unmodified lines
16 16
17 options[:skip_patterns] = [17 options[:skip_patterns] = [
18 /\Acompilerlibref\//,18 /\Acompilerlibref\//,
19 /\Alibref\/type_/,19 /\Aapi\/type_/,
20 /\Alibref\/Stdlib\.\w+\.html/,20 /\Aapi\/Stdlib\.\w+\.html/,
21 ]21 ]
22 22
23 options[:attribution] = <<-HTML23 options[:attribution] = <<-HTML
24 &copy; 1995-2022 INRIA.24 &copy; 1995-2024 INRIA.
25 HTML25 HTML
26 26
27 version '' do27 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
28 self.release = '5.0'33 self.release = '5.0'
29 self.base_url = "https://v2.ocaml.org/releases/#{self.release}/htmlman/"34 self.base_url = "https://v2.ocaml.org/releases/#{self.release}/htmlman/"
30 end35 end