Feature #20555
closedNew parseFunc setting
100%
Description
I only say parseFunc as I'm not sure where this would best be incorporated - perhaps HTMLparser might be more appropriate.
Sometimes we end up with empty tag sets (eg: <b></b>) in the content; Peter Klein emailed the T3 english list about it 23/01/2008. Peter then wrote a small userFunc to strip these empty tags out that could possibly be easily added to parseFunc or HTMLparser functions.
From Peters posting:
-- cut Typoscript SETUP - cut --
page.includeLibs.user_parseFunc = fileadmin/scripts/parseFunc.inc
lib.parseFunc.nonTypoTagUserFunc = user_parseFunc->stripEmptyTags
lib.parseFunc.nonTypoTagUserFunc.tagList = b,strong,i
lib.parseFunc_RTE.nonTypoTagUserFunc = user_parseFunc->stripEmptyTags
lib.parseFunc_RTE.nonTypoTagUserFunc.tagList = b,strong,i
-- cut Typoscript SETUP - cut --
-- cut - File: fileadmin/scripts/parseFunc.inc - cut --
class user_parseFunc {
function stripEmptyTags($content,$conf) {
$tags = explode(',',$conf['tagList']);
$strip = array();
foreach ($tags as $k => $tag) {
$strip[] = '%<'.$tag.'>'.$tag.'>%si';
}
return preg_replace($strip, '', $content);
}
}
?>
-- cut - File: fileadmin/scripts/parseFunc.inc - cut --
Perhaps this could become:
...stripEmptyTags = 1
...stripEmptyTags.tagList = b,i,strong
where stripEmptyTags = 1 strips out all empty tag sets, and the use of the sub property would then causes it to strip out only the listed tags instead?
With time it is becoming more and more important to have validator compliant html, this would be nice to see in 4.3 if it's possible.
(I've check TSref for 4.2, and I've gone through the previous bugs and I can't see any similar posting or function so sorry if this is duplicate work)
(issue imported from #M11252)
Updated by tyler kraft over 15 years ago
Additionally this would be perfect if it would even strip out empty tagsets that even have attributes in the tag - eg <b class="blah"></b>
Updated by Gerrit Code Review almost 12 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review almost 12 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review almost 12 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review almost 12 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review over 11 years ago
Patch set 8 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/16975
Updated by Gerrit Code Review over 11 years ago
Patch set 9 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/16975
Updated by tyler kraft over 11 years ago
Hi
Forgive me if I'm mistaken but this seems to be being applied to the RTE html parser. While that is great it would also be very useful to be applied to the basic parsefunc that one could call from template TS. Will this be possible?
Updated by Gerrit Code Review over 10 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/16975
Updated by Gerrit Code Review over 10 years ago
Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/16975
Updated by Gerrit Code Review over 10 years ago
Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/16975
Updated by Gerrit Code Review almost 10 years ago
Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review over 9 years ago
Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review over 9 years ago
Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Gerrit Code Review over 9 years ago
Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/16975
Updated by Stephan Großberndt over 9 years ago
- Tracker changed from Bug to Feature
- Description updated (diff)
- Category set to TypoScript
- Target version changed from 0 to next-patchlevel
Updated by Alexander Stehlik over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 03bd2256e3d35c556ac1bad50a4554eeb32f1098.