Project

General

Profile

Actions

Feature #20555

closed

New parseFunc setting

Added by tyler kraft almost 15 years ago. Updated over 5 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 #1

Updated by tyler kraft almost 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>

Actions #2

Updated by Gerrit Code Review over 11 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

Actions #3

Updated by Gerrit Code Review over 11 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975

Actions #4

Updated by Gerrit Code Review over 11 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975

Actions #5

Updated by Gerrit Code Review over 11 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16975

Actions #6

Updated by Gerrit Code Review over 10 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/16975

Actions #7

Updated by Gerrit Code Review over 10 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/16975

Actions #8

Updated by tyler kraft over 10 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?

Actions #9

Updated by Gerrit Code Review about 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

Actions #10

Updated by Gerrit Code Review almost 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

Actions #11

Updated by Gerrit Code Review almost 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

Actions #12

Updated by Gerrit Code Review about 9 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

Actions #13

Updated by Gerrit Code Review about 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

Actions #14

Updated by Gerrit Code Review about 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

Actions #15

Updated by Gerrit Code Review about 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

Actions #16

Updated by Stephan Großberndt about 9 years ago

  • Tracker changed from Bug to Feature
  • Description updated (diff)
  • Category set to TypoScript
  • Target version changed from 0 to next-patchlevel
Actions #17

Updated by Alexander Stehlik about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #18

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF