ad_html_text_convert (public)

 ad_html_text_convert [ -from from ] [ -to to ] [ -maxlen maxlen ] \
    [ -truncate_len truncate_len ] [ -ellipsis ellipsis ] \
    [ -more more ] text

Defined in packages/acs-tcl/tcl/text-html-procs.tcl

Converts a chunk of text from a variety of formats to either text/html or text/plain.

Example: ad_html_text_convert -from "text/html" -to "text/plain" -- "text"

Putting in the -- prevents Tcl from treating a - in text portion from being treated as a parameter.

Html to html closes any unclosed html tags (see util_close_html_tags).

Text to HTML does ad_text_to_html, and HTML to text does an ad_html_to_text. See those procs for details.

When text is empty, then an empty string will be returned regardless of any format. This is especially useful when displaying content that was created with the richtext widget and might contain empty values for content and format.

Switches:
-from
(defaults to "text/plain") (optional)
specify what type of text you're providing. Allowed values:
  • text/plain
  • text/enhanced
  • text/markdown
  • text/fixed-width
  • text/html
-to
(defaults to "text/html") (optional)
specify what format you want this translated into. Allowed values:
  • text/plain
  • text/html
-maxlen
(defaults to "70") (optional)
The maximum line width when generating text/plain
-truncate_len
(defaults to "0") (optional)
The maximum total length of the output, included ellipsis.
-ellipsis
(defaults to "...") (optional)
This will get put at the end of the truncated string, if the string was truncated. However, this counts towards the total string length, so that the returned string including ellipsis is guaranteed to be shorter than the 'truncate_len' provided.
-more
(optional)
This will get put at the end of the truncated string, if the string was truncated.
Parameters:
text
Author:
Lars Pind <lars@pinds.com>
Created:
19 July 2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_html_text_convert ad_html_text_convert (test acs-tcl) ad_html_text_convert ad_html_text_convert test_ad_html_text_convert->ad_html_text_convert test_ad_text_html_convert_outlook_word_comments ad_text_html_convert_outlook_word_comments (test acs-tcl) test_ad_text_html_convert_outlook_word_comments->ad_html_text_convert test_ad_text_html_convert_to_plain ad_text_html_convert_to_plain (test acs-tcl) test_ad_text_html_convert_to_plain->ad_html_text_convert test_general_comments_create_link general_comments_create_link (test general-comments) test_general_comments_create_link->ad_html_text_convert Markdown::convert Markdown::convert ad_html_text_convert->Markdown::convert Markdown::get_lang_counter Markdown::get_lang_counter ad_html_text_convert->Markdown::get_lang_counter Markdown::register Markdown::register ad_html_text_convert->Markdown::register Markdown::reset_lang_counter Markdown::reset_lang_counter ad_html_text_convert->Markdown::reset_lang_counter ad_enhanced_text_to_html ad_enhanced_text_to_html (public) ad_html_text_convert->ad_enhanced_text_to_html ad_convert_to_html ad_convert_to_html (public, deprecated) ad_convert_to_html->ad_html_text_convert ad_convert_to_text ad_convert_to_text (public, deprecated) ad_convert_to_text->ad_html_text_convert auth::get_local_account auth::get_local_account (private) auth::get_local_account->ad_html_text_convert bug_tracker::bug_convert_comment_to_html bug_tracker::bug_convert_comment_to_html (public) bug_tracker::bug_convert_comment_to_html->ad_html_text_convert bug_tracker::bug_convert_comment_to_text bug_tracker::bug_convert_comment_to_text (public) bug_tracker::bug_convert_comment_to_text->ad_html_text_convert

Testcases:
ad_html_text_convert, ad_text_html_convert_outlook_word_comments, ad_text_html_convert_to_plain, general_comments_create_link
[ show source ]
Show another procedure: