Skip to content

Instantly share code, notes, and snippets.

@Octachron
Created May 4, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Octachron/d117667e74dd17c6edef105b027fa235 to your computer and use it in GitHub Desktop.
Save Octachron/d117667e74dd17c6edef105b027fa235 to your computer and use it in GitHub Desktop.
--- /dev/null
+++ b/contents_motif.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path fill="none" d="M0 0h24v24H0V0z"/>
+ <path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"/>
+</svg>
diff --git a/cut.mli b/cut.mli
index e99562c..37d7a56 100755
--- a/cut.mli
+++ b/cut.mli
@@ -16,6 +16,7 @@ type toc_style = Normal | Both | Special
exception Error of string
module type Config = sig
+ val modern_arrows:bool
val verbose : int
val name_in : string
val name_out : string
diff --git a/cut.mll b/cut.mll
index bb012d9..dd8d51f 100755
--- a/cut.mll
+++ b/cut.mll
@@ -19,6 +19,7 @@ type toc_style = Normal | Both | Special
exception Error of string
module type Config = sig
+ val modern_arrows: bool
val verbose : int
val name_in : string
val name_out : string
@@ -81,10 +82,15 @@ let imgsrc img alt =
let _ =
+ if Config.modern_arrows then begin
+ Hashtbl.add env "UPTXT" (imgsrc "contents_motif.svg" "Up") ;
+ Hashtbl.add env "PREVTXT" (imgsrc "previous_motif.svg" "Previous") ;
+ Hashtbl.add env "NEXTTXT" (imgsrc "next_motif.svg" "Next") end
+ else begin
Hashtbl.add env "UPTXT" (imgsrc "contents_motif.gif" "Up") ;
Hashtbl.add env "PREVTXT" (imgsrc "previous_motif.gif" "Previous") ;
- Hashtbl.add env "NEXTTXT" (imgsrc "next_motif.gif" "Next") ;
- ()
+ Hashtbl.add env "NEXTTXT" (imgsrc "next_motif.gif" "Next")
+ end
let get_env key =
try Hashtbl.find env key with Not_found -> assert false
diff --git a/hacha.ml b/hacha.ml
index 42d7147..6e60a97 100755
--- a/hacha.ml
+++ b/hacha.ml
@@ -21,8 +21,8 @@ let toc_style = ref Cut.Normal
let cross_links = ref true
let verbose = ref 0
let small_length = ref 1024
+let modern_arrows = ref true
-
let main () =
let spec =
[("-o", Arg.String (fun s -> outname := s),
@@ -32,7 +32,9 @@ let main () =
("-tocter", Arg.Unit (fun () -> toc_style := Cut.Special),
", Insert most of table of contents at the beginning of files");
("-nolinks", Arg.Unit (fun () -> cross_links := false),
- ", Suppress the prevous/up/next links in generated pages");
+ ", Suppress the prevous/up/next links in generated pages");
+ ("-modernarrows", Arg.Unit (fun () -> modern_arrows := true),
+ ", use svg arrow");
("-hrf", Arg.Unit (fun () -> log := true),
", output a log file showing the association from local anchors to files");
("-rsz", Arg.Int (fun i -> small_length := i),
@@ -61,6 +63,7 @@ let main () =
with Sys_error s -> raise (Error ("File error: "^s)) in
let module Config = struct
+ let modern_arrows = ! modern_arrows
let verbose = !verbose
let name_in = filename
let name_out = !outname
@@ -83,9 +86,17 @@ let main () =
close_in chan ;
if !log then Cross.dump (C.real_name (C.base^".hrf")) C.check_changed ;
if some_links then begin
- Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "previous_motif.gif" ;
- Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "next_motif.gif" ;
- Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "contents_motif.gif"
+ if !modern_arrows then
+ begin
+ Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "previous_motif.svg" ;
+ Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "next_motif.svg" ;
+ Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "contents_motif.svg"
+ end
+ else begin
+ Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "previous_motif.gif" ;
+ Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "next_motif.gif" ;
+ Mysys.copy_from_lib_to_dir Mylib.libdir C.dir "contents_motif.gif"
+ end
end
;;
diff --git a/install.sh b/install.sh
index e76df20..13e8d10 100755
--- a/install.sh
+++ b/install.sh
@@ -42,7 +42,7 @@ case $1 in
;;
esac
-install . $LIBDIR imagen xxcharset.exe xxdate.exe contents_motif.gif next_motif.gif previous_motif.gif $ALLLIB
+install . $LIBDIR imagen xxcharset.exe xxdate.exe contents_motif.gif next_motif.gif previous_motif.gif contents_motif.svg next_motif.svg previous_motif.svg $ALLLIB
install . $LATEXLIBDIR hevea.sty
install html $LIBDIR/html $HTMLLIB
install text $LIBDIR/text $TEXTLIB
@@ -50,4 +50,4 @@ install info $LIBDIR/info $INFOLIB
MAPPINGS=`( cd ./mappings && echo *.map )`
install mappings $LIBDIR/mappings $MAPPINGS
installbin $TARGET hevea hacha esponja bibhva
-cpv imagen $BINDIR
\ No newline at end of file
+cpv imagen $BINDIR
diff --git a/next_motif.svg b/next_motif.svg
new file mode 100644
index 0000000..8a97d02
--- /dev/null
+++ b/next_motif.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path d="M0 0h24v24H0z" fill="none"/>
+ <path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/>
+</svg>
diff --git a/previous_motif.svg b/previous_motif.svg
new file mode 100644
index 0000000..a896e11
--- /dev/null
+++ b/previous_motif.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path d="M0 0h24v24H0z" fill="none"/>
+ <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
+</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment