Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.0

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 (version 0.6.9)
PHP Version: 5.1.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-04-25 09:02 UTC] chris at phpmyforum dot de (Christoph Roeder)
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); ?>');

Comments

 [2007-06-06 18:34 UTC] stoyan (Stoyan Stefanov)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Text_Highlighter