1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
From: Ralf Treinen <treinen@debian.org>
Date: Sat, 25 Dec 2021 17:36:04 +0100
Subject: removed vendored highlight js library.
Instead of using the content of the vendored js library, it uses
highlight.min.js from the libjs-highlight.js package
---
src/odoc/dune | 8 +++-----
src/odoc/support_files.ml | 15 +++++++++++++--
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/odoc/dune b/src/odoc/dune
index 5ca7d74..bd43529 100644
--- a/src/odoc/dune
+++ b/src/odoc/dune
@@ -23,14 +23,13 @@
(rule
(targets highlight_js.ml)
- (deps
- (:js ../vendor/highlight.pack.js))
+; (deps (:js ../vendor/highlight.pack.js))
(action
(with-stdout-to
%{targets}
(progn
(echo "let content = {js|")
- (cat %{js})
+; (cat %{js})
(echo "|js}")))))
; Install theme files for odig.
@@ -39,5 +38,4 @@
(package odoc)
(section share)
(files
- (etc/odoc.css as odoc-theme/default/odoc.css)
- (../vendor/highlight.pack.js as odoc-theme/default/highlight.pack.js)))
+ (etc/odoc.css as odoc-theme/default/odoc.css)))
diff --git a/src/odoc/support_files.ml b/src/odoc/support_files.ml
index 504e23a..4384973 100644
--- a/src/odoc/support_files.ml
+++ b/src/odoc/support_files.ml
@@ -6,8 +6,19 @@ let iter_files f ?(without_theme = false) output_directory =
f name content
in
- if not without_theme then file "odoc.css" Css_file.content;
- file "highlight.pack.js" Highlight_js.content
+ let highlight_js_content =
+ let ic = open_in "/usr/share/javascript/highlight.js/highlight.min.js" in
+ let n = in_channel_length ic in
+ let s = Bytes.create n in
+ really_input ic s 0 n;
+ close_in ic;
+ (Bytes.unsafe_to_string s)
+ in
+
+ if not without_theme then begin
+ file "odoc.css" Css_file.content
+ end;
+ file "highlight.pack.js" highlight_js_content
let write =
iter_files (fun name content ->
|