Project

General

Profile

Actions

Feature #20555

closed

New parseFunc setting

Added by tyler kraft over 15 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2009-06-03
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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.'>%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)


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Feature #16340: option to remove empty elementsClosed2006-07-12

Actions
Related to TYPO3 Core - Feature #39676: Delete empty paragraphsClosed2012-08-10

Actions
Related to TYPO3 Core - Bug #17750: Empty paragraph-tags with attributes are not editableClosedStanislas Rolland2007-11-03

Actions
Actions

Also available in: Atom PDF