2014-07-28 19:00:54 +02:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
2015-08-30 19:23:37 +02:00
|
|
|
ocaml str.cma -stdin "$1" "$2" <<EOF
|
2015-08-26 08:02:52 +02:00
|
|
|
let fixup = let open Str in
|
2015-08-26 08:39:01 +02:00
|
|
|
let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
|
2015-08-31 03:30:27 +02:00
|
|
|
and head = regexp {|-----\(.*\)-----|} in fun s ->
|
|
|
|
String.escaped s |> global_replace dash {|\1\t\2|}
|
|
|
|
|> global_replace head {|\xc2\xb7\1|};;
|
2015-08-26 08:02:52 +02:00
|
|
|
let rec iter ic = match input_line ic with
|
2015-08-31 03:30:27 +02:00
|
|
|
| s -> Printf.printf "\"%s\";\\n" @@ fixup s; iter ic
|
2015-08-26 08:02:52 +02:00
|
|
|
| exception End_of_file -> ();;
|
|
|
|
Printf.printf "let keys = [\\n";
|
|
|
|
iter @@ open_in Sys.argv.(1);;
|
|
|
|
Printf.printf "];;\\nlet version = %S;;\\n" Sys.argv.(2);;
|
2015-08-25 02:06:14 +02:00
|
|
|
EOF
|