Codebase list ocaml-odoc / a002818
Merge branch 'jshighlight' Ralf Treinen 3 years ago
1 changed file(s) with 32 addition(s) and 55 deletion(s). Raw diff Collapse all Expand all
00 Author: Ralf Treinen <treinen@debian.org>
11 Description: removed vendored highlight js library.
2 The file odoc/support_files.ml is patched so that, instead of
3 creating a copy of the support files, creates symbolic links.
2 Instead of using the content of the vendored js library, it uses
3 highlight.min.js from the libjs-highlight.js package
44
5 Index: ocaml-odoc/src/odoc/dune
6 ===================================================================
7 --- ocaml-odoc.orig/src/odoc/dune 2020-04-23 19:36:22.436878628 +0200
8 +++ ocaml-odoc/src/odoc/dune 2020-04-23 19:36:22.436878628 +0200
9 @@ -14,29 +14,8 @@
5 --- a/src/odoc/dune
6 +++ b/src/odoc/dune
7 @@ -26,17 +26,16 @@
108
11 (documentation)
9 (rule
10 (targets highlight_js.ml)
11 - (deps (:js ../vendor/highlight.pack.js))
12 +; (deps (:js ../vendor/highlight.pack.js))
13 (action
14 (with-stdout-to %{targets}
15 (progn
16 (echo "let content = {js|")
17 - (cat %{js})
18 +; (cat %{js})
19 (echo "|js}")))))
1220
13 -(rule
14 - (targets css_file.ml)
15 - (deps (:css etc/odoc.css))
16 - (action
17 - (with-stdout-to %{targets}
18 - (progn
19 - (echo "let content = {css|")
20 - (cat %{css})
21 - (echo "|css}")))))
22 -
23 -(rule
24 - (targets highlight_js.ml)
25 - (deps (:js ../vendor/highlight.pack.js))
26 - (action
27 - (with-stdout-to %{targets}
28 - (progn
29 - (echo "let content = {js|")
30 - (cat %{js})
31 - (echo "|js}")))))
32 -
3321 ; Install theme files for odig.
3422 (install
3523 (section share)
3725 - (etc/odoc.css as odoc-theme/default/odoc.css)
3826 - (../vendor/highlight.pack.js as odoc-theme/default/highlight.pack.js)))
3927 + (etc/odoc.css as odoc-theme/default/odoc.css)))
40 Index: ocaml-odoc/src/odoc/support_files.ml
41 ===================================================================
42 --- ocaml-odoc.orig/src/odoc/support_files.ml 2020-04-23 19:36:22.436878628 +0200
43 +++ ocaml-odoc/src/odoc/support_files.ml 2020-04-23 19:38:38.729590833 +0200
44 @@ -1,23 +1,19 @@
45 let iter_files f ?(without_theme = false) output_directory =
46 - let file name content =
47 + let file name target =
48 let name =
49 Fs.File.create ~directory:output_directory ~name
50 |> Fs.File.to_string
51 in
52 - f name content
53 + f name target
28 --- a/src/odoc/support_files.ml
29 +++ b/src/odoc/support_files.ml
30 @@ -7,10 +7,19 @@ let iter_files f ?(without_theme = false
31 f name content
5432 in
5533
34 + let highlight_js_content =
35 + let ic = open_in "/usr/share/javascript/highlight.js/highlight.min.js" in
36 + let n = in_channel_length ic in
37 + let s = Bytes.create n in
38 + really_input ic s 0 n;
39 + close_in ic;
40 + (Bytes.unsafe_to_string s)
41 + in
42 +
5643 if not without_theme then begin
57 - file "odoc.css" Css_file.content
58 + file "odoc.css" "/usr/share/odoc/odoc-theme/default/odoc.css"
44 file "odoc.css" Css_file.content
5945 end;
6046 - file "highlight.pack.js" Highlight_js.content
61 + file "highlight.pack.js" "/usr/share/javascript/highlight.js/highlight.min.js"
47 + file "highlight.pack.js" highlight_js_content
6248
6349 let write =
64 - iter_files begin fun name content ->
65 - let channel = open_out name in
66 - output_string channel content;
67 - close_out channel
68 - end
69 + iter_files (fun name target -> Unix.symlink target name)
70
71 let print_filenames =
72 - iter_files (fun name _content -> print_endline name)
73 + iter_files (fun name _target -> print_endline name)
50 iter_files begin fun name content ->