-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate is cutting within a tag #11934
Comments
I have made a fix for this years ago but nobody gave a fu?? and chose to discuss it to dead. Will check if I can find the fix. The problem is the space within the tag, if that is the place to spilt then anything goes south. |
Hope you will find the fix again 😬 |
Do you mean #978 On 6 September 2016 at 13:47, Robert Deutz notifications@github.com wrote:
Brian Teeman |
or this one #1665 On 6 September 2016 at 13:52, Brian Teeman brian@teeman.net wrote:
Brian Teeman |
The "endless" story is here on joomlacode 30552 :-) and yes #1665 seems to be the last one. It only happens from time to time more then 3 years someone faced the same problem. Going to make a patch soon |
@rdeutz thank you! |
Tried it, but old patch doesn't work, I need a bit more time to check and fix |
of course |
JHtmlString::truncateComplex solved the issue #12612 because it is more reliable than JHtmlString::truncate. What do you think to change JHtmlString::truncate so you automatically use JHtmlString::truncateComplex when allowHtml is true? |
JHtmlString::truncateComplex is also not solving the issue as the error happens there as well. |
@franz-wohlkoenig no. This one here is about real truncating HTML code by removing letters and keeping the HTML structure valid like closing opening tags after truncate. |
thanks for info, @laoneo |
closing because we have a PR #14907 |
Truncating a string is not working 100% when attributes are set. The following code is producing incorrect HTML output Some text is <div..., even the doc comment says it closes open tags.
JHtml::_('string.truncate', 'Some text is <div class="test"><span><i>Plain</i></span></div>', 16);
Probably the whole function needs to be rewritten, using a DOM parser.
Steps to reproduce the issue
In the file tests/unit/suites/libraries/cms/html/JHtmlStringTest.php after line 210, add the following code
Run
phpunit tests/unit/suites/libraries/cms/html/JHtmlStringTest.php
.Expected result
Unit test will run trough.
Actual result
System information (as much as possible)
Joomla 3.6.2 on PHP 7.
The text was updated successfully, but these errors were encountered: