From b540e401c63dfc5e5472be2869d93027b1dfc6a4 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 19 Oct 2008 14:51:12 -0400 Subject: Generating fontified source files --- src/demo.sml | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'src/demo.sml') diff --git a/src/demo.sml b/src/demo.sml index 782e3d7f..1e448660 100644 --- a/src/demo.sml +++ b/src/demo.sml @@ -140,6 +140,11 @@ fun make {prefix, dirname} = 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 make {prefix, dirname} = 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 @@ fun make {prefix, dirname} = TextIO.closeIn inf; TextIO.closeOut out end) + | SOME "urs" => highlight () + | SOME "ur" => highlight () | _ => (); loop () end -- cgit v1.2.3