changeset 2090:9a1547596712

Fix XML syntax for closing <input> tags
author Adam Chlipala <adam@chlipala.net>
date Thu, 18 Dec 2014 07:48:37 -0500
parents 5f15f4ce8f3b
children 35c1341b0179
files src/monoize.sml tests/nestedInput.ur
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/monoize.sml	Sat Dec 06 15:45:41 2014 -0500
+++ b/src/monoize.sml	Thu Dec 18 07:48:37 2014 -0500
@@ -3447,6 +3447,8 @@
                                            NONE => tagStart
                                          | SOME extra => (L'.EStrcat (tagStart, extra), loc)
 
+                        val firstWord = Substring.string o #1 o Substring.splitl (fn ch => not (Char.isSpace ch)) o Substring.full
+
                         fun normal () =
                             let
                                 val (xml, fm) = monoExp (env, st, fm) xml
@@ -3457,7 +3459,7 @@
                             in
                                 ((L'.EStrcat ((L'.EStrcat (tagStart, strH ">"), loc),
                                               (L'.EStrcat (xml,
-                                                           strH (String.concat ["</", tag, ">"])), loc)),
+                                                           strH (String.concat ["</", firstWord tag, ">"])), loc)),
                                   loc),
                                  fm)
                             end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nestedInput.ur	Thu Dec 18 07:48:37 2014 -0500
@@ -0,0 +1,10 @@
+fun main () : transaction page =
+    let
+        fun handler _ = return <xml/>
+    in
+        return <xml><body>
+          <form>
+            <submit action={handler}>Uh oh!</submit>
+          </form>
+        </body></xml>
+    end