2

何らかの理由で、html purifier が p タグをクリアします。p が span タグ内にある場合に発生します。例えば:

<span class=\"large gray content_text article_text\">
<p>111111</p>
<p>222222</p>
<p>333333</p>
</span>

出力:

<span>111111

2222222

3333333</span>

私のhtmlpurifier設定:

$config = HTMLPurifier_Config::createDefault();
$config -> set('Core.Encoding', 'UTF-8');
$config -> set('HTML.Doctype', 'XHTML 1.0 Transitional');
$config -> set('HTML.TidyLevel','none');
$config -> set('HTML.Allowed', 'p, a[href|rel], span[style], img[src|style], object[height|width|data], param[name|value|allowscriptaccess|allowfullscreen|height|width], br, strong, em');
$config -> set('CSS.AllowedProperties', 'font-weight, font-style, text-decoration, color, width, height');
$config -> set('HTML.SafeObject', 'true');
$config -> set('Output.FlashCompat', 'true');
$config -> set('HTML.FlashAllowFullScreen', 'true');
$schemes = array('http' => true, 'https' => true);
$config -> set('URI.AllowedSchemes', $schemes);
$purifier = new HTMLPurifier($config);
$content = $purifier -> purify($content);
4

2 に答える 2

1

<span>はインライン要素であり、その<p>中にブロックレベルのタグを配置するのは正しくありません。

<div>の代わりに使用してください<span>

于 2011-08-18T08:55:46.983 に答える
0

うーん、HTML Purifier には次の出力が必要です。

<span class="large gray content_text article_text"></span>
<p><span class="large gray content_text article_text">111111</span></p>
<p><span class="large gray content_text article_text">222222</span></p>
<p><span class="large gray content_text article_text">333333</span></p>
<span class="large gray content_text article_text"></span>
于 2011-08-18T13:06:26.560 に答える