Index: openacs-4/packages/acs-tcl/tcl/openacs-kernel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/openacs-kernel-procs.tcl,v diff -u -r1.11.2.1 -r1.11.2.2 --- openacs-4/packages/acs-tcl/tcl/openacs-kernel-procs.tcl 8 Apr 2019 13:05:35 -0000 1.11.2.1 +++ openacs-4/packages/acs-tcl/tcl/openacs-kernel-procs.tcl 12 Dec 2019 09:45:11 -0000 1.11.2.2 @@ -1,4 +1,3 @@ - ad_library { A library of additional OpenACS utilities @@ -49,6 +48,11 @@ break } + # ignore empty lines + if {$n_fields == 0} { + continue + } + # Process the row set extra_vars [ns_set create] for {set i 0} {$i < $n_fields} {incr i} { 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.109.2.9 -r1.109.2.10 --- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 1 Nov 2019 13:16:18 -0000 1.109.2.9 +++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 12 Dec 2019 09:45:11 -0000 1.109.2.10 @@ -14,6 +14,56 @@ # #################### +ad_proc -private ad_text_cite_to_blockquote {text} { + + Convert freestanding paragraphs with lines starting with a ">" into + blockquotes. + +} { + if {[string range $text 0 0 ] eq " "} { + set result " " + set text [string range $text 1 end] + } else { + set result "" + } + # + # Via "doBlockquotes" we could start blockquote substitution only + # when a new paragraph starts; deactivated for now, can start + # everywhere. + # + set doBlockquotes 1 + set inBlockquotes 0 + + foreach line [split $text \n] { + #ns_log notice "$inBlockquotes <[expr {[string range $line 0 0] eq ">"}]>: '$line'" + if {$inBlockquotes} { + if {[string range $line 0 0] eq ">"} { + append blockquoted [string range $line 1 end] \n + } else { + append result "
$blockquoted
\n" + set blockquoted "" + set inBlockquotes 0 + #set doBlockquotes 1 + append result $line \n + } + } elseif {[string trim $line] eq ""} { + #set doBlockquotes 1 + append result $line \n + } elseif {$doBlockquotes && [string range $line 0 0] eq ">"} { + set blockquoted [string range $line 1 end]\n + set inBlockquotes 1 + } else { + #set doBlockquotes 0 + append result $line \n + } + } + if {$inBlockquotes} { + append result "
$blockquoted
\n" + } + + return $result +} + ad_proc -public ad_text_to_html { -no_links:boolean -no_lines:boolean @@ -122,10 +172,15 @@ set text [string map $map $text] } + # Convert lines starting with a ">" into blockquotes. + set text [ad_text_cite_to_blockquote $text] + # Convert line breaks if { !$no_lines_p } { set text [util_convert_line_breaks_to_html -includes_html=$includes_html_p -- $text] - # the function strips all leading white space + # + # The function strips all leading white space! + # set space_added 0 } @@ -238,7 +293,7 @@ {-includes_html:boolean} text } { - Convert line breaks to

and
tags, respectively. + Convert line breaks to <p> and <br> tags, respectively. } { # Remove any leading or trailing whitespace regsub {^[\s]+} $text {} text @@ -381,7 +436,8 @@ dom parse -html $frag doc } on error {errorMsg} { # we got an error, so do Tcl based html completion processing - ad_log notice "tdom can't parse the provided HTML, error=$errorMsg, checking fragment without tdom\n$frag" + #ad_log notice "tdom can't parse the provided HTML, error=$errorMsg, checking fragment without tdom\n$frag" + ad_log notice "tdom can't parse the provided HTML, error=$errorMsg, checking fragment without tdom" } on ok {r} { $doc documentElement root set html "" @@ -1033,7 +1089,7 @@ # Original purpose of this proc was to introduce a better way to # enforce some HTML policies on the content submitted by the uses # (e.g. forbid some tag/attribute like