Commit 636f0722f43e2cb44d84ebdb41165e744c6410ec
1 parent
06717abc
No longer generate <span> </span> if the function text() doesn't have optional parameter.
Showing
1 changed file
with
68 additions
and
64 deletions
Show diff stats
web/CXM_making_a_web_site.anubis
| @@ -3924,70 +3924,74 @@ define Printable_tree | @@ -3924,70 +3924,74 @@ define Printable_tree | ||
| 3924 | // The function below formats a datum of type 'HTML_Any($T)'. | 3924 | // The function below formats a datum of type 'HTML_Any($T)'. |
| 3925 | 3925 | ||
| 3926 | define Printable_tree | 3926 | define Printable_tree |
| 3927 | - format | ||
| 3928 | - ( | ||
| 3929 | - CommonInfo cinfo, | ||
| 3930 | - String sn, // state_name | ||
| 3931 | - Var(Int) ic_v, | ||
| 3932 | - HTML_Any($T) element, | ||
| 3933 | - $T -> Printable_tree format_element, // able to format a datum of type $T | ||
| 3934 | - Bool is_https, | ||
| 3935 | - ) = | ||
| 3936 | - if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | ||
| 3937 | - if element is | ||
| 3938 | - { | ||
| 3939 | - any_text(opts,t) then | ||
| 3940 | - ["<span", format_text_options(opts), ">",t,"</span>"], | ||
| 3941 | - any_preformated(opts,s) then | ||
| 3942 | - ["<span", format_text_options(opts), "><pre>",s,"</pre></span>"], | ||
| 3943 | - //["<pre>",s,"</pre>"], | ||
| 3944 | - any_paragraph(opts,e) then | ||
| 3945 | - ["<p", format_text_options(opts), ">",format_element(e),"</p>\n"], | ||
| 3946 | - any_image(opts, url, alt) then | ||
| 3947 | - ["<img alt=\"",alt,"\" src=\"",url,"\" ", format_attrs(opts)," />"], | ||
| 3948 | - any_image(opts, url, alt, w, h) then | ||
| 3949 | - ["<img alt=\"",alt,"\" src=\"",url,"\" width=\"",w,"\" height=\"",h,"\" ", format_attrs(opts)," />"], | ||
| 3950 | - any_table(opts,h_row, rows, f_row) then | ||
| 3951 | - ["<table",format(reverse(opts),false),">", | ||
| 3952 | - format(h_row, format_element), | ||
| 3953 | - "<tbody>",format(rows,format_element),"</tbody>", | ||
| 3954 | - format(f_row, format_element), | ||
| 3955 | - "</table>\n"], | ||
| 3956 | - any_center(e) then | ||
| 3957 | - ["<center>",format_element(e),"</center>"], | ||
| 3958 | - any_mail_to(email,elem) then | ||
| 3959 | - ["<a href=\"mailto:",email,"\">",format_element(elem),"</a>"], | ||
| 3960 | - any_scroller(w,h,cw,ch,c) then | ||
| 3961 | - format_scroller(sn,w,h,cw,ch,new_idnum(ic_v),c,format_element), | ||
| 3962 | - any_fixed_size(w,h,c) then | ||
| 3963 | - with url = create_secondary_document(site_directory,secret,sn,format_element,c,w), | ||
| 3964 | - ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | ||
| 3965 | - "secondary document", | ||
| 3966 | - "</object>"], | ||
| 3967 | - any_fixed_size_2(w,h,fn) then | ||
| 3968 | - with url = fn+"?zauth="+make_authorization(site_directory,secret, | ||
| 3969 | - fn), | ||
| 3970 | - ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | ||
| 3971 | - "secondary document", | ||
| 3972 | - "</object>"], | ||
| 3973 | - any_actioner(c,t,a,an,eo,ja,fn) then | ||
| 3974 | - format_actioner(cinfo,sn,c,t,a,an,eo,ja,fn,is_https), | ||
| 3975 | - | ||
| 3976 | - any_foreign_link_new(target, aspect, url) then | ||
| 3977 | - format_foreign_link(target, aspect, url, is_https), | ||
| 3978 | - | ||
| 3979 | - any_foreign_link(options,url) then | ||
| 3980 | - ["<a href=\"",url,"\" ", format_text_options(options), "></a>"], // IE7 doesn't support the form <a href="..." /> | ||
| 3981 | - any_foreign_link(options,url,name) then | ||
| 3982 | - ["<a href=\"",url,"\"><span ", format_text_options(options), ">",name,"</span></a>"], | ||
| 3983 | - any_private_download(url,name,extra_ext,action) then | ||
| 3984 | - format_private_download(cinfo,sn,url,name,extra_ext,action), | ||
| 3985 | - any_div(options, e) then | ||
| 3986 | - [format_div_option(options), format_element(e),"</div>\n"], | ||
| 3987 | - any_div_empty(options) then | ||
| 3988 | - [format_div_option(options), "</div>\n"], | ||
| 3989 | - any_coreattrs(attributs) then | ||
| 3990 | - [format_attrs(attributs)] | 3927 | + format |
| 3928 | + ( | ||
| 3929 | + CommonInfo cinfo, | ||
| 3930 | + String sn, // state_name | ||
| 3931 | + Var(Int) ic_v, | ||
| 3932 | + HTML_Any($T) element, | ||
| 3933 | + $T -> Printable_tree format_element, // able to format a datum of type $T | ||
| 3934 | + Bool is_https, | ||
| 3935 | + ) = | ||
| 3936 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | ||
| 3937 | + if element is | ||
| 3938 | + { | ||
| 3939 | + any_text(opts , t) then | ||
| 3940 | + if opts is | ||
| 3941 | + { | ||
| 3942 | + [] then [t], | ||
| 3943 | + [_ . _] then ["<span", format_text_options(opts), ">",t,"</span>"] | ||
| 3944 | + }, | ||
| 3945 | + any_preformated(opts,s) then | ||
| 3946 | + ["<span", format_text_options(opts), "><pre>",s,"</pre></span>"], | ||
| 3947 | + //["<pre>",s,"</pre>"], | ||
| 3948 | + any_paragraph(opts,e) then | ||
| 3949 | + ["<p", format_text_options(opts), ">",format_element(e),"</p>\n"], | ||
| 3950 | + any_image(opts, url, alt) then | ||
| 3951 | + ["<img alt=\"",alt,"\" src=\"",url,"\" ", format_attrs(opts)," />"], | ||
| 3952 | + any_image(opts, url, alt, w, h) then | ||
| 3953 | + ["<img alt=\"",alt,"\" src=\"",url,"\" width=\"",w,"\" height=\"",h,"\" ", format_attrs(opts)," />"], | ||
| 3954 | + any_table(opts,h_row, rows, f_row) then | ||
| 3955 | + ["<table",format(reverse(opts),false),">", | ||
| 3956 | + format(h_row, format_element), | ||
| 3957 | + "<tbody>",format(rows,format_element),"</tbody>", | ||
| 3958 | + format(f_row, format_element), | ||
| 3959 | + "</table>\n"], | ||
| 3960 | + any_center(e) then | ||
| 3961 | + ["<center>",format_element(e),"</center>"], | ||
| 3962 | + any_mail_to(email,elem) then | ||
| 3963 | + ["<a href=\"mailto:",email,"\">",format_element(elem),"</a>"], | ||
| 3964 | + any_scroller(w,h,cw,ch,c) then | ||
| 3965 | + format_scroller(sn,w,h,cw,ch,new_idnum(ic_v),c,format_element), | ||
| 3966 | + any_fixed_size(w,h,c) then | ||
| 3967 | + with url = create_secondary_document(site_directory,secret,sn,format_element,c,w), | ||
| 3968 | + ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | ||
| 3969 | + "secondary document", | ||
| 3970 | + "</object>"], | ||
| 3971 | + any_fixed_size_2(w,h,fn) then | ||
| 3972 | + with url = fn+"?zauth="+make_authorization(site_directory,secret, | ||
| 3973 | + fn), | ||
| 3974 | + ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | ||
| 3975 | + "secondary document", | ||
| 3976 | + "</object>"], | ||
| 3977 | + any_actioner(c,t,a,an,eo,ja,fn) then | ||
| 3978 | + format_actioner(cinfo,sn,c,t,a,an,eo,ja,fn,is_https), | ||
| 3979 | + | ||
| 3980 | + any_foreign_link_new(target, aspect, url) then | ||
| 3981 | + format_foreign_link(target, aspect, url, is_https), | ||
| 3982 | + | ||
| 3983 | + any_foreign_link(options,url) then | ||
| 3984 | + ["<a href=\"",url,"\" ", format_text_options(options), "></a>"], // IE7 doesn't support the form <a href="..." /> | ||
| 3985 | + any_foreign_link(options,url,name) then | ||
| 3986 | + ["<a href=\"",url,"\"><span ", format_text_options(options), ">",name,"</span></a>"], | ||
| 3987 | + any_private_download(url,name,extra_ext,action) then | ||
| 3988 | + format_private_download(cinfo,sn,url,name,extra_ext,action), | ||
| 3989 | + any_div(options, e) then | ||
| 3990 | + [format_div_option(options), format_element(e),"</div>\n"], | ||
| 3991 | + any_div_empty(options) then | ||
| 3992 | + [format_div_option(options), "</div>\n"], | ||
| 3993 | + any_coreattrs(attributs) then | ||
| 3994 | + [format_attrs(attributs)] | ||
| 3991 | }. | 3995 | }. |
| 3992 | 3996 | ||
| 3993 | 3997 |