Mercurial > urweb
comparison lib/ur/string.ur @ 1131:94e83c5533d2
Handling errors during commit
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 26 Jan 2010 14:59:19 -0500 |
parents | 85d194409b17 |
children | 9df124fcab3d |
comparison
equal
deleted
inserted
replaced
1130:67d875c8ac71 | 1131:94e83c5533d2 |
---|---|
36 || (f (sub s i) && al (i + 1)) | 36 || (f (sub s i) && al (i + 1)) |
37 in | 37 in |
38 al 0 | 38 al 0 |
39 end | 39 end |
40 | 40 |
41 fun mp f s = | |
42 let | |
43 fun mp' i acc = | |
44 if i < 0 then | |
45 acc | |
46 else | |
47 mp' (i - 1) (str (f (sub s i)) ^ acc) | |
48 in | |
49 mp' (length s - 1) "" | |
50 end | |
51 | |
41 fun newlines [ctx] [[Body] ~ ctx] s : xml ([Body] ++ ctx) [] [] = | 52 fun newlines [ctx] [[Body] ~ ctx] s : xml ([Body] ++ ctx) [] [] = |
42 case split s #"\n" of | 53 case split s #"\n" of |
43 None => cdata s | 54 None => cdata s |
44 | Some (s1, s2) => <xml>{[s1]}<br/>{newlines s2}</xml> | 55 | Some (s1, s2) => <xml>{[s1]}<br/>{newlines s2}</xml> |