diff options
-rw-r--r-- | lib/ur/basis.urs | 11 | ||||
-rw-r--r-- | src/monoize.sml | 9 | ||||
-rw-r--r-- | src/urweb.grm | 1 | ||||
-rw-r--r-- | src/urweb.lex | 8 | ||||
-rw-r--r-- | tests/html5_forms.ur | 21 |
5 files changed, 46 insertions, 4 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 7691cdce..9fb04484 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -969,6 +969,17 @@ val email : textWidget val search : textWidget val url_ : textWidget val tel : textWidget +val color : textWidget + +val number : formTag float [] ([Value = float, Min = float, Max = float, Step = float, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val range : formTag float [] ([Value = float, Min = float, Max = float, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val date : formTag string [] ([Value = string, Min = string, Max = string, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val datetime : formTag string [] ([Value = string, Min = string, Max = string, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val datetime_local : formTag string [] ([Value = string, Min = string, Max = string, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val month : formTag string [] ([Value = string, Min = string, Max = string, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val week : formTag string [] ([Value = string, Min = string, Max = string, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) +val timeInput : formTag string [] ([Value = string, Min = string, Max = string, Size = int, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) + type file diff --git a/src/monoize.sml b/src/monoize.sml index 96323c9e..9ca21058 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -3667,6 +3667,15 @@ fun monoExp (env, st, fm) (all as (e, loc)) = | "search" => input "search" | "url_" => input "url" | "tel" => input "tel" + | "color" => input "color" + | "number" => input "number" + | "range" => input "range" + | "date" => input "date" + | "datetime" => input "datetime" + | "datetime_local" => input "datetime-local" + | "month" => input "month" + | "week" => input "week" + | "timeInput" => input "time" | "textarea" => (case targs of [_, (L.CName name, _)] => diff --git a/src/urweb.grm b/src/urweb.grm index 85e5f092..5b568a8c 100644 --- a/src/urweb.grm +++ b/src/urweb.grm @@ -222,6 +222,7 @@ fun tagIn bt = case bt of "table" => "tabl" | "url" => "url_" + | "datetime-local" => "datetime_local" | _ => bt datatype prop_kind = Delete | Update diff --git a/src/urweb.lex b/src/urweb.lex index 15ae448e..0d316ed2 100644 --- a/src/urweb.lex +++ b/src/urweb.lex @@ -277,19 +277,19 @@ xint = x[0-9a-fA-F][0-9a-fA-F]; continue ()) end); -<INITIAL> "<" {id} "/>"=>(let +<INITIAL> "<" {xmlid} "/>"=>(let val tag = String.substring (yytext, 1, size yytext - 3) in Tokens.XML_BEGIN_END (tag, yypos, yypos + size yytext) end); -<INITIAL> "<" {id} ">"=> (let +<INITIAL> "<" {xmlid} ">"=> (let val tag = String.substring (yytext, 1, size yytext - 2) in YYBEGIN XML; xmlTag := tag :: (!xmlTag); Tokens.XML_BEGIN (tag, yypos, yypos + size yytext) end); -<XML> "</" {id} ">" => (let +<XML> "</" {xmlid} ">" => (let val id = String.substring (yytext, 2, size yytext - 3) in case !xmlTag of @@ -304,7 +304,7 @@ xint = x[0-9a-fA-F][0-9a-fA-F]; Tokens.END_TAG (id, yypos, yypos + size yytext) end); -<XML> "<" {id} => (YYBEGIN XMLTAG; +<XML> "<" {xmlid} => (YYBEGIN XMLTAG; Tokens.BEGIN_TAG (String.extract (yytext, 1, NONE), yypos, yypos + size yytext)); diff --git a/tests/html5_forms.ur b/tests/html5_forms.ur index a9bf7f77..507ea3cf 100644 --- a/tests/html5_forms.ur +++ b/tests/html5_forms.ur @@ -6,6 +6,15 @@ fun handler r = return <xml><body> E: {[r.E]}<br/> F: {[r.F]}<br/> G: {[r.G]}<br/> + H: {[r.H]}<br/> + I: {[r.I]}<br/> + J: {[r.J]}<br/> + K: {[r.K]}<br/> + L: {[r.L]}<br/> + M: {[r.M]}<br/> + N: {[r.N]}<br/> + O: {[r.O]}<br/> + P: {[r.P]}<br/> </body></xml> fun main () = @@ -19,6 +28,18 @@ fun main () = <tel{#F}/> <search{#G}/> + <hr/> + + <color{#H}/> + <number{#I} min={17.0} max={32.8} value={20.6} step={2.5}/> + <range{#J} min={17.0} max={32.8} value={20.6}/> + <date{#K}/> + <datetime{#L}/> + <datetime-local{#M}/> + <month{#N}/> + <week{#O}/> + <timeInput{#P}/> + <submit action={handler}/> </form> </body></xml> |