Mercurial > urweb
diff src/demo.sml @ 776:9f2555f06901
upload demo
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 03 May 2009 12:49:47 -0400 |
parents | 412ccd97ab71 |
children | 305bc0a431de |
line wrap: on
line diff
--- a/src/demo.sml Sun May 03 12:36:25 2009 -0400 +++ b/src/demo.sml Sun May 03 12:49:47 2009 -0400 @@ -363,6 +363,20 @@ val fname = OS.Path.joinDirFile {dir = dirname, file = "demo.urp"} val outf = TextIO.openOut fname + + fun filters kind = + app (fn rule : Settings.rule => + (TextIO.output (outf, case #action rule of + Settings.Allow => "allow" + | Settings.Deny => "deny"); + TextIO.output (outf, " "); + TextIO.output (outf, kind); + TextIO.output (outf, " "); + TextIO.output (outf, #pattern rule); + case #kind rule of + Settings.Exact => () + | Settings.Prefix => TextIO.output (outf, "*"); + TextIO.output (outf, "\n"))) in Option.app (fn db => (TextIO.output (outf, "database "); TextIO.output (outf, db); @@ -391,16 +405,8 @@ TextIO.output (outf, " "); TextIO.output (outf, #to rule); TextIO.output (outf, "\n"))) (#rewrites combined); - app (fn rule => - (TextIO.output (outf, case #action rule of - Settings.Allow => "allow" - | Settings.Deny => "deny"); - TextIO.output (outf, " url "); - TextIO.output (outf, #pattern rule); - case #kind rule of - Settings.Exact => () - | Settings.Prefix => TextIO.output (outf, "*"); - TextIO.output (outf, "\n"))) (#filterUrl combined); + filters "url" (#filterUrl combined); + filters "mime" (#filterMime combined); TextIO.output (outf, "\n"); app (fn s =>