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.
In the file tests/unit/suites/libraries/cms/html/JHtmlStringTest.php after line 210, add the following code
'Dont show open tags' => array(
'Some text is <div class="test"><span><i>Plain</i></span></div>',
20,
true,
true,
'Some text is ',
),
Run phpunit tests/unit/suites/libraries/cms/html/JHtmlStringTest.php
.
Unit test will run trough.
1) JHtmlStringTest::testTruncate with data set "HTML not allowed, no split" ('Some text is <div class="test...</div>', 20, true, true, 'Some text is ')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Some text is '
+'Some text is <div...'
Joomla 3.6.2 on PHP 7.
Labels |
Added:
?
|
Hope you will find the fix again
Do you mean #978
On 6 September 2016 at 13:47, Robert Deutz notifications@github.com wrote:
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.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#11934 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8RQuIBobUR9k5OWHrvHUDM43MyrGks5qnWDlgaJpZM4J05V3
.
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
or this one #1665
On 6 September 2016 at 13:52, Brian Teeman brian@teeman.net wrote:
Do you mean #978
On 6 September 2016 at 13:47, Robert Deutz notifications@github.com
wrote: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.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#11934 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8RQuIBobUR9k5OWHrvHUDM43MyrGks5qnWDlgaJpZM4J05V3
.Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
@rdeutz thank you!
@brianteeman did you remember the ids without search
Tried it, but old patch doesn't work, I need a bit more time to check and fix
@brianteeman did you remember the ids without search
? ?
of course
Category | ⇒ | Libraries |
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.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-03-26 14:37:07 |
Closed_By | ⇒ | rdeutz |
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.