# HG changeset patch # User wenzelm # Date 1082053890 -7200 # Node ID b88d5f9e02e112a983884d056b6ca471b383b94e # Parent 0bf4e84bf51d09c5e283b3eab96d0b319eb697a6 fixed width; tuned; diff -r 0bf4e84bf51d -r b88d5f9e02e1 src/Pure/Thy/html.ML --- a/src/Pure/Thy/html.ML Thu Apr 15 20:30:50 2004 +0200 +++ b/src/Pure/Thy/html.ML Thu Apr 15 20:31:30 2004 +0200 @@ -95,7 +95,7 @@ | "\\" => (1.0, "×") | "\\" => (1.0, "Ø") | "\\
" => (1.0, "÷") - | "\\" => (1.0, "ˆ") + | "\\" => (1.0, "ˆ") | "\\" => (1.0, "Α") | "\\" => (1.0, "Β") | "\\" => (1.0, "Γ") @@ -162,7 +162,7 @@ | "\\" => (1.0, "∝") | "\\" => (1.0, "∞") | "\\" => (1.0, "∠") - | "\\" => (1.0, "∧") + | "\\" => (1.0, "∧") | "\\" => (1.0, "∨") | "\\" => (1.0, "∩") | "\\" => (1.0, "∪") @@ -191,11 +191,10 @@ | "\\" => (1.0, "♣") | "\\" => (1.0, "♥") | "\\" => (1.0, "♦") - | "\\" => (2.0, "[|") | "\\" => (2.0, "|]") | "\\" => (3.0, "==>") - | "\\" => (3.0, "=>") + | "\\" => (2.0, "=>") | "\\" => (2.0, "!!") | "\\" => (2.0, "::") | "\\" => (2.0, "(|") @@ -203,47 +202,38 @@ | "\\" => (3.0, "<->") | "\\" => (3.0, "-->") | "\\" => (2.0, "->") - | "\\" => (2.0, "==") - | "\\" => (2.0, "=>") - | "\\" => (2.0, "<=") - | "\\<^bsub>" => (0.0, "") | "\\<^esub>" => (0.0, "") | "\\<^bsup>" => (0.0, "") | "\\<^esup>" => (0.0, "") -(* keep \<^sub> etc, so they are not destroyed by default case *) + | "\\<^sub>" => (0.0, "\\<^sub>") | "\\<^sup>" => (0.0, "\\<^sup>") - | "\\<^sub>" => (0.0, "\\<^sub>") + | "\\<^isub>" => (0.0, "\\<^isub>") | "\\<^isup>" => (0.0, "\\<^isup>") - | "\\<^isub>" => (0.0, "\\<^isub>") | s => (real (size s), implode (map escape (explode s))); fun add_sym (width, (w: real, s)) = (width + w, s); - fun script (0, "\\<^sub>") = (1,"") - | script (0, "\\<^isub>") = (1,"") + fun script (0, "\\<^sub>") = (1, "") + | script (0, "\\<^isub>") = (1, "") | script (1, x) = (0, x ^ "") - | script (0, "\\<^sup>") = (2,"") - | script (0, "\\<^isup>") = (2,"") + | script (0, "\\<^sup>") = (2, "") + | script (0, "\\<^isup>") = (2, "") | script (2, x) = (0, x ^ "") - | script (s, x) = (s,x); + | script (s, x) = (s, x); - fun scrs (s, []) = (s,[]) - | scrs (s, x::xs) = let val (s', x') = script (s, x) - val (s'', xs') = scrs (s', xs) - in (s'', x'::xs') end; - - fun scripts ss = #2 (scrs (0,ss)); + fun scripts ss = #2 (foldl_map script (0, ss)); in fun output_width str = - if not (exists_string (equal "<" orf equal ">" orf equal "&") str) then (str, real (size str)) + if not (exists_string (equal "<" orf equal ">" orf equal "&") str) + then (str, real (size str)) else let val (width, syms) = foldl_map add_sym (0.0, map output_sym (Symbol.explode str)) in (implode (scripts syms), width) end; val output = #1 o output_width; -val output_symbols = scripts o (map (#2 o output_sym)) +val output_symbols = scripts o map (#2 o output_sym); end; @@ -369,9 +359,10 @@ (* theory *) -fun verbatim_source ss = "\n
\n
\n
\n
" ^ 
-                         implode (output_symbols ss)  ^ 
-                         "
\n
\n
\n
\n"; +fun verbatim_source ss = + "\n
\n
\n
\n
" ^
+  implode (output_symbols ss)  ^
+  "
\n
\n
\n
\n"; local @@ -400,9 +391,9 @@ fun ml_file path str = begin_document ("File " ^ Url.pack path) ^ - "\n
\n
\n" ^ - verbatim str ^ - "\n
\n
\n
\n" ^ + "\n
\n
\n" ^ + verbatim str ^ + "\n
\n
\n
\n" ^ end_document;