Home » Text » Text_Highlighter » Bug #7480
new feature: link elements to their documentation
Details
| Request #7480 | new feature: link elements to their documentation |
|---|---|
| Submitted | 2006-04-25 09:02 UTC |
| From | chris at phpmyforum dot de |
| Assigned | stoyan |
| Status | Closed |
| Package | Text_Highlighter |
| PHP Version | 5.1.2 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-04-25 09:02 UTC] chris at phpmyforum dot de
Description:
------------
This adds a new feature to the html-renderer class, which allows you to specify an documentation-url.
Here's the diff for Text/Highlighter/Renderer/Html.php:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- Html.php 2006-04-25 10:31:06.090785512 +0200
+++ Html.php.org 2006-04-25 10:58:30.843745056 +0200
@@ -175,18 +175,7 @@
$content = str_replace("\n", $tag, $content);
}
- // link to documentation
- if (!empty($this->_options['docUrl']) && !empty($this->_options['docElements']) && in_array($class, $this->_options['docElements']))
- {
- $this->_output .= '<a href="'.sprintf($this->_options['docUrl'], $content).'"'.(!empty($this->_options['docTarget']) ? ' target="'.$this->_options['docTarget'].'"' : '').'>'.$content.'</a>';
-
- }
- // no link
- else
- {
$this->_output .= $content;
- }
-
$this->_lastClass = $class;
}
Test script:
---------------
require_once 'Text/Highlighter.php';
$hl =& Text_Highlighter::factory('PHP', array(
'docUrl' => 'http://php.net/%s',
'docTarget' => '_blank',
'docElements' => array(
'reserved',
'identifier',
),
));
echo $hl->highlight('<?php echo strlen(2); ?>');