Commit afb139a2e34e0ae1f3396a1038081dfc704fd305

Authored by totoro
1 parent d0664ac7

add HTML5 data-

Showing 1 changed file with 12 additions and 7 deletions   Show diff stats
web/CXM_making_a_web_site.anubis
@@ -743,7 +743,9 @@ public type CoreAttrs: @@ -743,7 +743,9 @@ public type CoreAttrs:
743 accesskey (Word8), 743 accesskey (Word8),
744 tabindex (Int), 744 tabindex (Int),
745 attr (String, String), 745 attr (String, String),
746 - event (HtmlEvents, String). 746 + event (HtmlEvents, String),
  747 + //HTML5
  748 + data (String name, String value).
747 749
748 public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). 750 public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false").
749 751
@@ -3288,16 +3290,18 @@ public define String @@ -3288,16 +3290,18 @@ public define String
3288 rtl then " dir=rtl" 3290 rtl then " dir=rtl"
3289 }, 3291 },
3290 3292
3291 - accesskey(key) then 3293 + accesskey(key) then
3292 " accesskey=\"" + key + "\"", 3294 " accesskey=\"" + key + "\"",
3293 - tabindex(index) then 3295 + tabindex(index) then
3294 " tabindex=\"" + index + "\"", 3296 " tabindex=\"" + index + "\"",
3295 3297
3296 attr(name, value) then 3298 attr(name, value) then
3297 " " + name + "=\"" + value + "\"", 3299 " " + name + "=\"" + value + "\"",
3298 3300
3299 - event(e, value) then 3301 + event(e, value) then
3300 " " + event_name(e) + "=\"" + value + "\"", 3302 " " + event_name(e) + "=\"" + value + "\"",
  3303 + data(name, value) then
  3304 + " data-" + to_lower(name) + "=\"" + value + "\"",
3301 }, 3305 },
3302 current + format_attrs(t) 3306 current + format_attrs(t)
3303 }. 3307 }.
@@ -4308,7 +4312,8 @@ define Printable_tree @@ -4308,7 +4312,8 @@ define Printable_tree
4308 ["<input type=\"hidden\" id=\"",id,"\" name=\"",name,"\" value=\"",value,"\" />"], 4312 ["<input type=\"hidden\" id=\"",id,"\" name=\"",name,"\" value=\"",value,"\" />"],
4309 partial(p_content) then 4313 partial(p_content) then
4310 if p_content is partial_content(tags, html_elements) then 4314 if p_content is partial_content(tags, html_elements) then
4311 - head_tags <- tags + *head_tags; 4315 + head_tags <- *head_tags + tags;
  4316 +
4312 format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags) 4317 format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags)
4313 }. 4318 }.
4314 4319
@@ -4497,7 +4502,7 @@ define Printable_tree @@ -4497,7 +4502,7 @@ define Printable_tree
4497 format(cinfo, sn, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), 4502 format(cinfo, sn, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags),
4498 div(options, p_content) then 4503 div(options, p_content) then
4499 if p_content is partial_content(tags, html_elements) then 4504 if p_content is partial_content(tags, html_elements) then
4500 - head_tags <- tags + *head_tags; 4505 + head_tags <- *head_tags +tags;
4501 format(cinfo, sn, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), 4506 format(cinfo, sn, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags),
4502 div_empty(options) then 4507 div_empty(options) then
4503 format(cinfo, sn, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), 4508 format(cinfo, sn, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags),
@@ -4518,7 +4523,7 @@ define Printable_tree @@ -4518,7 +4523,7 @@ define Printable_tree
4518 ], 4523 ],
4519 partial(p_content) then 4524 partial(p_content) then
4520 if p_content is partial_content(tags, html_elements) then 4525 if p_content is partial_content(tags, html_elements) then
4521 - head_tags <- tags + *head_tags; 4526 + head_tags <- *head_tags + tags;
4522 format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags) 4527 format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags)
4523 }. 4528 }.
4524 4529