Index: openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 15 Sep 2002 22:10:50 -0000 1.9
+++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 30 Nov 2002 17:23:55 -0000 1.10
@@ -46,17 +46,23 @@
regsub -nocase -all {([^a-zA-Z0-9]+)(ftp://[^\(\)"<>\s]+)} $text "\\1\tsTaRtUrL\\2eNdUrL\t" text
# email links have the form xxx@xxx.xxx
- regsub -nocase -all {([^a-zA-Z0-9]+)([^\(\)\s:;,@<>]+@[^\(\)\s.:;,@<>]+[.][^\(\)\s:;,@<>]+)} $text \
- "\\1\tsTaRtEmAiL\\2eNdEmAiL\t" text
+ # JCD: don't treat things =xxx@xxx.xxx as email since most
+ # common occurance seems to be in urls (although VPATH bounce
+ # emails like bounce-user=domain.com@sourcehost.com will then not
+ # work correctly). It's all quite ugly.
+
+ regsub -nocase -all {([^a-zA-Z0-9=]+)(mailto:)?([^=\(\)\s:;,@<>]+@[^\(\)\s.:;,@<>]+[.][^\(\)\s:;,@<>]+)} $text \
+ "\\1\tsTaRtEmAiL\\3eNdEmAiL\t" text
+
}
# At this point, before inserting some of our own <, >, and "'s
# we quote the ones entered by the user:
set text [ad_quotehtml $text]
# Convert _single_ CRLF's to
's to preserve line breaks
- regsub -all {\r*\n} $text "
" text
+ regsub -all {\r*\n} $text "
\n" text
# Convert every two spaces to an nbsp
regsub -all { } $text "\\\ " text
@@ -82,6 +88,11 @@
# Convert every tab to 4 nbsp's
regsub -all {\t} $text {\ \ \ \ } text
+ # JCD: Remove all the eNd sTaRt stuff and warn if we do it since its bad
+ # to have these left (means something is broken in our regexps above)
+ if {[regsub -all {(sTaRtUrL|eNdUrL|sTaRtEmAiL|eNdEmAiL)} $text {} text]} {
+ ns_log warning "Replaced sTaRt/eNd magic tags in ad_text_to_html"
+ }
return $text
}
@@ -824,7 +835,7 @@
if { [llength $img_info] == 0 } {
ad_html_to_text_put_text output {[IMAGE]}
} else {
- ad_html_to_text_put_text output "\[IMAGE: [join $img_info " "]\]"
+ ad_html_to_text_put_text output "\[IMAGE: [join $img_info " "] \]"
}
}
}
@@ -907,8 +918,8 @@
}
} else {
# we're in a PRE: clean line breaks and tabs
- regsub -all {\r\n} $text {\n} text
- regsub -all {\r} $text {\n} text
+ regsub -all {\r\n} $text "\n" text
+ regsub -all {\r} $text "\n" text
# tabs become four spaces
regsub -all {[\v\t]} $text { } text
}
@@ -998,7 +1009,7 @@
} {
regsub -all {<} $html {<} html
regsub -all {>} $html {>} html
- regsub -all {"} $html {"} html
+ regsub -all {"} $html "\"" html
regsub -all {—} $html {--} html
regsub -all {} $html {--} html
# Need to do the & last, because otherwise it could interfere with the other expansions,