Yes i got the result , but i need the result like this "TruncateHtml is jus....(continued)"
some_html = '<ul><li><a href="http://whatever">TruncateHtml is just like the vanilla truncate rails helper , TruncateHtml is just like the vanilla truncate rails helper</a></li></ul>'
I think you did wrong by truncating then html. Besides, when you use ‘:omission’ option, the computed length take in consideration the length of ‘…(continued)’. The best way to do this would be to create a helper method like truncate_text
truncate_text(text, length, end_text)
end_text ||= '' # end_text as an optional parameter
new_text = truncate(text, :length => length) new_text = new_text + end_text
new_text
end
And then use it in you r html like this:
some_text = "TruncateHtml is just like the vanilla truncate rails helper , TruncateHtml is just like the vanilla truncate rails helper"
<ul><li><a href='#'><%= truncate_text(some_text, 15, (continued)) %></a></li></ul>
My some_text content like this = "<p>TruncateHtml is just like the <strong>vanilla truncate <strong>rails helper , TruncateHtml is just like the vanilla truncate rails helper<p>"
As you said i pasted helper code in my pp_helper.rd and in my view,