# HG changeset patch # User Adam Chlipala # Date 1224442272 14400 # Node ID aa2edbd47041b679d6e2de4add41dafcd6c1acf0 # Parent 1fe85b58c9ba8fd6864e61a282b95d2a332d9227 Generating fontified source files diff -r 1fe85b58c9ba -r aa2edbd47041 src/demo.sml --- a/src/demo.sml Sun Oct 19 14:13:08 2008 -0400 +++ b/src/demo.sml Sun Oct 19 14:51:12 2008 -0400 @@ -140,6 +140,11 @@ TextIO.output (out, "\n\n\n

"); TextIO.output (out, name); TextIO.output (out, "

\n\n
[ Application"); + TextIO.output (out, " | "); TextIO.output (out, urp); @@ -240,9 +245,34 @@ fun doit f = f (OS.Path.joinDirFile {dir = dirname, file = file}, - OS.Path.joinDirFile {dir = outDir, - file = OS.Path.joinBaseExt {base = file, - ext = SOME "html"}}) + OS.Path.mkAbsolute + {relativeTo = OS.FileSys.getDir (), + path = OS.Path.joinDirFile {dir = outDir, + file = OS.Path.joinBaseExt {base = file, + ext = SOME "html"}}}) + + fun highlight () = + doit (fn (src, html) => + let + val cmd = "emacs --eval \"(progn " + ^ "(global-font-lock-mode t) " + ^ "(add-to-list 'load-path \\\"" + ^ Config.sitelisp + ^ "/\\\") " + ^ "(load \\\"urweb-mode-startup\\\") " + ^ "(urweb-mode) " + ^ "(find-file \\\"" + ^ src + ^ "\\\") " + ^ "(switch-to-buffer (htmlize-buffer)) " + ^ "(write-file \\\"" + ^ html + ^ "\\\") " + ^ "(kill-emacs))\"" + in + print (">>> " ^ cmd ^ "\n"); + ignore (OS.Process.system cmd) + end) in case OS.Path.ext file of SOME "urp" => @@ -268,6 +298,8 @@ TextIO.closeIn inf; TextIO.closeOut out end) + | SOME "urs" => highlight () + | SOME "ur" => highlight () | _ => (); loop () end