This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git

commit d622aaf88c9a92c2cc80f26c0b1f81aa6e75fbfd
Author: Massimo Manghi <mxman...@apache.org>
AuthorDate: Fri Aug 17 17:00:26 2018 +0200

    now git ignores also files generated by the test suite
---
 .gitignore              | 10 ++++++++++
 rivet/rivet-tcl/xml.tcl | 16 +++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 36d207d..d6f9347 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,13 @@ stamp-h1
 *.la
 *.swp
 tags
+tests/access_log
+tests/apachelog.txt
+tests/error_log
+tests/htaccess2
+tests/httpd.pid
+tests/redirect_code.txt
+tests/rivet/
+tests/server.conf
+tests/test.conf
+tests/uploadedjpeg.jpg
diff --git a/rivet/rivet-tcl/xml.tcl b/rivet/rivet-tcl/xml.tcl
index 2f3fa58..cb18c04 100644
--- a/rivet/rivet-tcl/xml.tcl
+++ b/rivet/rivet-tcl/xml.tcl
@@ -40,6 +40,7 @@ namespace eval ::rivet {
             }
 
             append xmlout ">"
+            set last_elem_attr $el
         }
 
 
@@ -50,12 +51,21 @@ namespace eval ::rivet {
         } else {
 
             if {$textstring == ""} {
-                set xmlout [string replace $xmlout end end " />"]
-                return [append xmlout "</[join [lreverse [lrange $tags_stack 0 
end-1]] "></"]>"]
+
+                if {[llength $last_elem_attr]} { 
+                    set closing_seq "/>"
+                } else {
+                    set closing_seq " />"
+                }
+                set xmlout [string replace $xmlout end end $closing_seq]
+                if {[llength $tags_stack] > 1} {
+                    set xmlout [append xmlout "</[join [lreverse [lrange 
$tags_stack 0 end-1]] "></"]>"]
+                }
+                return $xmlout
+
             }
             return [append xmlout "$textstring</[join [lreverse $tags_stack] 
"></"]>"]
 
         }
     }
-
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@tcl.apache.org
For additional commands, e-mail: commits-h...@tcl.apache.org

Reply via email to