Commit 2ca4d41ab309a6210188084081cb031eb56c0073

Authored by totoro
1 parent d8b4ae2b

improve h tags with list of HTML_Off_Form

Showing 1 changed file with 70 additions and 37 deletions   Show diff stats
web/CXM_making_a_web_site.anubis
... ... @@ -1733,11 +1733,40 @@ public type HTML_Off_Form:
1733 1733 button (List(CoreAttrs), List(HTML_Off_Form) content),
1734 1734 i (List(CoreAttrs), String text),
1735 1735 span (List(CoreAttrs), String text),
1736   - hr (List(CoreAttrs))
  1736 + hr (List(CoreAttrs)),
  1737 + h1 (List(CoreAttrs), List(HTML_Off_Form) content),
  1738 + h2 (List(CoreAttrs), List(HTML_Off_Form) content),
  1739 + h3 (List(CoreAttrs), List(HTML_Off_Form) content),
  1740 + h4 (List(CoreAttrs), List(HTML_Off_Form) content),
  1741 + h5 (List(CoreAttrs), List(HTML_Off_Form) content),
  1742 + h6 (List(CoreAttrs), List(HTML_Off_Form) content)
1737 1743 .
1738 1744  
1739 1745 'HTML_Off_Form' defines all the elements you may put outside any form.
1740 1746  
  1747 +public define HTML_Off_Form h1(HTML_Off_Form content) = h1([], [content]).
  1748 +public define HTML_Off_Form h1(List(HTML_Off_Form) content) = h1([], content).
  1749 +public define HTML_Off_Form h1(List(CoreAttrs) attrs, HTML_Off_Form content) = h1(attrs, [content]).
  1750 +
  1751 +public define HTML_Off_Form h2(HTML_Off_Form content) = h2([], [content]).
  1752 +public define HTML_Off_Form h2(List(HTML_Off_Form) content) = h2([], content).
  1753 +public define HTML_Off_Form h2(List(CoreAttrs) attrs, HTML_Off_Form content) = h2(attrs, [content]).
  1754 +
  1755 +public define HTML_Off_Form h3(HTML_Off_Form content) = h3([], [content]).
  1756 +public define HTML_Off_Form h3(List(HTML_Off_Form) content) = h3([], content).
  1757 +public define HTML_Off_Form h3(List(CoreAttrs) attrs, HTML_Off_Form content) = h3(attrs, [content]).
  1758 +
  1759 +public define HTML_Off_Form h4(HTML_Off_Form content) = h4([], [content]).
  1760 +public define HTML_Off_Form h4(List(HTML_Off_Form) content) = h4([], content).
  1761 +public define HTML_Off_Form h4(List(CoreAttrs) attrs, HTML_Off_Form content) = h4(attrs, [content]).
  1762 +
  1763 +public define HTML_Off_Form h5(HTML_Off_Form content) = h5([], [content]).
  1764 +public define HTML_Off_Form h5(List(HTML_Off_Form) content) = h5([], content).
  1765 +public define HTML_Off_Form h5(List(CoreAttrs) attrs, HTML_Off_Form content) = h5(attrs, [content]).
  1766 +
  1767 +public define HTML_Off_Form h6(HTML_Off_Form content) = h6([], [content]).
  1768 +public define HTML_Off_Form h6(List(HTML_Off_Form) content) = h6([], content).
  1769 +public define HTML_Off_Form h6(List(CoreAttrs) attrs, HTML_Off_Form content) = h6(attrs, [content]).
1741 1770  
1742 1771 public define HTML_Off_Form image(String url) = image([], url, url).
1743 1772 public define HTML_Off_Form image(List(CoreAttrs) attrs, String url) = image(attrs, url, url).
... ... @@ -3934,16 +3963,17 @@ public define String
3934 3963 ).
3935 3964  
3936 3965 public define String
3937   - format_extra_operands
3938   - (
3939   - List((String,String)) l
3940   - ) =
3941   - if l is
3942   - {
3943   - [ ] then "",
3944   - [h . t] then if h is (n,v) then
3945   - "&"+n+"="+v+format_extra_operands(t)
3946   - }.
  3966 + format_extra_operands
  3967 + (
  3968 + List((String,String)) l
  3969 + ) =
  3970 + if l is
  3971 + {
  3972 + [ ] then "",
  3973 + [h . t] then if h is (n,v) then
  3974 + "&"+n+"="+v+format_extra_operands(t)
  3975 + }
  3976 +.
3947 3977  
3948 3978  
3949 3979 It seams that the standard requires "&" instead of "&" !
... ... @@ -3951,21 +3981,22 @@ public define String
3951 3981 In case the target is another window, we need to format the options for this window.
3952 3982  
3953 3983 define String
3954   - format
3955   - (
3956   - List(Other_Window_Option) l
3957   - ) =
3958   - if l is
3959   - {
3960   - [ ] then "",
3961   - [h . t] then if h is
3962   - {
3963   - resizable then "resizable",
3964   - scrollbars then "scrollbars",
3965   - width(w) then "width="+w,
3966   - height(h2) then "height="+h2
3967   - } + if t is [ ] then "" else (","+format(t))
3968   - }.
  3984 + format
  3985 + (
  3986 + List(Other_Window_Option) l
  3987 + ) =
  3988 + if l is
  3989 + {
  3990 + [ ] then "",
  3991 + [h . t] then if h is
  3992 + {
  3993 + resizable then "resizable",
  3994 + scrollbars then "scrollbars",
  3995 + width(w) then "width="+w,
  3996 + height(h2) then "height="+h2
  3997 + } + if t is [ ] then "" else (","+format(t))
  3998 + }
  3999 +.
3969 4000  
3970 4001  
3971 4002  
... ... @@ -3991,7 +4022,7 @@ public define Printable_tree
3991 4022 ) =
3992 4023 if l is
3993 4024 {
3994   - [ ] then [ ],
  4025 + [ ] then [ ],
3995 4026 [h . t] then if h = selected.value
3996 4027 then ["<option selected=\"selected\">", h, "</option>\n" . format_choices(t)]
3997 4028 else ["<option>", h, "</option>\n" . format_choices(t,selected)]
... ... @@ -4251,10 +4282,10 @@ define List(CoreAttrs)
4251 4282 .
4252 4283  
4253 4284 define Printable_tree
4254   - format
4255   - (
4256   - List(Actioner_Local_Action) l
4257   - ) =
  4285 + format
  4286 + (
  4287 + List(Actioner_Local_Action) l
  4288 + ) =
4258 4289 if l is
4259 4290 {
4260 4291 [ ] then [ ],
... ... @@ -5782,12 +5813,14 @@ define Printable_tree
5782 5813 format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags),
5783 5814 hr(opts) then
5784 5815 format(cinfo,ic_v,any_hr(opts),format_element,is_https, action_count, head_tags),
5785   -
5786   - }.
5787   -
5788   -
5789   -
5790   -
  5816 + h1(opts, l) then ["<h1", format_attrs(opts), ">",flat(map(format_element,l)),"</h1>\n"],
  5817 + h2(opts, l) then ["<h2", format_attrs(opts), ">",flat(map(format_element,l)),"</h2>\n"],
  5818 + h3(opts, l) then ["<h3", format_attrs(opts), ">",flat(map(format_element,l)),"</h3>\n"],
  5819 + h4(opts, l) then ["<h4", format_attrs(opts), ">",flat(map(format_element,l)),"</h4>\n"],
  5820 + h5(opts, l) then ["<h5", format_attrs(opts), ">",flat(map(format_element,l)),"</h5>\n"],
  5821 + h6(opts, l) then ["<h6", format_attrs(opts), ">",flat(map(format_element,l)),"</h6>\n"],
  5822 + }.
  5823 +
5791 5824 *** [5.10] Formating meta-tags.
5792 5825  
5793 5826 define Printable_tree
... ...