Truncate messages that get passed to email notifications
Hi,
We are looking into possibility to truncate post messages that get passed into email notifications users get.
As there are no such functionality built in, the intention was to find the last occurrence of </p> tag (since everything gets wrapped in paragraph tags by default in tinymce editor) after certain number of characters to avoid that we deliberately broke in half some embedded link or image.
The problem is that, indexOf() method returns -1 when we look for </p> tag inside the string that gets passed from context object.
The attempt to use indexOf() method with possible sequences of escaped </p> tag has yielded the same result, it constantly returns -1.
Any suggestion on how to solve this problem (truncate messages) is appreciated.
arthur_- Can you try with Capital letters.
.indexOf("<P>")
.indexOf("</P>")
I noticed this issue with freemarker as lithium message body returns HTML tags in the capital case.