Commit 8c047fec1fc05fb07e9b6970e4e46de9c5a682b0

Authored by totoro
1 parent 025cb599

fix the generation of style and class into single string for each instead of mul…

…tiple string which is wrong
Showing 1 changed file with 18 additions and 8 deletions   Show diff stats
web/CXM_making_a_web_site.anubis
@@ -3302,19 +3302,22 @@ public define String @@ -3302,19 +3302,22 @@ public define String
3302 define String 3302 define String
3303 format_attrs 3303 format_attrs
3304 ( 3304 (
3305 - List(InputAttrs) attributs 3305 + List(InputAttrs) attributs,
  3306 + List(String) classes,
  3307 + List(String) styles
3306 )= 3308 )=
3307 if attributs is 3309 if attributs is
3308 { 3310 {
3309 - [] then "",  
3310 - [h . t] then 3311 + [] then
  3312 + if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\""+
  3313 + if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"",
  3314 + [h . t] then
3311 with current = if h is 3315 with current = if h is
3312 { 3316 {
3313 - class(class_name) then  
3314 - " class=\"" + class_name + "\"", 3317 + class(class_name) then
  3318 + format_attrs(t, [class_name. classes], styles),
3315 style(style_string) then 3319 style(style_string) then
3316 - " style=\"" + style_string + "\"",  
3317 - 3320 + format_attrs(t, classes, [style_string . styles]),
3318 title(title_string) then 3321 title(title_string) then
3319 " title=\"" + title_string + "\"", 3322 " title=\"" + title_string + "\"",
3320 3323
@@ -3338,9 +3341,16 @@ define String @@ -3338,9 +3341,16 @@ define String
3338 event(e, value) then 3341 event(e, value) then
3339 " " + event_name(e) + "=\"" + value + "\"", 3342 " " + event_name(e) + "=\"" + value + "\"",
3340 }, 3343 },
3341 - current + format_attrs(t) 3344 + current + format_attrs(t, classes, styles)
3342 }. 3345 }.
3343 3346
  3347 +define String
  3348 + format_attrs
  3349 + (
  3350 + List(InputAttrs) attributs
  3351 + )=
  3352 + format_attrs(attributs, [], []).
  3353 +
3344 define String 3354 define String
3345 format_text_options 3355 format_text_options
3346 ( 3356 (