Turns all urls and email addresses into clickable links. The +link+ parameter can limit what should be linked.
Options are :all (default), :email_addresses, and :urls.
auto_link("Go to http://www.symfony-project.com and say hello to firstname.lastname@example.org") =>
Go to http://www.symfony-project.com and
say hello to email@example.com
Extracts an excerpt from the +text+ surrounding the +phrase+ with a number of characters on each side determined
by +radius+. If the phrase isn't found, nil is returned. Ex:
excerpt("hello my world", "my", 3) => "...lo my wo..."
If +excerpt_space+ is true the text will only be truncated on whitespace, never inbetween words.
This might return a smaller radius than specified.
excerpt("hello my world", "my", 3, "...", true) => "... my ..."
(string) highlight_text ($text, $phrase, $highlighter)
||subject input to preg_replace.
||string or array of words to highlight
||regex replacement input to preg_replace.
Highlights the +phrase+ where it is found in the +text+ by surrounding it like
I'm a highlight phrase. The highlighter can be specialized by
passing +highlighter+ as single-quoted string with \1 where the phrase is supposed to be inserted.
N.B.: The +phrase+ is sanitized to include only letters, digits, and spaces before use.
Returns +text+ transformed into html using very simple formatting rules
Surrounds paragraphs with <p> tags, and converts line breaks into <br />
Two consecutive newlines(
) are considered as a paragraph, one newline (
considered a linebreak, three or more consecutive newlines are turned into two newlines
Turns all links into words, like "<a href="something">else</a>" to "else".
Truncates +text+ to the length of +length+ and replaces the last three characters with the +truncate_string+
if the +text+ is longer than +length+.
Word wrap long lines to line_width.
Turns all email addresses into clickable links.
Turns all urls into clickable links.