[TYPO3-core] RFC #1318: 'removeTag' does not remove closing tags
Xavier Perseguers
typo3 at perseguers.ch
Mon Oct 18 12:14:38 CEST 2010
Hi,
This is an SVN patch request.
Type: Bugfix
Branches: 3.8 and up to trunk :-)
Bugtracker reference:
http://bugs.typo3.org/view.php?id=1318
Problem:
When using removeTags with parseFunc, the closing/ending tag is not removed.
How to reproduce:
Create a simple plugin with following code:
-------------------
$contentObj = t3lib_div::makeInstance('tslib_cObj');
/* @var $contentObj tslib_cObj */
$content = <<<EOD
<h1><span lang=FR-CH style='mso-ansi-language:FR-CH'>Voici un
test<o:p></o:p></span></h1>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Avec du <span class=SpellE><span
style='color:red'>contenu</span></span>
<i style='mso-bidi-font-style:normal'>pour <span
class=SpellE>voir</span> </i>à
<span class=SpellE>quel</span> <b
style='mso-bidi-font-weight:normal'>point <span
class=SpellE><span
style='background:yellow;mso-highlight:yellow'>c’est</span></span>
<span class=SpellE><span class=GramE><u>moche</u></span></span></b><span
class=GramE> !</span>!!</p>
EOD;
$content = $contentObj->parseFunc($content, $this->conf['parseFunc.']);
return htmlentities($content) . $content;
-------------------
This should output [step-1.png]
Now add following TS (change the 2 references to plugin.tx_myext with
yours of course):
plugin.tx_myext_pi1 {
parseFunc < lib.parseFunc
parseFunc {
allowTags = h1, b, i
denyTags >
nonTypoTagStdWrap.HTMLparser {
allowTags < plugin.tx_myext_pi1.parseFunc.allowTags
denyTags >
keepNonMatchedTags = 0
removeTags = center, font, o:p, sdfield, strike, u, span
# Avoid content being HSC'ed twice
htmlSpecialChars = 0
tags {
p.allowedAttribs = 0
b < .p
b.remap = strong
i < .p
i.remap = em
}
}
}
}
You should have this [step-2.png]
Now apply patch and enjoy having (finally) a valid output.
Cheers
Xavier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: step-1.png
Type: image/png
Size: 13390 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101018/04c7f2f8/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: step-2.png
Type: image/png
Size: 30814 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101018/04c7f2f8/attachment-0003.png>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 1318.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101018/04c7f2f8/attachment.asc>
More information about the TYPO3-team-core
mailing list