56 |
56 |
57 local |
57 local |
58 val hidden = XML.text #> (span Markup.hiddenN |-> enclose); |
58 val hidden = XML.text #> (span Markup.hiddenN |-> enclose); |
59 |
59 |
60 val html_syms = Symtab.make |
60 val html_syms = Symtab.make |
61 [("'", (1, "'")), |
61 [("\n", (0, "<br/>")), |
|
62 ("'", (1, "'")), |
62 ("\\<spacespace>", (2, " ")), |
63 ("\\<spacespace>", (2, " ")), |
63 ("\\<exclamdown>", (1, "¡")), |
64 ("\\<exclamdown>", (1, "¡")), |
64 ("\\<cent>", (1, "¢")), |
65 ("\\<cent>", (1, "¢")), |
65 ("\\<pounds>", (1, "£")), |
66 ("\\<pounds>", (1, "£")), |
66 ("\\<currency>", (1, "¤")), |
67 ("\\<currency>", (1, "¤")), |
229 | output_syms (s :: ss) = output_sym s :: output_syms ss |
230 | output_syms (s :: ss) = output_sym s :: output_syms ss |
230 | output_syms [] = []; |
231 | output_syms [] = []; |
231 in |
232 in |
232 |
233 |
233 fun output_width str = |
234 fun output_width str = |
234 if not (exists_string (fn s => s = "\\" orelse s = "<" orelse s = ">" orelse s = "&") str) |
235 let val (syms, width) = |
235 then Output.default_output str |
236 fold_map (fn (w, s) => fn width => (s, w + width)) (output_syms (Symbol.explode str)) 0 |
236 else |
237 in (implode syms, width) end; |
237 let val (syms, width) = fold_map (fn (w, s) => fn width => (s, w + width)) |
|
238 (output_syms (Symbol.explode str)) 0 |
|
239 in (implode syms, width) end; |
|
240 |
238 |
241 val output = #1 o output_width; |
239 val output = #1 o output_width; |
242 |
240 |
243 val _ = Output.add_mode htmlN output_width Symbol.encode_raw; |
241 val _ = Output.add_mode htmlN output_width Symbol.encode_raw; |
244 |
242 |