summaryrefslogtreecommitdiff
path: root/converters
diff options
context:
space:
mode:
authormarkd <markd@pkgsrc.org>2019-12-31 19:46:12 +0000
committermarkd <markd@pkgsrc.org>2019-12-31 19:46:12 +0000
commit07a5e81bfd4a483cc874e0fcc2666e133be014aa (patch)
treee012feba03b793b43104b79bde87d2f1015ddd4d /converters
parent0fc2e774d7e55ad08d90fe6c75164874a0dde40f (diff)
downloadpkgsrc-07a5e81bfd4a483cc874e0fcc2666e133be014aa.tar.gz
bibtex2html: build with current ocaml
Diffstat (limited to 'converters')
-rw-r--r--converters/bibtex2html/Makefile4
-rw-r--r--converters/bibtex2html/distinfo19
-rw-r--r--converters/bibtex2html/patches/patch-bbl_lexer.mll44
-rw-r--r--converters/bibtex2html/patches/patch-bib2bib.ml286
-rw-r--r--converters/bibtex2html/patches/patch-bibfilter.ml68
-rw-r--r--converters/bibtex2html/patches/patch-biboutput.ml52
-rw-r--r--converters/bibtex2html/patches/patch-bibtex.ml240
-rw-r--r--converters/bibtex2html/patches/patch-bibtex__lexer.mll102
-rw-r--r--converters/bibtex2html/patches/patch-bibtex_parser.mly78
-rw-r--r--converters/bibtex2html/patches/patch-condition.ml70
-rw-r--r--converters/bibtex2html/patches/patch-condition_parser.mly60
-rw-r--r--converters/bibtex2html/patches/patch-expand.ml16
-rw-r--r--converters/bibtex2html/patches/patch-latexmacros.ml16
-rw-r--r--converters/bibtex2html/patches/patch-main.ml16
-rw-r--r--converters/bibtex2html/patches/patch-readbib.ml33
-rw-r--r--converters/bibtex2html/patches/patch-translate.ml91
16 files changed, 1155 insertions, 40 deletions
diff --git a/converters/bibtex2html/Makefile b/converters/bibtex2html/Makefile
index 4c7c8b6493f..2d8eb733161 100644
--- a/converters/bibtex2html/Makefile
+++ b/converters/bibtex2html/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.53 2019/08/11 13:18:09 wiz Exp $
+# $NetBSD: Makefile,v 1.54 2019/12/31 19:46:12 markd Exp $
DISTNAME= bibtex2html-1.98
PKGREVISION= 14
@@ -33,6 +33,8 @@ SUBST_SED.paths= -e 's,/usr/share,${PREFIX}/share,g'
INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1
INSTALLATION_DIRS+= share/doc/${PKGBASE}
+MAKE_ENV+= ZLIB=-unsafe-string
+
.include "../../lang/ocaml/buildlink3.mk"
post-build:
diff --git a/converters/bibtex2html/distinfo b/converters/bibtex2html/distinfo
index 0ea47f95edc..1cbbd8256d2 100644
--- a/converters/bibtex2html/distinfo
+++ b/converters/bibtex2html/distinfo
@@ -1,9 +1,20 @@
-$NetBSD: distinfo,v 1.17 2018/03/14 08:28:44 dholland Exp $
+$NetBSD: distinfo,v 1.18 2019/12/31 19:46:12 markd Exp $
SHA1 (bibtex2html-1.98.tar.gz) = daaa082885a30dae38263614565298d4862b8331
RMD160 (bibtex2html-1.98.tar.gz) = f47dda14108c3f53bca64352bfb7455f1b79d964
SHA512 (bibtex2html-1.98.tar.gz) = 7d8480ed87bef74a1e0c970446fba4d30b103df3e78f127a051efff875032ac7f52d3d6baab0c6a2fc67ca11f3d558d7be4439311934f99067993b5891ff6ad4
Size (bibtex2html-1.98.tar.gz) = 92719 bytes
-SHA1 (patch-biboutput.ml) = 42d07071fd85fd1be47e522a4f957b53693d5b0d
-SHA1 (patch-bibtex__lexer.mll) = 207d8442dc87465cfed478d2d97445ba3bd90d9f
-SHA1 (patch-condition.ml) = f00078a8a16a6c47416e08b378d51db782f8e7f2
+SHA1 (patch-bbl_lexer.mll) = e63157f319825aad196f0628f04e1065e5f3cfa8
+SHA1 (patch-bib2bib.ml) = 37e8ac8e9f7453f304423dce25bd3b5481909aaf
+SHA1 (patch-bibfilter.ml) = 52f74806d12bd1d4838ac02ed1cce4a835f6cdc1
+SHA1 (patch-biboutput.ml) = 434f695c89aeeb4c6768d9d78502b5995aeb772c
+SHA1 (patch-bibtex.ml) = 4e68071f920d7d04b0fe8e40c3e5196d6a5742da
+SHA1 (patch-bibtex__lexer.mll) = 0e5ea0a0d0f3500a73635a9ddebad93175400027
+SHA1 (patch-bibtex_parser.mly) = dbd957eb6a47203baea103ef015583073128c1b7
+SHA1 (patch-condition.ml) = ff4cb8380df6f324554037ab4ae9d42d7fe28eb9
+SHA1 (patch-condition_parser.mly) = 7d44a5606c969fa1eb40ee1bc3f93ab8ae4e1c66
+SHA1 (patch-expand.ml) = d83740b76bbedb375519db2d2cd9d8458daa5ba8
+SHA1 (patch-latexmacros.ml) = a3beb18495de348246e7a8039838bab3d7c766e7
+SHA1 (patch-main.ml) = 3afed48b57d5858962f4b4bc5be15190014db41c
+SHA1 (patch-readbib.ml) = 888fbca4bad5c0597af1315b834574072ca005fb
+SHA1 (patch-translate.ml) = 222d3a9a1208e54fd54c1bc52ed784c59bf2a531
diff --git a/converters/bibtex2html/patches/patch-bbl_lexer.mll b/converters/bibtex2html/patches/patch-bbl_lexer.mll
new file mode 100644
index 00000000000..09342c872a0
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-bbl_lexer.mll
@@ -0,0 +1,44 @@
+$NetBSD: patch-bbl_lexer.mll,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- bbl_lexer.mll.orig 2014-07-04 07:51:21.000000000 +0000
++++ bbl_lexer.mll
+@@ -39,7 +39,7 @@ rule biblio_header = parse
+ { biblio_name lexbuf }
+ | eof
+ { raise End_of_file }
+- | _
++ | _
+ { biblio_header lexbuf }
+
+ and biblio_name = parse
+@@ -48,15 +48,15 @@ and biblio_name = parse
+ let s = String.sub l 1 (String.length l - 2) in
+ Some s }
+ | _
+- { None }
++ { None }
+
+ and bibitem = parse
+ | "\\end{thebibliography}"
+ { raise End_of_biblio }
+ | '\\' ['a'-'z']* "bibitem"
+ { brace_depth := 0;
+- begin try bibitem1 lexbuf
+- with Failure "lexing: empty token" -> opt_ref := None end;
++ begin try bibitem1 lexbuf
++ with Failure _ -> opt_ref := None end;
+ bibitem2 lexbuf }
+ | _ { bibitem lexbuf }
+
+@@ -70,7 +70,7 @@ and bibitem1_body = parse
+ | eof { raise End_of_file }
+
+ and bibitem2 = parse
+- | '{' { Buffer.reset buf;
++ | '{' { Buffer.reset buf;
+ key := bibitem2_body lexbuf;
+ skip_end_of_line lexbuf;
+ Buffer.reset buf;
diff --git a/converters/bibtex2html/patches/patch-bib2bib.ml b/converters/bibtex2html/patches/patch-bib2bib.ml
new file mode 100644
index 00000000000..b8e31dbeff4
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-bib2bib.ml
@@ -0,0 +1,286 @@
+$NetBSD: patch-bib2bib.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- bib2bib.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ bib2bib.ml
+@@ -33,10 +33,10 @@ let get_input_file_name f =
+
+ let condition = ref Condition.True
+
+-let add_condition c =
++let add_condition c =
+ try
+ let c = Parse_condition.condition c in
+- condition := if !condition = Condition.True then c
++ condition := if !condition = Condition.True then c
+ else Condition.And(!condition,c)
+ with
+ Condition_lexer.Lex_error msg ->
+@@ -77,92 +77,92 @@ let args_spec =
+ ("-d", Arg.Set Options.debug, "debug flag");
+ ("-q", Arg.Set Options.quiet, "quiet flag");
+ ("--quiet", Arg.Set Options.quiet, "quiet flag");
+- ("-s", Arg.String
+- (fun s -> sort_criteria := (String.lowercase s):: !sort_criteria),
++ ("-s", Arg.String
++ (fun s -> sort_criteria := (String.lowercase_ascii s):: !sort_criteria),
+ "<c> sort with respect to keys (if c=$key) or a given field <c>");
+ ("-r", Arg.Set reverse_sort,
+ "reverse the sort order");
+- ("--no-comment", Arg.Unit (fun () -> no_comment := true),
++ ("--no-comment", Arg.Unit (fun () -> no_comment := true),
+ "do not add extra comments at beginning");
+- ("--remove", Arg.String
+- (fun s -> remove_fields := (String.lowercase s):: !remove_fields),
++ ("--remove", Arg.String
++ (fun s -> remove_fields := (String.lowercase_ascii s):: !remove_fields),
+ "<f> removes the field <f>");
+- ("--rename",
+- Arg.Tuple
++ ("--rename",
++ Arg.Tuple
+ [ Arg.Set_string rename_field ;
+- Arg.String (fun s -> rename_fields :=
+- (String.lowercase !rename_field,
+- String.lowercase s):: !rename_fields)],
++ Arg.String (fun s -> rename_fields :=
++ (String.lowercase_ascii !rename_field,
++ String.lowercase_ascii s):: !rename_fields)],
+ "<f1> <f2> rename field <f1> into <f2>");
+- ("--expand", Arg.Unit (fun () -> expand_abbrevs := true),
++ ("--expand", Arg.Unit (fun () -> expand_abbrevs := true),
+ "expand the abbreviations");
+- ("--expand-xrefs", Arg.Unit (fun () -> expand_xrefs := true),
++ ("--expand-xrefs", Arg.Unit (fun () -> expand_xrefs := true),
+ "expand the cross-references");
+- ("--version", Arg.Unit (fun () -> Copying.banner "bib2bib"; exit 0),
++ ("--version", Arg.Unit (fun () -> Copying.banner "bib2bib"; exit 0),
+ "print version and exit");
+- ("--warranty",
++ ("--warranty",
+ Arg.Unit (fun () -> Copying.banner "bib2bib"; Copying.copying(); exit 0),
+ "display software warranty")
+ ]
+
+-let output_cite_file keys =
++let output_cite_file keys =
+ if !cite_output_file_name = "" then
+- prerr_endline "No citation file output (no file name specified)"
+- else
++ prerr_endline "No citation file output (no file name specified)"
++ else
+ try
+ let ch = open_out !cite_output_file_name in
+ KeySet.iter (fun k -> output_string ch (k ^ "\n")) keys;
+ close_out ch
+- with
++ with
+ Sys_error msg ->
+ prerr_endline ("Cannot write output citations file (" ^ msg ^ ")");
+ exit 1
+
+
+
+-let output_bib_file remove rename biblio keys =
+- try
+- let ch =
+- if !bib_output_file_name = ""
+- then stdout
+- else open_out !bib_output_file_name
+- in
+- let cmd =
+- List.fold_right
+- (fun s t ->
+- if String.contains s ' '
+- then
+- if String.contains s '\''
+- then " \"" ^ s ^ "\"" ^ t
+- else " '" ^ s ^ "'" ^ t
+- else " " ^ s ^ t)
+- (Array.to_list Sys.argv)
+- ""
+- in
++let output_bib_file remove rename biblio keys =
++ try
++ let ch =
++ if !bib_output_file_name = ""
++ then stdout
++ else open_out !bib_output_file_name
++ in
++ let cmd =
++ List.fold_right
++ (fun s t ->
++ if String.contains s ' '
++ then
++ if String.contains s '\''
++ then " \"" ^ s ^ "\"" ^ t
++ else " '" ^ s ^ "'" ^ t
++ else " " ^ s ^ t)
++ (Array.to_list Sys.argv)
++ ""
++ in
+ let comments =
+ if !no_comment then empty_biblio else
+ add_new_entry
+ (Comment ("Command line:" ^ cmd))
+- (add_new_entry
+- (Comment
++ (add_new_entry
++ (Comment
+ ("This file has been generated by bib2bib "
+ ^ Version.version))
+ empty_biblio)
+ in
+ let biblio = merge_biblios comments biblio in
+- Biboutput.output_bib ~remove ~rename ~html:false ch biblio keys;
++ Biboutput.output_bib ~remove ~rename ~html:false ch biblio keys;
+ if !bib_output_file_name <> "" then close_out ch
+- with Sys_error msg ->
+- prerr_endline ("Cannot write output bib file (" ^ msg ^ ")");
+- exit 1
++ with Sys_error msg ->
++ prerr_endline ("Cannot write output bib file (" ^ msg ^ ")");
++ exit 1
+
+
+-let output_php_file remove rename biblio keys =
++let output_php_file remove rename biblio keys =
+ if !php_output_file_name <> "" then
+ try
+ let ch = open_out !php_output_file_name in
+ output_string ch "<?php
+-$parsed_bibfile =
++$parsed_bibfile =
+ Array
+ (
+ ";
+@@ -175,13 +175,13 @@ Array
+ with Biboutput.Bad_input_for_php msg ->
+ eprintf "error while producing PHP output: %s\n" msg;
+ exit 2
+-
++
+
+ let rec make_compare_fun db criteria c1 c2 =
+ match criteria with
+- | [] -> 0
++ | [] -> 0
+ | field :: rem ->
+- let comp =
++ let comp =
+ match field with
+ | "$key" ->
+ begin
+@@ -198,12 +198,12 @@ let rec make_compare_fun db criteria c1
+ compare s1 s2
+ | _ -> 0
+ end
+- | "$date" ->
++ | "$date" ->
+ begin
+ match (c1,c2) with
+ | (Entry(s1,t1,l1),Entry(s2,t2,l2)) ->
+- Expand.date_compare db
+- (s1,t1,Expand.expand_fields l1)
++ Expand.date_compare db
++ (s1,t1,Expand.expand_fields l1)
+ (s2,t2,Expand.expand_fields l2)
+ | _ -> 0
+ end
+@@ -211,8 +211,8 @@ let rec make_compare_fun db criteria c1
+ begin
+ match (c1,c2) with
+ | (Entry(_,_,l1),Entry(_,_,l2)) ->
+- let s1 =
+- try
++ let s1 =
++ try
+ match List.assoc field l1 with
+ | [Bibtex.String(s)] -> s
+ | [Bibtex.Id(s)] -> s
+@@ -220,7 +220,7 @@ let rec make_compare_fun db criteria c1
+ with
+ Not_found -> ""
+ and s2 =
+- try
++ try
+ match List.assoc field l2 with
+ | [Bibtex.String(s)] -> s
+ | [Bibtex.Id(s)] -> s
+@@ -234,10 +234,10 @@ let rec make_compare_fun db criteria c1
+ in
+ if comp = 0
+ then make_compare_fun db rem c1 c2
+- else
++ else
+ if !reverse_sort then -comp else comp
+ ;;
+-
++
+
+ let usage = "Usage: bib2bib [options] <input file names>\nOptions are:"
+
+@@ -252,40 +252,40 @@ let main () =
+ done;
+ end;
+ if !input_file_names = [] then input_file_names := [""];
+- if !Options.debug then begin
++ if !Options.debug then begin
+ Condition.print !condition; printf "\n"
+ end;
+ let all_entries =
+ List.fold_right
+- (fun file accu ->
++ (fun file accu ->
+ merge_biblios accu (Readbib.read_entries_from_file file))
+ !input_file_names
+ empty_biblio
+- in
++ in
+ let abbrv_expanded = Bibtex.expand_abbrevs all_entries in
+ let xref_expanded = Bibtex.expand_crossrefs abbrv_expanded in
+ let matching_keys =
+ Bibfilter.filter xref_expanded
+- (fun e k f -> Condition.evaluate_cond e k f !condition)
++ (fun e k f -> Condition.evaluate_cond e k f !condition)
+ in
+ if KeySet.cardinal matching_keys = 0 then
+ begin
+ eprintf "Warning: no matching reference found.\n";
+ if !Options.warn_error then exit 2;
+ end;
+-
+- let user_expanded =
+- if !expand_abbrevs then
+- if !expand_xrefs then xref_expanded else abbrv_expanded
+- else
+- if !expand_xrefs then Bibtex.expand_crossrefs all_entries
++
++ let user_expanded =
++ if !expand_abbrevs then
++ if !expand_xrefs then xref_expanded else abbrv_expanded
++ else
++ if !expand_xrefs then Bibtex.expand_crossrefs all_entries
+ else all_entries
+ in
+ let needed_keys = Bibfilter.saturate user_expanded matching_keys in
+ (* this should be to right place to sort the output bibliography *)
+ let final_bib =
+ if !sort_criteria = [] then user_expanded
+- else
++ else
+ let comp = make_compare_fun (Expand.expand user_expanded) (List.rev !sort_criteria) in
+ eprintf "Sorting...";
+ let b = Bibtex.sort comp user_expanded in
+@@ -297,8 +297,5 @@ let main () =
+ output_php_file !remove_fields !rename_fields final_bib (Some needed_keys)
+
+
+-let _ =
++let _ =
+ Printexc.catch main ()
+-
+-
+-
diff --git a/converters/bibtex2html/patches/patch-bibfilter.ml b/converters/bibtex2html/patches/patch-bibfilter.ml
new file mode 100644
index 00000000000..a3d9c989cd6
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-bibfilter.ml
@@ -0,0 +1,68 @@
+$NetBSD: patch-bibfilter.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- bibfilter.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ bibfilter.ml
+@@ -28,7 +28,7 @@ let filter biblio criterion =
+ Bibtex.fold
+ (fun entry keys ->
+ match entry with
+- Entry(entry_type,key,fields)
++ Entry(entry_type,key,fields)
+ when criterion entry_type key fields ->
+ KeySet.add key keys
+ | _ -> keys)
+@@ -41,9 +41,9 @@ let filter biblio criterion =
+
+ let rec needed_keys_for_field biblio field value keys abbrevs =
+ if field = "crossref"
+- then
++ then
+ match value with
+- [String(s)] ->
++ [String(s)] ->
+ if not (KeySet.mem s keys) then
+ begin
+ try
+@@ -60,7 +60,7 @@ let rec needed_keys_for_field biblio fie
+ (keys,abbrevs)
+ end
+ else (keys,abbrevs)
+- | _ ->
++ | _ ->
+ if not !Options.quiet then
+ eprintf "Warning: cross-references must be constant strings\n";
+ if !Options.warn_error then exit 2;
+@@ -69,9 +69,9 @@ let rec needed_keys_for_field biblio fie
+ List.fold_right
+ (fun a (keys,abbrevs) ->
+ match a with
+- Id(id) ->
+- let id = String.lowercase id in
+- if not (KeySet.mem id abbrevs)
++ Id(id) ->
++ let id = String.lowercase_ascii id in
++ if not (KeySet.mem id abbrevs)
+ then
+ try
+ let e = find_abbrev id biblio in
+@@ -81,7 +81,7 @@ let rec needed_keys_for_field biblio fie
+ needed_keys_for_entry biblio keys (KeySet.add id abbrevs) e
+ with Not_found ->
+ if abbrev_is_implicit id then (keys,abbrevs)
+- else
++ else
+ begin
+ if not !Options.quiet then
+ eprintf "Warning: string \"%s\" not found.\n" id;
+@@ -101,7 +101,7 @@ and needed_keys_for_entry biblio keys ab
+ needed_keys_for_field biblio field value keys abbrevs)
+ fields
+ (keys,abbrevs)
+- | Abbrev(field,value) ->
++ | Abbrev(field,value) ->
+ needed_keys_for_field biblio field value keys abbrevs
+ | _ -> (keys,abbrevs)
+
diff --git a/converters/bibtex2html/patches/patch-biboutput.ml b/converters/bibtex2html/patches/patch-biboutput.ml
index c628946397c..8b182c62245 100644
--- a/converters/bibtex2html/patches/patch-biboutput.ml
+++ b/converters/bibtex2html/patches/patch-biboutput.ml
@@ -1,9 +1,9 @@
-$NetBSD: patch-biboutput.ml,v 1.1 2018/03/14 08:28:44 dholland Exp $
+$NetBSD: patch-biboutput.ml,v 1.2 2019/12/31 19:46:12 markd Exp $
-Fix build with ocaml 4.06.
-Silence deprecation warnings.
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
---- biboutput.ml~ 2014-07-04 07:51:21.000000000 +0000
+--- biboutput.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ biboutput.ml
@@ -32,7 +32,7 @@ let is_url s = Str.string_match url_re s
@@ -35,25 +35,39 @@ Silence deprecation warnings.
print_link_field ch l
else
print_atom_list html ch l
-@@ -162,17 +162,17 @@ let add_backslashes s =
- | _ -> 1)
+@@ -154,26 +154,16 @@ exception Bad_input_for_php of string
+
+ (* inspired from String.escaped *)
+ let add_backslashes s =
+- let n = ref 0 in
+- for i = 0 to String.length s - 1 do
+- n := !n +
+- (match String.unsafe_get s i with
+- | '\'' | '\\' -> 2
+- | _ -> 1)
++ let n = String.length s in
++ let b = Buffer.create (2 * n) in
++ for i = 0 to n - 1 do
++ let c = String.unsafe_get s i in
++ begin match c with
++ | '\'' | '\\' -> Buffer.add_char b '\\'
++ | _ -> () end;
++ Buffer.add_char b c
done;
- if !n = String.length s then s else begin
+- if !n = String.length s then s else begin
- let s' = String.create !n in
-+ let s' = Bytes.create !n in
- n := 0;
- for i = 0 to String.length s - 1 do
- let c = String.unsafe_get s i in
- begin match c with
+- n := 0;
+- for i = 0 to String.length s - 1 do
+- let c = String.unsafe_get s i in
+- begin match c with
- | ('\'' | '\\') -> String.unsafe_set s' !n '\\'; incr n
-+ | ('\'' | '\\') -> Bytes.unsafe_set s' !n '\\'; incr n
- | _ -> ()
- end;
+- | _ -> ()
+- end;
- String.unsafe_set s' !n c; incr n
-+ Bytes.unsafe_set s' !n c; incr n
- done;
+- done;
- s'
-+ Bytes.to_string s'
- end
+- end
++ Buffer.contents b
let php_print_atom ch = function
+ | Id s -> fprintf ch "\'%s\'" s
diff --git a/converters/bibtex2html/patches/patch-bibtex.ml b/converters/bibtex2html/patches/patch-bibtex.ml
new file mode 100644
index 00000000000..1a0b4126449
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-bibtex.ml
@@ -0,0 +1,240 @@
+$NetBSD: patch-bibtex.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- bibtex.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ bibtex.ml
+@@ -17,16 +17,16 @@
+ (*s Datatype for BibTeX bibliographies. *)
+
+ type entry_type = string
+-
++
+ type key = string
+
+ module KeySet = Set.Make(struct type t = key let compare = compare end)
+-
++
+ type atom =
+ | Id of string
+ | String of string
+
+-type command =
++type command =
+ | Comment of string
+ | Preamble of atom list
+ | Abbrev of string * atom list
+@@ -51,9 +51,9 @@ let find_entry key biblio =
+ match b with
+ | [] -> raise Not_found
+ | (Entry (_,s,_) as e) :: b ->
+- if String.lowercase s = key then e else find key b
++ if String.lowercase_ascii s = key then e else find key b
+ | _ :: b -> find key b
+- in find (String.lowercase key) biblio
++ in find (String.lowercase_ascii key) biblio
+
+ let add_new_entry command biblio = command :: biblio
+
+@@ -75,7 +75,7 @@ let add_entry command biblio =
+ try
+ let new_bib = remove_entry key biblio in
+ command :: new_bib
+- with Not_found ->
++ with Not_found ->
+ command :: biblio
+ end
+ | _ -> command::biblio
+@@ -96,16 +96,16 @@ let merge_biblios b1 b2 =
+ b1
+ KeySet.empty
+ in
+- let new_b1 =
++ let new_b1 =
+ fold
+ (fun entry accu -> match entry with
+- | Entry (_,key,_) ->
+- if KeySet.mem key b2keys then
++ | Entry (_,key,_) ->
++ if KeySet.mem key b2keys then
+ begin
+ Format.eprintf "Warning, key '%s' duplicated@." key;
+ if !Options.warn_error then exit 2;
+- accu
+- end
++ accu
++ end
+ else entry :: accu
+ | _ -> entry :: accu)
+ b1
+@@ -114,13 +114,13 @@ let merge_biblios b1 b2 =
+ let new_bib =
+ fold
+ (fun entry accu -> match entry with
+- | Abbrev (key,_) ->
+- if KeySet.mem key b1abbrevs then
++ | Abbrev (key,_) ->
++ if KeySet.mem key b1abbrevs then
+ begin
+ Format.eprintf "Warning, key '%s' duplicated@." key;
+ if !Options.warn_error then exit 2;
+- accu
+- end
++ accu
++ end
+ else entry :: accu
+ | _ -> entry :: accu)
+ b2
+@@ -137,7 +137,7 @@ let month_env =
+ let abbrev_is_implicit key =
+ try
+ let _ = int_of_string key in true
+- with Failure "int_of_string" ->
++ with Failure _ ->
+ try
+ let _ = List.assoc key month_env in true
+ with Not_found -> false
+@@ -153,12 +153,12 @@ i*)
+ let rec find_abbrev key biblio =
+ match biblio with
+ | [] -> raise Not_found
+- | (Abbrev (s,_) as e) :: b ->
++ | (Abbrev (s,_) as e) :: b ->
+ if s = key then e
+ else find_abbrev key b
+ | _ :: b -> find_abbrev key b
+
+-let concat_atom_lists a1 a2 =
++let concat_atom_lists a1 a2 =
+ match (a1,a2) with
+ | ([String s1], [String s2]) -> [String (s1 ^ s2)]
+ | _ -> a1 @ a2
+@@ -175,10 +175,10 @@ let rec expand_list = function
+ | [] -> []
+ | ((Id s) as a) :: rem ->
+ begin
+- try
++ try
+ let v = find_abbrev_in_table s in
+ concat_atom_lists v (expand_list rem)
+- with Not_found ->
++ with Not_found ->
+ concat_atom_lists [a] (expand_list rem)
+ end
+ | ((String _) as a) :: rem ->
+@@ -188,13 +188,13 @@ let rec expand_fields = function
+ | [] -> []
+ | (n,l) :: rem -> (n, expand_list l) :: (expand_fields rem)
+
+-let rec expand_abbrevs biblio =
+- fold
++let rec expand_abbrevs biblio =
++ fold
+ (fun command accu ->
+ match command with
+ | Abbrev (a,l) ->
+ let s = expand_list l in
+- add_abbrev a s;
++ add_abbrev a s;
+ accu
+ | Entry (t,k,f) ->
+ Entry (t,k,expand_fields f) :: accu
+@@ -205,30 +205,31 @@ let rec expand_abbrevs biblio =
+
+ let add_crossref_fields =
+ List.fold_left
+- (fun acc ((x,_) as d) ->
++ (fun acc ((x,_) as d) ->
+ if List.mem_assoc x acc then acc else d::acc)
+
+
+-let rec expand_crossrefs biblio =
++let rec expand_crossrefs biblio =
+ let crossref_table = Hashtbl.create 97 in
+- let add_crossref a l = Hashtbl.add crossref_table (String.lowercase a) l in
+- let find_crossref a = Hashtbl.find crossref_table (String.lowercase a) in
+- let replace_crossref a l =
+- Hashtbl.replace crossref_table (String.lowercase a) l
+- in
++ let add_crossref a l =
++ Hashtbl.add crossref_table (String.lowercase_ascii a) l in
++ let find_crossref a =
++ Hashtbl.find crossref_table (String.lowercase_ascii a) in
++ let replace_crossref a l =
++ Hashtbl.replace crossref_table (String.lowercase_ascii a) l in
+ (* first phase: record needed crossrefs in table *)
+- List.iter
++ List.iter
+ (fun command ->
+ match command with
+ | Entry (t,k,f) ->
+ begin
+ try
+ match List.assoc "crossref" f with
+- | [String(s)] ->
++ | [String(s)] ->
+ add_crossref s []
+- | _ ->
++ | _ ->
+ begin
+- Format.eprintf
++ Format.eprintf
+ "Warning: invalid cross-reference in entry '%s'.@." k;
+ if !Options.warn_error then exit 2;
+ end
+@@ -237,12 +238,12 @@ let rec expand_crossrefs biblio =
+ | _ -> ())
+ biblio;
+ (* second phase: record crossrefs data in table *)
+- List.iter
++ List.iter
+ (fun command ->
+ match command with
+ | Entry (t,k,f) ->
+ begin
+- try
++ try
+ let _ = find_crossref k in
+ if !Options.debug then
+ Format.eprintf "recording cross-reference '%s'.@." k;
+@@ -252,21 +253,21 @@ let rec expand_crossrefs biblio =
+ | _ -> ())
+ biblio;
+ (* third phase: expand crossrefs *)
+- fold
++ fold
+ (fun command accu ->
+ match command with
+ | Entry (t,k,f) ->
+ begin
+ try
+ match List.assoc "crossref" f with
+- | [String(s)] ->
++ | [String(s)] ->
+ begin
+- try
++ try
+ let f = List.remove_assoc "crossref" f in
+ let f' = find_crossref s in
+ if f' = [] then
+ begin
+- Format.eprintf
++ Format.eprintf
+ "Warning: cross-reference '%s' not found.@." s;
+ if !Options.warn_error then exit 2;
+ end;
+@@ -284,7 +285,7 @@ let rec expand_crossrefs biblio =
+
+
+
+-let sort comp bib =
++let sort comp bib =
+ let comments,preambles,abbrevs,entries =
+ List.fold_left
+ (fun (c,p,a,e) command ->
+@@ -307,4 +308,3 @@ let sort comp bib =
+
+
+ let current_key = ref ""
+-
diff --git a/converters/bibtex2html/patches/patch-bibtex__lexer.mll b/converters/bibtex2html/patches/patch-bibtex__lexer.mll
index c90ef8e2ae4..23ec790404f 100644
--- a/converters/bibtex2html/patches/patch-bibtex__lexer.mll
+++ b/converters/bibtex2html/patches/patch-bibtex__lexer.mll
@@ -1,15 +1,99 @@
-$NetBSD: patch-bibtex__lexer.mll,v 1.1 2018/03/14 08:28:44 dholland Exp $
+$NetBSD: patch-bibtex__lexer.mll,v 1.2 2019/12/31 19:46:12 markd Exp $
-Silence deprecation warning.
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
---- bibtex_lexer.mll~ 2014-07-04 07:51:21.000000000 +0000
+--- bibtex_lexer.mll.orig 2014-07-04 07:51:21.000000000 +0000
+++ bibtex_lexer.mll
-@@ -60,7 +60,7 @@ rule token = parse
+@@ -23,7 +23,7 @@
+ open Lexing
+ open Bibtex_parser
+
+-let serious = ref false (* if we are inside a command or not *)
++let serious = ref false (* if we are inside a command or not *)
+
+ let brace_depth = ref 0
+
+@@ -31,12 +31,12 @@ let brace_depth = ref 0
+
+ let buffer = Buffer.create 8192
+
+-let reset_string_buffer () =
++let reset_string_buffer () =
+ Buffer.reset buffer
+
+-let store_string_char c =
++let store_string_char c =
+ Buffer.add_char buffer c
+-
++
+ let get_stored_string () =
+ let s = Buffer.contents buffer in
+ Buffer.reset buffer;
+@@ -55,23 +55,23 @@ let space = [' ' '\t' '\r' '\n']
+ rule token = parse
+ | space +
+ { token lexbuf }
+- | '@' space*
+- ([^ ' ' '\t' '\n' '\r' '{' '(']+ as entry_type) space*
++ | '@' space*
++ ([^ ' ' '\t' '\n' '\r' '{' '(']+ as entry_type) space*
(('{' | '(') as delim) space*
- { serious := true;
- start_delim := delim;
+- { serious := true;
+- start_delim := delim;
- match String.lowercase entry_type with
-+ match String.lowercase_ascii entry_type with
- | "string" ->
+- | "string" ->
++ { serious := true;
++ start_delim := delim;
++ match String.lowercase_ascii entry_type with
++ | "string" ->
Tabbrev
- | "comment" ->
+- | "comment" ->
++ | "comment" ->
+ reset_string_buffer ();
+ comment lexbuf;
+ serious := false;
+ Tcomment (get_stored_string ())
+- | "preamble" ->
++ | "preamble" ->
+ Tpreamble
+- | et ->
+- Tentry (entry_type, key lexbuf)
++ | et ->
++ Tentry (entry_type, key lexbuf)
+ }
+ | '=' { if !serious then Tequal else token lexbuf }
+ | '#' { if !serious then Tsharp else token lexbuf }
+@@ -110,7 +110,7 @@ and string = parse
+ brace lexbuf;
+ store_string_char '}';
+ string lexbuf
+- }
++ }
+ | '"'
+ { () }
+ | "\\\""
+@@ -141,10 +141,10 @@ and brace = parse
+ brace lexbuf }
+
+ and key = parse
+- | [^ ' ' '\t' '\n' '\r' ',']+
++ | [^ ' ' '\t' '\n' '\r' ',']+
+ { lexeme lexbuf }
+- | eof
+- | _
++ | eof
++ | _
+ { raise Parsing.Parse_error }
+
+ and comment = parse
+@@ -153,7 +153,7 @@ and comment = parse
+ | [^ '}' '@'] as c
+ { store_string_char c;
+ comment lexbuf }
+- | eof
++ | eof
+ { () }
+- | _
++ | _
+ { () }
diff --git a/converters/bibtex2html/patches/patch-bibtex_parser.mly b/converters/bibtex2html/patches/patch-bibtex_parser.mly
new file mode 100644
index 00000000000..b289ed0fece
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-bibtex_parser.mly
@@ -0,0 +1,78 @@
+$NetBSD: patch-bibtex_parser.mly,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- bibtex_parser.mly.orig 2014-07-04 07:51:21.000000000 +0000
++++ bibtex_parser.mly
+@@ -17,15 +17,15 @@
+ /*
+ * bibtex2html - A BibTeX to HTML translator
+ * Copyright (C) 1997 Jean-Christophe FILLIATRE
+- *
++ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation.
+- *
++ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+- *
++ *
+ * See the GNU General Public License version 2 for more details
+ * (enclosed in the file GPL).
+ */
+@@ -40,7 +40,7 @@
+
+ %}
+
+-%token <string> Tident Tstring Tcomment
++%token <string> Tident Tstring Tcomment
+ %token <string * string> Tentry
+ %token Tabbrev Tpreamble Tlbrace Trbrace Tcomma Tequal EOF Tsharp
+
+@@ -67,19 +67,19 @@ command:
+ | Tpreamble sharp_string_list Trbrace
+ { Preamble $2 }
+ | Tabbrev Tident Tequal sharp_string_list Trbrace
+- { Abbrev (String.lowercase $2,$4) }
++ { Abbrev (String.lowercase_ascii $2,$4) }
+ | entry Tcomma comma_field_list Trbrace
+- { let et,key = $1 in Entry (String.lowercase et, key, $3) }
++ { let et,key = $1 in Entry (String.lowercase_ascii et, key, $3) }
+ ;
+
+-entry:
+- | Tentry
++entry:
++ | Tentry
+ { let et,key = $1 in Bibtex.current_key := key; (et,key) }
+
+ comma_field_list:
+ field Tcomma comma_field_list
+ { $1::$3 }
+- | field
++ | field
+ { [$1] }
+ | field Tcomma
+ { [$1] }
+@@ -91,7 +91,7 @@ field:
+ { ($1,[String ""]) }
+ ;
+ field_name:
+- Tident { String.lowercase $1 }
++ Tident { String.lowercase_ascii $1 }
+ | Tcomment { "comment" }
+ ;
+ sharp_string_list:
+@@ -102,7 +102,7 @@ sharp_string_list:
+ ;
+ atom:
+ Tident
+- { Id (String.lowercase $1) }
++ { Id (String.lowercase_ascii $1) }
+ | Tstring
+ { String $1 }
+ ;
diff --git a/converters/bibtex2html/patches/patch-condition.ml b/converters/bibtex2html/patches/patch-condition.ml
index 008e317fcd9..b74ce88a756 100644
--- a/converters/bibtex2html/patches/patch-condition.ml
+++ b/converters/bibtex2html/patches/patch-condition.ml
@@ -1,17 +1,73 @@
-$NetBSD: patch-condition.ml,v 1.1 2018/03/14 08:28:44 dholland Exp $
+$NetBSD: patch-condition.ml,v 1.2 2019/12/31 19:46:12 markd Exp $
-Silence deprecation warnings.
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
---- condition.ml~ 2014-07-04 07:51:21.000000000 +0000
+--- condition.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ condition.ml
-@@ -54,8 +54,8 @@ let evaluate_constante entrytype key fie
+@@ -22,10 +22,10 @@ type constante =
+ | Field of string
+ | Cte of string
+ ;;
+-
++
+ type condition =
+- | True
+- | False
++ | True
++ | False
+ | And of condition * condition
+ | Or of condition * condition
+ | Not of condition
+@@ -52,12 +52,12 @@ let evaluate_constante entrytype key fie
+ | Cte(x) -> Latex_accents.normalize false x
+ ;;
- let eval_comp v1 op v2 =
+-let eval_comp v1 op v2 =
++let eval_comp v1 op v2 =
match op with
- | "=" -> String.lowercase v1 = String.lowercase v2
- | "<>" -> String.lowercase v1 <> String.lowercase v2
+ | "=" -> String.lowercase_ascii v1 = String.lowercase_ascii v2
-+ | "<>" -> String.lowercase_ascii v1 <> String.lowercase_ascii v2
++ | "<>" -> String.lowercase_ascii v1 <> String.lowercase_ascii v2
| "==" -> v1 = v2
- | "!=" -> v1 <> v2
+- | "!=" -> v1 <> v2
++ | "!=" -> v1 <> v2
| _ ->
+ let n1 = int_of_string v1
+ and n2 = int_of_string v2 in
+@@ -84,12 +84,12 @@ let rec evaluate_rec entrytype key field
+ | Comp(c1,op,c2) ->
+ begin
+ try
+- let v1 = evaluate_constante entrytype key fields c1
++ let v1 = evaluate_constante entrytype key fields c1
+ and v2 = evaluate_constante entrytype key fields c2 in
+ try
+ eval_comp v1 op v2
+ with
+- Failure "int_of_string" ->
++ Failure _ ->
+ if not !Options.quiet then begin
+ eprintf "Warning: cannot compare non-numeric values ";
+ eprintf "%s and %s in entry %s\n" v1 v2 key
+@@ -126,7 +126,7 @@ let evaluate_cond entrytype key fields c
+ with
+ Not_found -> assert false
+ ;;
+-
++
+ let string_of_constante = function
+ Key -> "(key)"
+ | Entrytype -> "(entrytype)"
+@@ -140,9 +140,8 @@ let rec print = function
+ | And(c1,c2) -> printf "("; print c1; printf " and "; print c2; printf ")"
+ | Or(c1,c2) -> printf "("; print c1; printf " or "; print c2; printf ")"
+ | Not(c) -> printf "(not "; print c; printf ")"
+- | Comp(c1,op,c2) ->
++ | Comp(c1,op,c2) ->
+ printf "%s %s %s" (string_of_constante c1) op (string_of_constante c2)
+ | Match(c,s) -> printf "%s : (regexp)" (string_of_constante c)
+ | Exists(f) -> printf "exists %s" f
+ ;;
+-
diff --git a/converters/bibtex2html/patches/patch-condition_parser.mly b/converters/bibtex2html/patches/patch-condition_parser.mly
new file mode 100644
index 00000000000..9e2849ef6f0
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-condition_parser.mly
@@ -0,0 +1,60 @@
+$NetBSD: patch-condition_parser.mly,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- condition_parser.mly.orig 2014-07-04 07:51:21.000000000 +0000
++++ condition_parser.mly
+@@ -17,15 +17,15 @@
+ /*
+ * bibtex2html - A BibTeX to HTML translator
+ * Copyright (C) 1997 Jean-Christophe FILLIATRE
+- *
++ *
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation.
+- *
++ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+- *
++ *
+ * See the GNU General Public License version 2 for more details
+ * (enclosed in the file GPL).
+ */
+@@ -39,7 +39,7 @@
+ %}
+
+ %token <string> IDENT STRING COMP
+-%token <string> INT
++%token <string> INT
+ %token COLON AND OR NOT LPAR RPAR DOLLAR_KEY DOLLAR_TYPE EXISTS EOF
+
+ %start condition_start
+@@ -64,19 +64,17 @@ condition:
+ ;
+
+ atom:
+-| cte COLON STRING
++| cte COLON STRING
+ { let s = Latex_accents.normalize true $3 in
+ (*i
+ Printf.printf "regexp = %s\n" s;
+ i*)
+ Match($1, Str.regexp_case_fold s) }
+-| cte COMP cte
++| cte COMP cte
+ { Comp($1,$2,$3) }
+-| EXISTS IDENT
+- { Exists(String.lowercase $2) }
++| EXISTS IDENT
++ { Exists(String.lowercase_ascii $2) }
+ ;
+
+-cte: IDENT { Field(String.lowercase $1) } | INT { Cte($1) } | STRING {
++cte: IDENT { Field(String.lowercase_ascii $1) } | INT { Cte($1) } | STRING {
+ Cte($1) } | DOLLAR_KEY { Key } | DOLLAR_TYPE { Entrytype } ;
+-
+-
diff --git a/converters/bibtex2html/patches/patch-expand.ml b/converters/bibtex2html/patches/patch-expand.ml
new file mode 100644
index 00000000000..6cadea3d6c5
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-expand.ml
@@ -0,0 +1,16 @@
+$NetBSD: patch-expand.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- expand.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ expand.ml
+@@ -174,7 +174,7 @@ let date_compare el e1 e2 =
+
+ (*s Access to the fields. *)
+
+-let get_field (_,_,f) s = List.assoc (String.lowercase s) f
++let get_field (_,_,f) s = List.assoc (String.lowercase_ascii s) f
+ let get_lowercase_field (_,_,f) s = List.assoc s f
+
+ let get_title e = get_lowercase_field e "title"
diff --git a/converters/bibtex2html/patches/patch-latexmacros.ml b/converters/bibtex2html/patches/patch-latexmacros.ml
new file mode 100644
index 00000000000..9dbc6bae97d
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-latexmacros.ml
@@ -0,0 +1,16 @@
+$NetBSD: patch-latexmacros.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- latexmacros.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ latexmacros.ml
+@@ -113,7 +113,7 @@ def "\\textsi" [Print "<i>" ; Print_arg
+ (* Basic color support. *)
+
+ def "\\textcolor" [ Parameterized (function name ->
+- match String.lowercase name with
++ match String.lowercase_ascii name with
+ (* At the moment, we support only the 16 named colors defined in HTML 4.01. *)
+ | "black" | "silver" | "gray" | "white" | "maroon" | "red" | "purple" | "fuchsia"
+ | "green" | "lime" | "olive" | "yellow" | "navy" | "blue" | "teal" | "aqua" ->
diff --git a/converters/bibtex2html/patches/patch-main.ml b/converters/bibtex2html/patches/patch-main.ml
new file mode 100644
index 00000000000..6d0dbc3a350
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-main.ml
@@ -0,0 +1,16 @@
+$NetBSD: patch-main.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- main.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ main.ml
+@@ -89,7 +89,7 @@ let sort_entries entries bibitems =
+ in
+ let sl =
+ if !sort = By_date then
+- Sort.list (fun (_,_,e1) (_,_,e2) -> Expand.date_order entries e1 e2) el
++ List.sort (fun (_,_,e1) (_,_,e2) -> Expand.date_compare entries e1 e2) el
+ else
+ el
+ in
diff --git a/converters/bibtex2html/patches/patch-readbib.ml b/converters/bibtex2html/patches/patch-readbib.ml
new file mode 100644
index 00000000000..8a7244910c7
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-readbib.ml
@@ -0,0 +1,33 @@
+$NetBSD: patch-readbib.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- readbib.ml.orig 2014-07-04 07:51:21.000000000 +0000
++++ readbib.ml
+@@ -21,10 +21,10 @@ open Printf
+
+ let read_entries_from_file f =
+ if not !Options.quiet then begin
+- if f = "" then
++ if f = "" then
+ eprintf "Reading from standard input...\n"
+ else
+- eprintf "Reading %s..." f;
++ eprintf "Reading %s..." f;
+ flush stderr
+ end;
+ let chan = if f = "" then stdin else open_in f in
+@@ -36,9 +36,9 @@ let read_entries_from_file f =
+ eprintf "ok (%d entries).\n" (Bibtex.size el); flush stderr
+ end;
+ el
+- with Parsing.Parse_error | Failure "unterminated string" ->
++ with Parsing.Parse_error | Failure _ ->
+ if f <> "" then close_in chan;
+- eprintf "Parse error character %d, in or after entry '%s'.\n"
++ eprintf "Parse error character %d, in or after entry '%s'.\n"
+ (Lexing.lexeme_start lb) !Bibtex.current_key;
+ flush stderr;
+- exit 1
++ exit 1
diff --git a/converters/bibtex2html/patches/patch-translate.ml b/converters/bibtex2html/patches/patch-translate.ml
new file mode 100644
index 00000000000..4c29570045b
--- /dev/null
+++ b/converters/bibtex2html/patches/patch-translate.ml
@@ -0,0 +1,91 @@
+$NetBSD: patch-translate.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
+
+fixed compilation with recent versions of OCaml
+git commit 8f25afb95a839c9f9522a34013d5c905af14378b
+
+--- translate.ml.orig 2014-07-04 07:51:22.000000000 +0000
++++ translate.ml
+@@ -69,23 +69,23 @@ let default_fields =
+ let (fields : field_info list ref) = ref default_fields
+
+ let add_field s =
+- let u = String.lowercase s in
++ let u = String.lowercase_ascii s in
+ Biboutput.add_link_field u;
+ fields := (u, None) :: (List.remove_assoc u !fields)
+
+ let add_named_field s name =
+- let u = String.lowercase s in
++ let u = String.lowercase_ascii s in
+ Biboutput.add_link_field u;
+ if u = "abstract" then abstract_name := name;
+ if not !both || u <> "abstract" then
+ fields := (u, Some name) :: (List.remove_assoc u !fields)
+
+ let add_note_field s =
+- let u = String.lowercase s in
++ let u = String.lowercase_ascii s in
+ note_fields := !note_fields @ [u, NKlatex]
+
+ let add_note_html_field s =
+- let u = String.lowercase s in
++ let u = String.lowercase_ascii s in
+ note_fields := !note_fields @ [u, NKhtml]
+
+ (* first pass to get the crossrefs *)
+@@ -186,13 +186,13 @@ let file_suffixes =
+ ".rtf"; ".RTF"; ".txt"; ".TXT"; ".html"; ".HTML" ])
+
+ let is_http s =
+- String.length s > 3 & String.lowercase (String.sub s 0 4) = "http"
++ String.length s > 3 && String.lowercase_ascii (String.sub s 0 4) = "http"
+
+ let is_ftp s =
+- String.length s > 2 & String.lowercase (String.sub s 0 3) = "ftp"
++ String.length s > 2 && String.lowercase_ascii (String.sub s 0 3) = "ftp"
+
+ let is_www s =
+- String.length s > 3 & String.lowercase (String.sub s 0 4) = "www:"
++ String.length s > 3 && String.lowercase_ascii (String.sub s 0 4) = "www:"
+
+ let is_url s = is_http s || is_ftp s || is_www s
+
+@@ -203,7 +203,8 @@ let file_type f =
+ if is_http f then "http" else if is_ftp f then "ftp" else "www:"
+
+ let get_url s =
+- if (String.length s > 3 & String.lowercase (String.sub s 0 3) = "www") then
++ if String.length s > 3 && String.lowercase_ascii (String.sub s 0 3) = "www"
++ then
+ String.sub s 4 (String.length s - 4)
+ else
+ s
+@@ -215,7 +216,7 @@ let link_name (u, name) url s = match na
+ if !raw_url then
+ url
+ else if !use_label_name then
+- String.capitalize (String.lowercase u)
++ String.capitalize_ascii (String.lowercase_ascii u)
+ else
+ s
+
+@@ -422,16 +423,16 @@ let one_entry_summary ch biblio (_,b,((_
+ output_string ch "\n\n";
+ open_row ch;
+ (* JK changes *)
+- if (not !nokeys) or !multiple then output_string ch "[";
++ if (not !nokeys) || !multiple then output_string ch "[";
+ Html.open_anchor ch k;
+- if (not !nokeys) or !multiple then begin
++ if (not !nokeys) || !multiple then begin
+ if !multiple then Html.open_href ch (k ^ !link_suffix);
+ latex2html ch (if !use_keys then k else Hashtbl.find cite_tab k);
+ if !multiple then Html.close_href ch;
+ end else
+ if !table <> NoTable then output_string ch "&nbsp;";
+ Html.close_anchor ch;
+- if (not !nokeys) or !multiple then output_string ch "]";
++ if (not !nokeys) || !multiple then output_string ch "]";
+ (* end of JK changes *)
+ output_string ch "\n";
+ new_column ch;