PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Text » Text_Highlighter » Bug #1991

Output is not W3C compliant (</li> missing!)

Details

Submitted2004-07-27 10:25 UTC
Fromthomas dot moulard at wanadoo dot fr
Assignedblindman
StatusClosed
PackageText_Highlighter
PHP Version4.3.3
OSwindows XP
Roadmaps(Not assigned)

Comments

[2004-07-27 10:25 UTC] thomas dot moulard at wanadoo dot fr

Description:
------------
* if highlighter is called with these options: array('numbers'=>false), the output is W3C compliant

* if highlighter is called with numbers set to true, the output is bad:

- </li> are missing at the end of the lines
- the <pre> (or <code>) tags should be IN each list items (not W3C compliant!

From the W3C validator:
Line 6, column 24: document type does not allow element "pre" here; assuming missing "li" start-tag

Line 6, column 28: document type does not allow element "li" here

Reproduce code:
---------------
<?php
require_once 'Text/Highlighter.php';
$hlSQL =& Text_Highlighter::factory('SQL',array('numbers'=>true));
echo $hlSQL->highlight('SELECT * FROM table a WHERE id = 12;');
?>

Expected result:
----------------
<ol class="hl-main">

<li> <pre><span class="hl-reserved">SELECT</span><span class="hl-code"> * </span><span class="hl-reserved">FROM table </span><span class="hl-identifier">a </span><span class="hl-reserved">WHERE </span><span class="hl-identifier">id</span><span class="hl-code"> = </span><span class="hl-number">12</span><span class="hl-code">;</span></pre></li>

</ol>

Actual result:
--------------
<ol class="hl-main"><pre>
<li> <span class="hl-reserved">SELECT</span><span class="hl-code"> * </span><span class="hl-reserved">FROM table </span><span class="hl-identifier">a </span><span class="hl-reserved">WHERE </span><span class="hl-identifier">id</span><span class="hl-code"> = </span><span class="hl-number">12</span><span class="hl-code">;</span></pre></ol>