Recent manually built Extended CHM has a corrupt index page.
| From: | Richard A. Quadling | Date: | Thu, 29 Jun 2006 09:46:58 +0000 |
| Subject: | Recent manually built Extended CHM has a corrupt index page. | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969373419@lists.php.net to get a copy of this message | ||
Hi,
phpdoc/htmlhelp/filter_files.php has a problem creating the new
_index.html file.
The output currently is ...
<a id="user_notes"></a><div
id="pageNotes"></div><script
type="text/javascript" language="JavaScript1.2">
function displayNotes() { _displayNotes(); }
if (typeof loadNotes == "function") { loadNotes(); }
</script><div id="pageNav"><table width="100%"
border="0"
cellspacing="10" cellpadding="0" class="navigation"><tr
align="left"
valign="middle"><td width="30%"></td><td
align="center"
width="40%"><span id="navPath">Main</span></td><td
align="right"
width="30%"><span id="navNext"><a accesskey="n"
href="preface.html">Preface
>></a></span></td></tr><tr
align="center" valign="middle"><td colspan="3"><span
id="navOnline"><span id="navThisOnline"><a
href="javascript:thisPageOnline();">This page online</a></span>
<span id="navReportBug"><a href="javascript:bugOnPage();">Report a
bug</a></span></span></td></tr></table></div></div></body></html>
The code causing the problem is bizarre.
filter_files.php // $Id: filter_files.php,v 1.17 2005/07/01 22:27:04
techtonik Exp $
Lines 240-247 (Part of function newIndex ($content))
// Get contents we need to build the _index.html file
preg_match("!^(.+)<hr>!s", $content, $_index1);
preg_match("!</div></div>(<a
id=\"user_notes\">.+</html>)!s",
$content, $_index2);
// Write out the two components to form a complete file
$fp = fopen("$HTML_TARGET/_index.html", "w");
fwrite($fp, $_index1[1] . $_index2[1]);
fclose($fp);
Even though the $content DOES containt <hr>, then value in $_index1[1]
is blank.
This is going to be one of those REALLY obvious problems which has
stumped me for ages. I can redo the code using string manipulation, but
why the regex doesn't work,I don't know.
I'm using PHPV5.2.0-dev and am just downloading the latest snapshot.
I can confirm that the expression works in my editor (I added a
file_put_contents('test.html', $content); and used that with the
expression - worked fine!).
Regards,
Richard Quadling.