Commit 1ab9aac6ded5e5268246576b27e4387a28711bca

Authored by David RENÉ
1 parent 293b4efa

[+] add some helper for div with one String and with or without CoreAttrs

[+] add to_String function from HTML_Off_Form
[~] some cleanup and remove dead code
Showing 1 changed file with 29 additions and 57 deletions   Show diff stats
web/making_a_web_site.anubis
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 *Copyright* Copyright (c) Alain Prouté 2004-2005. 7 *Copyright* Copyright (c) Alain Prouté 2004-2005.
8 Copyright (c) Calexium 2007-2017. 8 Copyright (c) Calexium 2007-2017.
9 - Copyright (c) David René 2007-2020. 9 + Copyright (c) David René 2007-2021.
10 10
11 11
12 *Authors* Alain Prouté 12 *Authors* Alain Prouté
@@ -1384,6 +1384,10 @@ public define HTML_Off_Form div(HTML_Off_Form content) @@ -1384,6 +1384,10 @@ public define HTML_Off_Form div(HTML_Off_Form content)
1384 public define HTML_Off_Form div(List(CoreAttrs) attrs) = html_tag("div", attrs, []). 1384 public define HTML_Off_Form div(List(CoreAttrs) attrs) = html_tag("div", attrs, []).
1385 public define HTML_Off_Form div(CoreAttrs attr) = html_tag("div", [attr], []). 1385 public define HTML_Off_Form div(CoreAttrs attr) = html_tag("div", [attr], []).
1386 1386
  1387 +public define HTML_Off_Form div(String string) = html_tag("div", [], [text(string)]).
  1388 +public define HTML_Off_Form div(CoreAttrs attr, String string) = html_tag("div", [attr], [text(string)]).
  1389 +public define HTML_Off_Form div(List(CoreAttrs) attrs, String string) = html_tag("div", attrs, [text(string)]).
  1390 +
1387 public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Partial_Content content) = div(attrs, [content]). 1391 public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Partial_Content content) = div(attrs, [content]).
1388 public define HTML_Off_Form div(List(HTML_Partial_Content) content) = div([], content). 1392 public define HTML_Off_Form div(List(HTML_Partial_Content) content) = div([], content).
1389 public define HTML_Off_Form div(CoreAttrs attr, HTML_Partial_Content content) = div([attr], [content]). 1393 public define HTML_Off_Form div(CoreAttrs attr, HTML_Partial_Content content) = div([attr], [content]).
@@ -3660,51 +3664,6 @@ define Printable_tree @@ -3660,51 +3664,6 @@ define Printable_tree
3660 . format(t)] 3664 . format(t)]
3661 }. 3665 }.
3662 3666
3663 - public define String  
3664 - format_attrs  
3665 - (  
3666 - List(CoreAttrs) attributs  
3667 - )=  
3668 - if attributs is  
3669 - {  
3670 - [] then "",  
3671 - [h . t] then  
3672 - with current = if h is  
3673 - {  
3674 - id(id_name) then  
3675 - " id=\"" + id_name + "\"",  
3676 - class(class_name) then  
3677 - " class=\"" + class_name + "\"",  
3678 - style(style_string) then  
3679 - " style=\"" + style_string + "\"",  
3680 -  
3681 - title(title_string) then  
3682 - " title=\"" + title_string + "\"",  
3683 -  
3684 - lang(lang) then  
3685 - " xml:lang=" + lang,  
3686 - dir(reading_Way) then  
3687 - if reading_Way is  
3688 - {  
3689 - ltr then " dir=ltr",  
3690 - rtl then " dir=rtl"  
3691 - },  
3692 -  
3693 - accesskey(key) then  
3694 - " accesskey=\"" + key + "\"",  
3695 - tabindex(index) then  
3696 - " tabindex=\"" + index + "\"",  
3697 -  
3698 - attr(name, value) then  
3699 - " " + name + "=\"" + value + "\"",  
3700 -  
3701 - event(e, value) then  
3702 - " " + event_name(e) + "=\"" + value + "\"",  
3703 - data(name, value) then  
3704 - " data-" + to_lower(name) + "=\"" + value + "\"",  
3705 - },  
3706 - current + format_attrs(t)  
3707 - }.  
3708 3667
3709 define String 3668 define String
3710 format_attrs 3669 format_attrs
@@ -4565,19 +4524,20 @@ define Printable_tree @@ -4565,19 +4524,20 @@ define Printable_tree
4565 4524
4566 4525
4567 define Printable_tree 4526 define Printable_tree
4568 - add_js_files  
4569 - (  
4570 - List(JS_File) l  
4571 - ) =  
4572 - if l is  
4573 - {  
4574 - [ ] then [ ],  
4575 - [h . t] then  
4576 - [ ["<script src=\""+ file_name(h) +"\" type=\"text/javascript\"" 4527 + add_js_files
  4528 + (
  4529 + List(JS_File) l
  4530 + ) =
  4531 + if l is
  4532 + {
  4533 + [ ] then [ ],
  4534 + [h . t] then
  4535 + [ ["<script src=\""+ file_name(h) +"\" type=\"text/javascript\""
4577 . add_js_files_attributes(attributes(h)) ] 4536 . add_js_files_attributes(attributes(h)) ]
4578 . ["></script>\n" 4537 . ["></script>\n"
4579 . add_js_files(t)] ] 4538 . add_js_files(t)] ]
4580 - }. 4539 + }
  4540 +.
4581 4541
4582 define Printable_tree 4542 define Printable_tree
4583 add_script 4543 add_script
@@ -4598,7 +4558,7 @@ define Printable_tree @@ -4598,7 +4558,7 @@ define Printable_tree
4598 4558
4599 if css_styles is 4559 if css_styles is
4600 { 4560 {
4601 - [] then [], 4561 + [] then [],
4602 [_ . _] then [ "<style type=\"text/css\"><!--\n", 4562 [_ . _] then [ "<style type=\"text/css\"><!--\n",
4603 format_css_styles(css_styles), 4563 format_css_styles(css_styles),
4604 " --></style>\n" 4564 " --></style>\n"
@@ -5455,6 +5415,18 @@ public define HTML_ajax_content @@ -5455,6 +5415,18 @@ public define HTML_ajax_content
5455 if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then 5415 if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then
5456 html_ajax_content(to_String(content), script, js_file, css_file). 5416 html_ajax_content(to_String(content), script, js_file, css_file).
5457 5417
  5418 +public define String
  5419 + to_String
  5420 + (
  5421 + HTML_Off_Form content_HTML,
  5422 + CommonInfo cinfo
  5423 + )=
  5424 + //println("to_html_ajax_content(content_HTML, cinfo)");
  5425 + with p_content_head_tags = var((List(HTML_Head_Tag))[]),
  5426 + with content = format(cinfo, var((Int)0), content_HTML, false, var(0), p_content_head_tags),
  5427 + to_String(content)
  5428 +.
  5429 +
5458 5430
5459 public define JsonValue 5431 public define JsonValue
5460 to_html_ajax_content 5432 to_html_ajax_content