Re: Examples at pear documentation
| From: | Greg Beaver | Date: | Wed, 29 Oct 2003 05:44:50 +0000 |
| Subject: | Re: Examples at pear documentation | ||
| References: | 1 2 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-1810@lists.php.net to get a copy of this message | ||
A patch was posted to internals today - the problem is in PHP's highlight_string() function. I can modify the call to highlight_string() in the code that highlights the docs, and put a little check for PHP 5 in the code, as I'm pretty sure this patch will make it into head. If it makes it into PHP 4.3.4, I'll add a check for that version
$colored_example = ob_getcontents();
highlight_string($example);
if (version_compare(phpversion(), '4.3.4', 'ge') < 0) {
$colored_example = str_replace('<br />', "<br />\n", $colored_example);
}
This is found in cvs at peardoc/colorize.php, btw.
Jesus M. Castagnetto wrote:
--- Hodicska Gergely <felho@avalon.aut.bme.hu> wrote:The problem is that when you copy from the rendered page, it still doesn't have linebreaks. Try it sometime from IE, it's very annoying :) GregHi! I have a little probrlem with documentation's examples. The source of these examples contains at the lineends "<br />". This cause if I copy-paste the code to an editor, the whole code will apear in one line. The separator should be "<br />\n".Not really, XHTML (and even HTML) does not dictate that there should line-breaks anywhere, the rendering clients for either are free to ignore them, so they (strictly) are not needed. Also, if you are copying the examples to an editor, why not just copy the rendered page instead of the source? If you do prefer to copy from the page source, then any good editor can easily do a search and replace, it is trivial in vim/vi, emacs, etc.