Index: openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 17 Aug 2012 08:00:21 -0000 1.20 +++ openacs-4/packages/xowiki/tcl/xowiki-utility-procs.tcl 21 Aug 2012 15:43:32 -0000 1.21 @@ -639,13 +639,26 @@ set cmdName [lindex $spec 0] lassign $spec cmdName atts inner_spec + + # We need to handle text nodes in a better way + # but our corresponding javascript function, + # i.e. wu.repeatable.createDom does not support it + # at the moment (August 2012) + if { $cmdName eq "\#text" } { continue } + set json "\{'tag':[util_jsquotevalue $cmdName]" if { $atts ne {} } { append json ",[util_map2json $atts]" } if { $inner_spec ne {} } { lassign [lindex $inner_spec 0] nodeType text - if { ${nodeType} eq "\#text" } { + # llength needs to go, please see comment above + # it would give us trouble if we have spec that starts with + # a text node but is then followed by element nodes, e.g. + # e.g. text node, element node 1, element node 2, and so on + # would give us trouble - we choose to ignore text nodes + # in this case + if { ${nodeType} eq "\#text" && [llength $inner_spec] == 1 } { # text node lassign [lindex $inner_spec 0] _nodeType_ text append json ",'html':[util_jsquotevalue $text]" @@ -660,4 +673,11 @@ return [join $result {,}] } +proc util_tdom2list {script {rootTag "div"}} { + set doc [dom createDocument $rootTag] + set root [$doc documentElement] + $root appendFromScript {uplevel $script} + return [$root asList] +} + ::xo::library source_dependent \ No newline at end of file