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.35 -r1.36
--- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 5 Feb 2004 17:05:43 -0000 1.35
+++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 6 Feb 2004 12:36:54 -0000 1.36
@@ -280,11 +280,7 @@
set nobr_tagptr 0
set nobr_len 0
- if { $break_soft > 0 } {
- set break_soft [expr $break_soft - [string length $ellipsis]]
- }
if { $break_hard > 0 } {
- set break_hard [expr $break_hard - [string length $ellipsis]]
if { $break_soft == 0 } {
set break_soft $break_hard
}
@@ -321,7 +317,7 @@
if { $break_soft } {
if {! $nobr && [expr [string length $pretag] + $out_len] > $break_soft } {
# first chop pretag to the right length
- set pretag [string range $pretag 0 [expr $break_soft - $out_len]]
+ set pretag [string range $pretag 0 [expr $break_soft - $out_len - [string length $ellipsis]]]
# clip the last word
regsub "\[^ \t\n\r]*$" $pretag {} pretag
append out [string range $pretag 0 $break_soft]
@@ -1263,7 +1259,7 @@
{-from text/plain}
{-to text/html}
{-maxlen 70}
- {-truncate_len 70}
+ {-truncate_len 0}
{-ellipsis "..."}
{-more ""}
text
Index: openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl 5 Feb 2004 17:05:43 -0000 1.4
+++ openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl 6 Feb 2004 12:36:55 -0000 1.5
@@ -76,7 +76,7 @@
Testing ad_html_text_convert.
} {
#----------------------------------------------------------------------
- # text/enhanced
+ # from text/enhanced
#----------------------------------------------------------------------
set string "What?\nNever mind, buddy"
@@ -88,7 +88,7 @@
aa_equals "" [ad_html_text_convert -from "text/enhanced" -to "text/plain" -truncate_len 15 -- $string] "What?\n_Never..."
#----------------------------------------------------------------------
- # text/plain
+ # from text/plain
#----------------------------------------------------------------------
set string "What?\nNever mind, buddy"
@@ -100,7 +100,7 @@
"What?\nNever..."
#----------------------------------------------------------------------
- # text/fixed-width
+ # from text/fixed-width
#----------------------------------------------------------------------
set string "What?\nNever mind, buddy"
@@ -113,7 +113,7 @@
#----------------------------------------------------------------------
- # text/html
+ # from text/html
#----------------------------------------------------------------------
set string "What?
Never mind, buddy"
@@ -123,8 +123,10 @@
aa_equals "" [ad_html_text_convert -from "text/html" -to "text/plain" -truncate_len 15 -- $string] \
"What?\n_Never..."
-
+ set long_string [string repeat "Very long text. " 10]
+ aa_equals "No truncation" [ad_html_text_convert -from "text/html" -to "text/html" -truncate_len [string length $long_string] -- $long_string] $long_string
+
}
aa_register_case string_truncate {
@@ -139,4 +141,8 @@
aa_equals "" [string_truncate -len 11 -ellipsis "" -- "foobar greble"] "foobar"
aa_equals "" [string_truncate -len 12 -ellipsis "" -- "foobar greble"] "foobar"
aa_equals "" [string_truncate -len 13 -ellipsis "" -- "foobar greble"] "foobar greble"
+
+ set long_string [string repeat "Very long text. " 100]
+ aa_equals "No truncation" [string_truncate -len [string length $long_string] -- $long_string] $long_string
+
}