Mercurial > urweb
diff src/settings.sml @ 1752:675ce534e3ec
New optional suffice for 'rewrite' in .urp files: [-]
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 06 May 2012 15:27:30 -0400 |
parents | c414850f206f |
children | e9587120831a |
line wrap: on
line diff
--- a/src/settings.sml Sun May 06 15:15:46 2012 -0400 +++ b/src/settings.sml Sun May 06 15:27:30 2012 -0400 @@ -326,7 +326,7 @@ type rule = { action : action, kind : pattern_kind, pattern : string } datatype path_kind = Any | Url | Table | Sequence | View | Relation | Cookie | Style -type rewrite = { pkind : path_kind, kind : pattern_kind, from : string, to : string } +type rewrite = { pkind : path_kind, kind : pattern_kind, from : string, to : string, hyphenate : bool } val rewrites = ref ([] : rewrite list) @@ -357,7 +357,15 @@ if subsume (pk, #pkind rewr) then case match () of NONE => rew ls - | SOME suffixStart => #to rewr ^ String.extract (s, suffixStart, NONE) + | SOME suffixStart => + let + val s = #to rewr ^ String.extract (s, suffixStart, NONE) + in + if #hyphenate rewr then + String.translate (fn #"_" => "-" | ch => str ch) s + else + s + end else rew ls end