Tk Library Source Code

Artifact [edab7a22d0]
Login

Artifact edab7a22d059bcb9910d3f5c97adec5044757972:

Attachment "htmlparse-backslash.patch" to ticket [861277ffff] added by jenglish 2003-12-17 04:20:50.
? a.out
Index: htmlparse.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/htmlparse/htmlparse.tcl,v
retrieving revision 1.13
diff -u -r1.13 htmlparse.tcl
--- htmlparse.tcl	24 Oct 2003 19:39:36 -0000	1.13
+++ htmlparse.tcl	16 Dec 2003 21:19:54 -0000
@@ -378,7 +378,7 @@
     # Protect characters special to tcl (braces, slashes) by
     # converting them to their escape sequences.
 
-    return [string map [list "\{" "&ob;" "\}" "&cb;" "\\\\" "&bsl;"] $html]
+    return [string map [list "\{" "&ob;" "\}" "&cb;" "\\" "&bsl;"] $html]
 }
 
 
Index: htmlparse.test
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/htmlparse/htmlparse.test,v
retrieving revision 1.3
diff -u -r1.3 htmlparse.test
--- htmlparse.test	15 Aug 2003 03:51:30 -0000	1.3
+++ htmlparse.test	16 Dec 2003 21:19:54 -0000
@@ -252,6 +252,17 @@
     set tx
 } {{0 root} {1 head} {2 title} {3 PCDATA} {1 body} {2 h2} {3 PCDATA} {3 p} {4 PCDATA} {3 p}}
 
+# Bug #861277
+test htmlparse-6.1 {Backslashes in content} {
+    set tags [list]
+    htmlparse::parse -cmd cb -vroot html "<p>\\</p>"
+    set tags
+} [list \
+    [list html  {} {} {}] \
+    [list p     {} {} {&bsl;}] \
+    [list p     /  {} {}] \
+    [list html  /  {} {}] ]
+
 
 # Take a look at the cache.
 #parray ::htmlparse::splitdata