diff --git a/web/making_a_web_site.anubis b/web/making_a_web_site.anubis index bb663c6..e34f02f 100644 --- a/web/making_a_web_site.anubis +++ b/web/making_a_web_site.anubis @@ -120,6 +120,50 @@ public define String _HTML_encode_entities(explode(source), []) . +define List(Word8) +/** Test for HTML entity which must be encoded + * and return the encoded entity if needed + */ + get_entity_quote + ( + Word8 _char, + List(Word8) tail + )= + //test for the ampersand + if _char = '&' then + //test if it's already an encoded string like & < etc. In that case we do nothing + if insensitive_equal(['&','a','m','p',';'], tail, 0) then [_char] + else if insensitive_equal(['&','l','t',';'], tail, 0) then [_char] + else if insensitive_equal(['&','g','t',';'], tail, 0) then [_char] + else if insensitive_equal(['&','q','u','o','t',';'], tail, 0) then [_char] + else + [';','p','m','a','&'] + //test for '"' only. + else if _char = '\"' then [';','t','o','u','q','&'] + else [_char] +. + +define String + _HTML_encode_quote + ( + List(Word8) source, + List(Word8) current + )= + if source is + { + [] then implode(reverse(current)), + [c . t] then + _HTML_encode_quote(t, get_entity_quote(c, t) + current) + } +. + +public define String + encode_HTML_quote + ( + String source + )= + _HTML_encode_quote(explode(source), []) +. * (1) Structure of a web site. @@ -1562,6 +1606,7 @@ public define HTML_Off_Form label(List(CoreAttrs) attrs, String string) //
  • public define HTML_Off_Form li(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("li", attrs, content). public define HTML_Off_Form li(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("li", attrs, [content]). +public define HTML_Off_Form li(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("li", [attr], content). public define HTML_Off_Form li(CoreAttrs attr, HTML_Off_Form content) = html_tag("li", [attr], [content]). public define HTML_Off_Form li(List(HTML_Off_Form) content) = html_tag("li", [], content). public define HTML_Off_Form li(HTML_Off_Form content) = html_tag("li", [], [content]). @@ -5254,9 +5299,12 @@ define Printable_tree format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), // div_empty(options) then // format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), - iframe(options, css_styles, css_files, js_files, body) then + iframe(options, css_styles, css_files, js_files, body) then + println("formating iframe"); if body is body(body_options,elem) then - [ "\n", + [ "\n", "\n", add_css_styles(css_styles), @@ -5266,8 +5314,9 @@ define Printable_tree "\n", // format body options format(cinfo,ic_v,elem,is_https, action_count, head_tags), "\n", - "\n", - "\n", + "\n",])), + + "\">\n", ], partial(p_content) then if p_content is partial_content(tags, html_elements) then -- libgit2 0.21.4