_acs-tcl__util_convert_line_breaks_to_html (private)
_acs-tcl__util_convert_line_breaks_to_html
Defined in packages/acs-tcl/tcl/test/html-conversion-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ # Convert leading and trailing spaces or tabs set html "\tinter spaces " aa_log "html= '$html' - Contains tabs and spaces" set result [util_convert_line_breaks_to_html $html] aa_false "Now html='$result'" [regexp {\sinter spaces\s} $result] # convert single break set html "\r\n inter\r\nbreaks \r\n" aa_log "html= '$html' - Contains a single break" set result [util_convert_line_breaks_to_html $html] aa_false "Now html='$result'" [regexp {inter<b />\nspaces} $result] # convert paragraph break set html "\r\n inter\r\n\r\nbreaks \r\n" aa_log "html= '$html' - Contains a double break" set result [util_convert_line_breaks_to_html $html] aa_false "Now html='$result'" [regexp {inter</p><p style="margin-bottom: 0px;">spaces} $result] # convert more than 2 breaks set html "\r\n inter\r\n\r\n\r\nbreaks \r\n" aa_log "html= '$html' - Contains more than 2 breaks" set result [util_convert_line_breaks_to_html $html] aa_false "Now html='$result'" [regexp {inter<b />\n<b />\n<b />\nspaces} $result] # do not trim spaces before and after some tags set html "We could use a <div> instead than a <table> layout\r\nfor the list for example." aa_log "html= '[ns_quotehtml $html]' - Contains more than 2 breaks" set result [util_convert_line_breaks_to_html $html] aa_true "Now html='[ns_quotehtml $result]'" [regexp {a <table> layout} $result] # do not add <br> inside <pre> set text "text begin\r\n<pre>\nline1\nline2\n</pre>text\nend\n" aa_log "Input: <pre>[ns_quotehtml $text]</pre>" set result [util_convert_line_breaks_to_html -contains_pre $text] aa_log "result is <pre>[ns_quotehtml $result]</pre>" set nrBr [regsub -all <br> $result <br> .] aa_true "text contains some [ns_quotehtml <br>] tags" {$nrBr > 0} if {[::acs::icanuse "ns_parsehtml"]} { aa_true "text contains $nrBr [ns_quotehtml <br>] tags" {$nrBr == 2} } }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "util_convert_line_breaks_to_html (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle