diff options
author | 2014-06-13 10:57:02 -0400 | |
---|---|---|
committer | 2014-06-13 10:57:02 -0400 | |
commit | 13db4d0f620345cf01d6215cbd2a1d614cdc37ba (patch) | |
tree | 7c8c90a9b7f3ef54edc5009ff544c27e58d7c6a2 /src/monoize.sml | |
parent | 5f541f2fd4a4ecd6f0b2d900bcad0092363bb3a8 (diff) |
Treat <button> 'value' attribute as content of tag
Diffstat (limited to 'src/monoize.sml')
-rw-r--r-- | src/monoize.sml | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 6572b2ac..8c33e60b 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -3290,6 +3290,16 @@ fun monoExp (env, st, fm) (all as (e, loc)) = else (NONE, NONE, attrs) + (* Special case for <button value=""> *) + val (attrs, extraString) = case tag of + "button" => + (case List.partition (fn (x, _, _) => x = "Value") attrs of + ([(_, value, _)], rest) => + (rest, SOME value) + | _ => (attrs, NONE)) + | _ => (attrs, NONE) + + val (class, fm) = monoExp (env, st, fm) class val (dynClass, fm) = monoExp (env, st, fm) dynClass val (style, fm) = monoExp (env, st, fm) style @@ -3464,6 +3474,10 @@ fun monoExp (env, st, fm) (all as (e, loc)) = fun normal () = let val (xml, fm) = monoExp (env, st, fm) xml + + val xml = case extraString of + NONE => xml + | SOME extra => (L'.EStrcat (extra, xml), loc) in ((L'.EStrcat ((L'.EStrcat (tagStart, (L'.EPrim (Prim.String ">"), loc)), loc), (L'.EStrcat (xml, @@ -3483,12 +3497,12 @@ fun monoExp (env, st, fm) (all as (e, loc)) = Substring.string bef) end in - case xml of - (L.EApp ((L.ECApp ( - (L.ECApp ((L.EFfi ("Basis", "cdata"), _), - _), _), - _), _), - (L.EPrim (Prim.String s), _)), _) => + case (xml, extraString) of + ((L.EApp ((L.ECApp ( + (L.ECApp ((L.EFfi ("Basis", "cdata"), _), + _), _), + _), _), + (L.EPrim (Prim.String s), _)), _), NONE) => if CharVector.all Char.isSpace s andalso isSingleton () then ((L'.EStrcat (tagStart, (L'.EPrim (Prim.String " />"), loc)), loc), fm) else |