From 8c047fec1fc05fb07e9b6970e4e46de9c5a682b0 Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 16 Nov 2014 13:54:51 +0100 Subject: [PATCH] fix the generation of style and class into single string for each instead of multiple string which is wrong --- web/CXM_making_a_web_site.anubis | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 871a174..d650161 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -3302,19 +3302,22 @@ public define String define String format_attrs ( - List(InputAttrs) attributs + List(InputAttrs) attributs, + List(String) classes, + List(String) styles )= if attributs is { - [] then "", - [h . t] then + [] then + if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\""+ + if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"", + [h . t] then with current = if h is { - class(class_name) then - " class=\"" + class_name + "\"", + class(class_name) then + format_attrs(t, [class_name. classes], styles), style(style_string) then - " style=\"" + style_string + "\"", - + format_attrs(t, classes, [style_string . styles]), title(title_string) then " title=\"" + title_string + "\"", @@ -3338,9 +3341,16 @@ define String event(e, value) then " " + event_name(e) + "=\"" + value + "\"", }, - current + format_attrs(t) + current + format_attrs(t, classes, styles) }. +define String + format_attrs + ( + List(InputAttrs) attributs + )= + format_attrs(attributs, [], []). + define String format_text_options ( -- libgit2 0.21.4