From 75265fb59e12b464ee95517cd60e3f561280586b Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 4 May 2023 12:07:56 +0900 Subject: [PATCH] add helper (formaction, formmethod, main) for html_tag add button with a String as argument add form without CoreAttrs as argument --- web/making_a_web_site.anubis | 35 ++++++++++++++++++++++++----------- web/types/making_a_web_site.anubis | 15 +++++++++++++-- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/web/making_a_web_site.anubis b/web/making_a_web_site.anubis index 0f5c670..535812a 100644 --- a/web/making_a_web_site.anubis +++ b/web/making_a_web_site.anubis @@ -120,14 +120,6 @@ public define String _HTML_encode_entities(explode(source), []) . -//public define String -// encode_HTML_entities -// ( -// String source -// )= -//. - -//read CXM_html_tooltip.anubis * (1) Structure of a web site. @@ -1302,9 +1294,17 @@ url, week . +public type FormMethod: + get, + post +. //public type HTML_Body:... +public define CoreAttrs formaction(WEB_Action_Name action, List((String,String)) extra_ops) = attr("formaction", format_web_action_name(action, extra_ops)). +public define CoreAttrs formaction(WEB_Action_Name action, (String,String) extra_op) = attr("formaction", format_web_action_name(action, extra_op)). +public define CoreAttrs formaction(WEB_Action_Name action) = attr("formaction", format_web_action_name(action)). +public define CoreAttrs formmethod(FormMethod method) = attr("formmethod", if method is { get then "get", post then "post"}). 'HTML_Off_Form' defines all the elements you may put outside any form. @@ -1357,6 +1357,7 @@ public define HTML_Off_Form button(List(CoreAttrs) attrs, HTML_Off_Form content) public define HTML_Off_Form button(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("button", [attr], content). public define HTML_Off_Form button(CoreAttrs attr, HTML_Off_Form content) = html_tag("button", [attr], [content]). public define HTML_Off_Form button(List(CoreAttrs) attrs) = html_tag("button", attrs, []). +public define HTML_Off_Form button(List(CoreAttrs) attrs, String string) = html_tag("button", attrs, [text(string)]). public define HTML_Off_Form button(List(HTML_Off_Form) content) = html_tag("button", [], content). public define HTML_Off_Form button(HTML_Off_Form content) = html_tag("button", [], [content]). @@ -1444,6 +1445,8 @@ public define HTML_Off_Form form(CoreAttrs attr, List(HTML_Off_Form) content) public define HTML_Off_Form form(CoreAttrs attr, HTML_Off_Form content) = html_tag("form", [attr], [content]). public define HTML_Off_Form form(List(CoreAttrs) attrs) = html_tag("form", attrs, []). public define HTML_Off_Form form(CoreAttrs attr) = html_tag("form", [attr], []). +public define HTML_Off_Form form(List(HTML_Off_Form) content) = html_tag("form", [], content). +public define HTML_Off_Form form(HTML_Off_Form content) = html_tag("form", [], [content]). //
public define HTML_Off_Form header(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("header", attrs, content). @@ -1490,9 +1493,9 @@ public define HTML_Off_Form hr(CoreAttrs attr) //