From 1ab9aac6ded5e5268246576b27e4387a28711bca Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 27 Nov 2021 08:03:14 +0100 Subject: [PATCH] [+] 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 --- web/making_a_web_site.anubis | 86 +++++++++++++++++++++++++++++--------------------------------------------------------- 1 file changed, 29 insertions(+), 57 deletions(-) diff --git a/web/making_a_web_site.anubis b/web/making_a_web_site.anubis index 5a37743..a261611 100644 --- a/web/making_a_web_site.anubis +++ b/web/making_a_web_site.anubis @@ -6,7 +6,7 @@ *Copyright* Copyright (c) Alain Prouté 2004-2005. Copyright (c) Calexium 2007-2017. - Copyright (c) David René 2007-2020. + Copyright (c) David René 2007-2021. *Authors* Alain Prouté @@ -1384,6 +1384,10 @@ public define HTML_Off_Form div(HTML_Off_Form content) public define HTML_Off_Form div(List(CoreAttrs) attrs) = html_tag("div", attrs, []). public define HTML_Off_Form div(CoreAttrs attr) = html_tag("div", [attr], []). +public define HTML_Off_Form div(String string) = html_tag("div", [], [text(string)]). +public define HTML_Off_Form div(CoreAttrs attr, String string) = html_tag("div", [attr], [text(string)]). +public define HTML_Off_Form div(List(CoreAttrs) attrs, String string) = html_tag("div", attrs, [text(string)]). + public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Partial_Content content) = div(attrs, [content]). public define HTML_Off_Form div(List(HTML_Partial_Content) content) = div([], content). public define HTML_Off_Form div(CoreAttrs attr, HTML_Partial_Content content) = div([attr], [content]). @@ -3660,51 +3664,6 @@ define Printable_tree . format(t)] }. - public define String - format_attrs - ( - List(CoreAttrs) attributs - )= - if attributs is - { - [] then "", - [h . t] then - with current = if h is - { - id(id_name) then - " id=\"" + id_name + "\"", - class(class_name) then - " class=\"" + class_name + "\"", - style(style_string) then - " style=\"" + style_string + "\"", - - title(title_string) then - " title=\"" + title_string + "\"", - - lang(lang) then - " xml:lang=" + lang, - dir(reading_Way) then - if reading_Way is - { - ltr then " dir=ltr", - rtl then " dir=rtl" - }, - - accesskey(key) then - " accesskey=\"" + key + "\"", - tabindex(index) then - " tabindex=\"" + index + "\"", - - attr(name, value) then - " " + name + "=\"" + value + "\"", - - event(e, value) then - " " + event_name(e) + "=\"" + value + "\"", - data(name, value) then - " data-" + to_lower(name) + "=\"" + value + "\"", - }, - current + format_attrs(t) - }. define String format_attrs @@ -4565,19 +4524,20 @@ define Printable_tree define Printable_tree - add_js_files - ( - List(JS_File) l - ) = - if l is - { - [ ] then [ ], - [h . t] then - [ ["\n" . add_js_files(t)] ] - }. + } +. define Printable_tree add_script @@ -4598,7 +4558,7 @@ define Printable_tree if css_styles is { - [] then [], + [] then [], [_ . _] then [ "\n" @@ -5455,6 +5415,18 @@ public define HTML_ajax_content if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then html_ajax_content(to_String(content), script, js_file, css_file). +public define String + to_String + ( + HTML_Off_Form content_HTML, + CommonInfo cinfo + )= + //println("to_html_ajax_content(content_HTML, cinfo)"); + with p_content_head_tags = var((List(HTML_Head_Tag))[]), + with content = format(cinfo, var((Int)0), content_HTML, false, var(0), p_content_head_tags), + to_String(content) +. + public define JsonValue to_html_ajax_content -- libgit2 0.21.4