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 (optional, defaults to
"text/plain"
)- specify what type of text you're providing. Allowed values:
- text/plain
- text/enhanced
- text/markdown
- text/fixed-width
- text/html
- -to (optional, defaults to
"text/html"
)- specify what format you want this translated into. Allowed values:
- text/plain
- text/html
- -maxlen (optional, defaults to
"70"
)- The maximum line width when generating text/plain
- -truncate_len (optional, defaults to
"0"
)- The maximum total length of the output, included ellipsis.
- -ellipsis (optional, defaults to
"..."
)- 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 (required)
- Author:
- Lars Pind <lars@pinds.com>
- Created:
- 19 July 2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_html_text_convert, ad_text_html_convert_outlook_word_comments, ad_text_html_convert_to_plain, general_comments_create_link