Mercurial > urweb
comparison src/urweb.grm @ 2047:6be31671911b
'aria-*' attributes
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 01 Aug 2014 11:43:44 -0400 |
parents | d11a7a9c4a73 |
children | 4d64af730e35 |
comparison
equal
deleted
inserted
replaced
2046:ced78ef1c82f | 2047:6be31671911b |
---|---|
223 "table" => "tabl" | 223 "table" => "tabl" |
224 | _ => bt | 224 | _ => bt |
225 | 225 |
226 datatype prop_kind = Delete | Update | 226 datatype prop_kind = Delete | Update |
227 | 227 |
228 datatype attr = Class of exp | DynClass of exp | Style of exp | DynStyle of exp | Normal of con * exp | Data of string * exp | 228 datatype attr = Class of exp | DynClass of exp | Style of exp | DynStyle of exp | Normal of con * exp | Data of string * string * exp |
229 | 229 |
230 fun patType loc (p : pat) = | 230 fun patType loc (p : pat) = |
231 case #1 p of | 231 case #1 p of |
232 PAnnot (_, t) => t | 232 PAnnot (_, t) => t |
233 | _ => (CWild (KType, loc), loc) | 233 | _ => (CWild (KType, loc), loc) |
484 | patS of pat | 484 | patS of pat |
485 | pterm of pat | 485 | pterm of pat |
486 | rpat of (string * pat) list * bool | 486 | rpat of (string * pat) list * bool |
487 | ptuple of pat list | 487 | ptuple of pat list |
488 | 488 |
489 | attrs of exp option * exp option * exp option * exp option * (string * exp) list * (con * exp) list | 489 | attrs of exp option * exp option * exp option * exp option * (string * string * exp) list * (con * exp) list |
490 | attr of attr | 490 | attr of attr |
491 | attrv of exp | 491 | attrv of exp |
492 | 492 |
493 | query of exp | 493 | query of exp |
494 | query1 of exp | 494 | query1 of exp |
1650 | 1650 |
1651 val atts = case #5 attrs of | 1651 val atts = case #5 attrs of |
1652 [] => #6 attrs | 1652 [] => #6 attrs |
1653 | data :: datas => | 1653 | data :: datas => |
1654 let | 1654 let |
1655 fun doOne (name, value) = | 1655 fun doOne (kind, name, value) = |
1656 let | 1656 let |
1657 val e = (EVar (["Basis"], "data_attr", Infer), pos) | 1657 val e = (EVar (["Basis"], "data_attr", Infer), pos) |
1658 val e = (EApp (e, (EVar (["Basis"], kind ^ "_kind", Infer), pos)), pos) | |
1658 val e = (EApp (e, (EPrim (Prim.String name), pos)), pos) | 1659 val e = (EApp (e, (EPrim (Prim.String name), pos)), pos) |
1659 in | 1660 in |
1660 (EApp (e, value), pos) | 1661 (EApp (e, value), pos) |
1661 end | 1662 end |
1662 | 1663 |
1723 | "dynClass" => DynClass attrv | 1724 | "dynClass" => DynClass attrv |
1724 | "style" => Style attrv | 1725 | "style" => Style attrv |
1725 | "dynStyle" => DynStyle attrv | 1726 | "dynStyle" => DynStyle attrv |
1726 | _ => | 1727 | _ => |
1727 if String.isPrefix "data-" SYMBOL then | 1728 if String.isPrefix "data-" SYMBOL then |
1728 Data (String.extract (SYMBOL, 5, NONE), attrv) | 1729 Data ("data", String.extract (SYMBOL, 5, NONE), attrv) |
1730 else if String.isPrefix "aria-" SYMBOL then | |
1731 Data ("aria", String.extract (SYMBOL, 5, NONE), attrv) | |
1729 else | 1732 else |
1730 let | 1733 let |
1731 val sym = makeAttr SYMBOL | 1734 val sym = makeAttr SYMBOL |
1732 in | 1735 in |
1733 Normal ((CName sym, s (SYMBOLleft, SYMBOLright)), | 1736 Normal ((CName sym, s (SYMBOLleft, SYMBOLright)), |