[154113] trunk/doc-new/toc-for-chunked.tcl

raimue at macports.org raimue at macports.org
Sat Oct 22 03:54:03 CEST 2016


Revision: 154113
          https://trac.macports.org/changeset/154113
Author:   raimue at macports.org
Date:     2016-10-22 03:54:03 +0200 (Sat, 22 Oct 2016)
Log Message:
-----------
guide: escape string for regex replace

Special characters such as '&' could trigger strange behavior as they were
interpreted by the regex engine.

Modified Paths:
--------------
    trunk/doc-new/toc-for-chunked.tcl

Modified: trunk/doc-new/toc-for-chunked.tcl
===================================================================
--- trunk/doc-new/toc-for-chunked.tcl	2016-10-22 01:22:37 UTC (rev 154112)
+++ trunk/doc-new/toc-for-chunked.tcl	2016-10-22 01:54:03 UTC (rev 154113)
@@ -16,7 +16,7 @@
 
     set file [open $path r+]
     set data [read $file]
-    regsub {<body([^>]+)>} $data $replacement data
+    regsub {<body([^>]+)>} $data [regsub -all {\W} $replacement {\\&}] data
     regsub {</body>} $data {</div></body>} data
     seek $file 0
     puts $file $data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-changes/attachments/20161022/c0bd25d7/attachment-0002.html>


More information about the macports-changes mailing list