]> Git repositories of Nishi - koakuma.git/commitdiff
allow newline
authorNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 08:00:45 +0000 (08:00 +0000)
committerNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 08:00:45 +0000 (08:00 +0000)
git-svn-id: file:///raid/svn-personal/koakuma/trunk@22 219d0f9c-2d94-d447-890a-813e76b88fe9

koakuma.cgi.in

index 19a7c55322f1c463409da56f4de9e1c31e96d795..b9d260a1c23af8a8dc91ac6a6b9bf63e3c918261 100644 (file)
@@ -170,8 +170,9 @@ proc tputs {data} {
 }
 
 proc html_escape {data} {
-       set tmp "[regsub -all {<} "[regsub -all {>} "$data" {\&gt;}]" {\&lt;}]"
-       return "[regsub -all {[^: ]+://[^ ]+} "$tmp" {<a href="\0">\0</a>}]"
+       set tmp "[regsub -all {<} "[regsub -all {>} "[string trim "$data"]" {\&gt;}]" {\&lt;}]"
+       set link "[regsub -all {[^: ]+://[^ \n]+} "$tmp" {<a href="\0">\0</a>}]"
+       return "[regsub -all {\n} "$link" {<br>}]"
 }
 
 proc open_projects {} {