3 * All abstract representations of DocBlock tags are defined
\r
4 * by the classes in this file
\r
6 * phpDocumentor :: automatic documentation generator
\r
8 * PHP versions 4 and 5
\r
10 * Copyright (c) 2002-2006 Gregory Beaver
\r
14 * This library is free software; you can redistribute it
\r
15 * and/or modify it under the terms of the GNU Lesser General
\r
16 * Public License as published by the Free Software Foundation;
\r
17 * either version 2.1 of the License, or (at your option) any
\r
20 * This library is distributed in the hope that it will be useful,
\r
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
23 * Lesser General Public License for more details.
\r
25 * You should have received a copy of the GNU Lesser General Public
\r
26 * License along with this library; if not, write to the Free Software
\r
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
29 * @package phpDocumentor
\r
30 * @subpackage DocBlockTags
\r
31 * @author Greg Beaver <cellog@php.net>
\r
32 * @copyright 2002-2006 Gregory Beaver
\r
33 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
\r
34 * @version CVS: $Id: DocBlockTags.inc,v 1.10 2007/04/19 20:20:57 ashnazg Exp $
\r
36 * @link http://www.phpdoc.org
\r
37 * @link http://pear.php.net/PhpDocumentor
\r
38 * @see parserDocBlock, parserInclude, parserPage, parserClass
\r
39 * @see parserDefine, parserFunction, parserMethod, parserVar
\r
40 * @since separate file since version 1.2
\r
43 * used to represent standard tags like @access, etc.
\r
44 * This class is aware of inline tags, and will automatically handle them
\r
45 * using inherited functions
\r
46 * @package phpDocumentor
\r
47 * @subpackage DocBlockTags
\r
48 * @author Greg Beaver <cellog@php.net>
\r
50 * @version $Id: DocBlockTags.inc,v 1.10 2007/04/19 20:20:57 ashnazg Exp $
\r
52 class parserTag extends parserStringWithInlineTags
\r
55 * Type is used by many functions to skip the hassle of if phpDocumentor_get_class($blah) == 'parserBlah'
\r
61 * tag name (see, access, etc.)
\r
70 * @param string $keyword tag name
\r
71 * @param parserStringWithInlineTags $value
\r
72 * @param boolean whether to parse the $value for html tags
\r
74 function parserTag($keyword, $value, $noparse = false)
\r
76 $this->keyword = $keyword;
\r
79 $parser = new parserDescParser;
\r
80 $parser->subscribe('*',$this);
\r
81 $parser->parse($value->value,true,'parserstringwithinlinetags');
\r
82 } else $this->value = $value;
\r
89 function Convert(&$converter)
\r
91 if (is_array($this->value))
\r
93 if (count($this->value) == 1)
\r
95 reset($this->value);
\r
96 list(,$val) = each($this->value);
\r
97 $a = $val->Convert($converter);
\r
101 foreach($this->value as $val)
\r
103 // this is only true if we processed the description in
\r
105 if (phpDocumentor_get_class($val) == 'parserstringwithinlinetags')
\r
106 $result .= $converter->EncloseParagraph($val->Convert($converter));
\r
108 $result .= $val->Convert($converter);
\r
113 $a = $this->value->Convert($converter);
\r
119 * Gets a count of the number of paragraphs in this
\r
120 * tag's description.
\r
122 * Useful in determining whether to enclose the
\r
123 * tag in a paragraph or not.
\r
127 function _valueParagraphCount()
\r
132 * Called by the {@link parserDescParser} when processing a description.
\r
133 * @param integer not used
\r
134 * @param array array of {@link parserStringWithInlineTags} representing
\r
135 * paragraphs in the tag description
\r
136 * @see parserTag::parserTag()
\r
138 function HandleEvent($a,$desc)
\r
140 $this->value = $desc;
\r
144 * @return string returns the text minus any inline tags
\r
145 * @see parserStringWithInlineTags::getString()
\r
147 function getString()
\r
149 if (is_array($this->value))
\r
152 foreach($this->value as $val)
\r
154 $result .= $val->getString();
\r
157 } else return $this->value->getString();
\r
162 * This class represents the @name tag
\r
163 * @tutorial tags.name.pkg
\r
164 * @package phpDocumentor
\r
165 * @subpackage DocBlockTags
\r
167 class parserNameTag extends parserTag
\r
173 var $keyword = 'name';
\r
176 * @param string not used
\r
177 * @param string name
\r
179 function parserNameTag($name, $value)
\r
181 $this->value = $value;
\r
185 * @see parserStringWithInlineTags::Convert()
\r
187 * @return string converted value of the tag
\r
189 function Convert(&$c)
\r
191 return $this->value;
\r
196 * This class represents the @access tag
\r
197 * @tutorial tags.access.pkg
\r
198 * @package phpDocumentor
\r
199 * @subpackage DocBlockTags
\r
201 class parserAccessTag extends parserTag
\r
207 var $keyword = 'access';
\r
210 * set to true if the returned tag has a value type of private, protected
\r
211 * or public, false otherwise
\r
214 var $isvalid = false;
\r
217 * checks $value to make sure it is private, protected or public, otherwise
\r
218 * it's not a valid @access tag
\r
220 * @param parserStringWithInlineTags $value
\r
222 function parserAccessTag($value)
\r
224 if (!is_string($value))
\r
226 if (is_object($value))
\r
228 if (method_exists($value,'getstring'))
\r
230 $value = $value->getString();
\r
234 switch(trim($value))
\r
239 $this->value = $value;
\r
240 $this->isvalid = true;
\r
243 addError(PDERROR_ACCESS_WRONG_PARAM,$value);
\r
244 $this->value = 'public';
\r
250 * @see parserStringWithInlineTags::Convert()
\r
252 * @return string converted value of the tag
\r
254 function Convert(&$converter)
\r
256 return $this->value;
\r
260 * No inline tags are possible, returns 'public', 'protected' or 'private'
\r
261 * @return string returns the text minus any inline tags
\r
263 function getString()
\r
265 return $this->value;
\r
270 * represents "@return"
\r
271 * @tutorial tags.return.pkg
\r
272 * @package phpDocumentor
\r
273 * @subpackage DocBlockTags
\r
274 * @author Greg Beaver <cellog@php.net>
\r
276 * @version $Id: DocBlockTags.inc,v 1.10 2007/04/19 20:20:57 ashnazg Exp $
\r
278 class parserReturnTag extends parserTag
\r
284 var $keyword = 'return';
\r
286 * the type a function returns
\r
288 var $returnType = 'void';
\r
291 * contains a link to the documentation for a class passed as a type in @return, @var or @param
\r
300 * /** @return myclass blahblahblah
\r
304 * In this case, $converted_returnType will contain a link to myclass instead of the string 'myclass'
\r
305 * @var mixed either the same as $returnType or a link to the docs for a class
\r
308 var $converted_returnType = false;
\r
312 * @param parserStringWithInlineTags
\r
314 function parserReturnTag($returnType, $value)
\r
316 $this->returnType = $returnType;
\r
317 parent::parserTag('return',$value);
\r
321 * sets up $converted_returnType
\r
322 * @see parserStringWithInlineTags::Convert(), $converted_returnType
\r
324 * @return string converted value of the tag
\r
326 function Convert(&$converter)
\r
329 if (strpos($this->returnType,'|'))
\r
331 $types = explode('|',$this->returnType);
\r
332 foreach($types as $returntype)
\r
334 $a = $converter->getLink($returntype);
\r
335 if (is_object($a) && phpDocumentor_get_class($a) == 'classlink')
\r
337 if (!empty($my_types)) $my_types .= '|';
\r
338 $my_types .= $converter->returnSee($a,$converter->type_adjust($returntype));
\r
341 if (!empty($my_types)) $my_types .= '|';
\r
342 $my_types .= $converter->type_adjust($returntype);
\r
345 $this->converted_returnType = $my_types;
\r
348 $a = $converter->getLink($this->returnType);
\r
349 if (is_object($a) && phpDocumentor_get_class($a) == 'classlink')
\r
351 $this->converted_returnType = $converter->returnSee($a,$converter->type_adjust($this->returnType));
\r
354 $this->converted_returnType = $converter->type_adjust($this->returnType);
\r
357 return parserTag::Convert($converter);
\r
362 * represents "@property" tag
\r
363 * @package phpDocumentor
\r
364 * @subpackage DocBlockTags
\r
366 class parserPropertyTag extends parserReturnTag
\r
369 * always 'property'
\r
372 var $keyword = 'property';
\r
374 * the type a property has
\r
377 var $returnType = 'mixed';
\r
381 * @param parserStringWithInlineTags
\r
383 function parserPropertyTag( $returnType, $value )
\r
385 $this->returnType = $returnType;
\r
386 parent::parserTag( $this->keyword, $value );
\r
391 * represents "@property-read" tag
\r
392 * @package phpDocumentor
\r
393 * @subpackage DocBlockTags
\r
395 class parserPropertyReadTag extends parserPropertyTag
\r
398 * always 'property-read'
\r
401 var $keyword = 'property-read';
\r
405 * represents "@property-write" tag
\r
406 * @package phpDocumentor
\r
407 * @subpackage DocBlockTags
\r
409 class parserPropertyWriteTag extends parserPropertyTag
\r
412 * always 'property-write'
\r
415 var $keyword = 'property-write';
\r
419 * represents "@method" tag
\r
420 * @package phpDocumentor
\r
421 * @subpackage DocBlockTags
\r
423 class parserMethodTag extends parserPropertyTag
\r
429 var $keyword = 'method';
\r
431 * the return type a method has
\r
434 var $returnType = 'void';
\r
438 * represents "@var"
\r
439 * @tutorial tags.var.pkg
\r
440 * @package phpDocumentor
\r
441 * @subpackage DocBlockTags
\r
442 * @author Greg Beaver <cellog@php.net>
\r
444 * @version $Id: DocBlockTags.inc,v 1.10 2007/04/19 20:20:57 ashnazg Exp $
\r
446 class parserVarTag extends parserReturnTag
\r
452 var $keyword = 'var';
\r
454 * the type a var has
\r
457 var $returnType = 'mixed';
\r
461 * Represents "@param"
\r
462 * @tutorial tags.param.pkg
\r
463 * @package phpDocumentor
\r
464 * @subpackage DocBlockTags
\r
466 class parserParamTag extends parserVarTag
\r
472 var $keyword = 'param';
\r
476 * Represents "@staticvar"
\r
477 * @tutorial tags.staticvar.pkg
\r
478 * @package phpDocumentor
\r
479 * @subpackage DocBlockTags
\r
481 class parserStaticvarTag extends parserParamTag
\r
484 * always 'staticvar'
\r
487 var $keyword = 'staticvar';
\r
491 * represents "@link"
\r
492 * @tutorial tags.link.pkg
\r
493 * @package phpDocumentor
\r
494 * @subpackage DocBlockTags
\r
495 * @author Greg Beaver <cellog@php.net>
\r
497 * @version $Id: DocBlockTags.inc,v 1.10 2007/04/19 20:20:57 ashnazg Exp $
\r
499 class parserLinkTag extends parserTag
\r
505 var $keyword = 'link';
\r
509 * @param string $link
\r
511 function parserLinkTag($link)
\r
513 $start = $val = $link->getString();
\r
514 if (strpos($val,' '))
\r
516 $start = array_shift($val = explode(' ',$val));
\r
517 $val = join($val, ' ');
\r
519 $a = new parserLinkInlineTag($start,$val);
\r
520 $b = new parserStringWithInlineTags;
\r
527 * represents "@see"
\r
528 * @tutorial tags.see.pkg
\r
529 * @package phpDocumentor
\r
530 * @subpackage DocBlockTags
\r
531 * @author Greg Beaver <cellog@php.net>
\r
533 * @version $Id: DocBlockTags.inc,v 1.10 2007/04/19 20:20:57 ashnazg Exp $
\r
535 class parserSeeTag extends parserLinkTag
\r
541 var $keyword = 'see';
\r
544 * @param string element to link to
\r
546 function parserSeeTag($name)
\r
548 parserTag::parserTag($this->keyword,$name,true);
\r
553 * @see parserStringWithInlineTags::Convert()
\r
555 function Convert(&$converter)
\r
557 if ($this->value->hasInlineTag())
\r
559 addErrorDie(PDERROR_INLINETAG_IN_SEE);
\r
561 $a = $converter->getLink(trim($this->value->Convert($converter)));
\r
565 if (strpos($a,'://'))
\r
568 return $converter->returnLink($a,str_replace('PHP_MANUAL#','',$this->value->Convert($converter)));
\r
572 if (is_object($a)) return $converter->returnSee($a);
\r
573 // getLink parsed a comma-delimited list of linked thingies, add the commas back in
\r
577 foreach($a as $i => $bub)
\r
579 if (!empty($b)) $b .= ', ';
\r
580 if (is_string($a[$i])) $b .= $a[$i];
\r
581 if (is_object($a[$i])) $b .= $converter->returnSee($a[$i]);
\r
590 * represents "@license"
\r
592 * Link to a license, instead of including lines and lines of license information
\r
594 * @tutorial tags.license.pkg
\r
595 * @package phpDocumentor
\r
596 * @subpackage DocBlockTags
\r
598 class parserLicenseTag extends parserLinkTag
\r
604 var $keyword = 'license';
\r
608 * @param string $link
\r
610 function parserLicenseTag($name, $link)
\r
612 $a = explode(' ',$link->getString());
\r
613 $url = array_shift($a);
\r
614 $license = join($a,' ');
\r
615 if (empty($license)) $license = $url;
\r
616 $a = new parserLinkInlineTag($url, $license);
\r
617 $b = new parserStringWithInlineTags;
\r
624 * represents "@uses"
\r
626 * This is exactly like @see except that the element used has a @useby link to this element added to its docblock
\r
627 * @package phpDocumentor
\r
628 * @subpackage DocBlockTags
\r
629 * @tutorial tags.uses.pkg
\r
632 class parserUsesTag extends parserSeeTag
\r
638 var $keyword = 'uses';
\r
639 /** @access private */
\r
643 * @param string element to link to
\r
644 * @param parserStringWithInlineTags description of how the element is used
\r
646 function parserUsesTag($seeel, $description)
\r
648 if ($seeel->hasInlineTag()) {
\r
649 addErrorDie(PDERROR_DUMB_USES);
\r
651 parent::parserSeeTag($seeel);
\r
652 $this->_description = $description;
\r
656 * Return a link to documentation for other element, and description of how
\r
659 * Works exactly like {@link parent::Convert()} except that it also includes
\r
660 * a description of how the element used is used.
\r
664 function Convert(&$c)
\r
666 $val = $this->value;
\r
667 $see = parent::Convert($c);
\r
668 $this->value = $this->_description;
\r
669 $desc_val = parserTag::Convert($c);
\r
670 if (!empty($desc_val)) {
\r
671 $see .= ' - '.$desc_val;
\r
673 $this->value = $val;
\r
678 * Get the text of the link to the element that is being used
\r
682 function getSeeElement()
\r
684 return $this->value->getString();
\r
688 * Get the description of how the element used is being used.
\r
689 * @return parserStringWithInlineTags
\r
691 function getDescription()
\r
693 return $this->_description;
\r
698 * This is a virtual tag, it is created by @uses to cross-reference the used element
\r
700 * This is exactly like @uses.
\r
701 * @package phpDocumentor
\r
702 * @subpackage DocBlockTags
\r
705 class parserUsedByTag extends parserUsesTag
\r
711 var $keyword = 'usedby';
\r
712 /** @access private */
\r
716 * @param abstractLink link of element that uses this element
\r
717 * @param string description of how the element is used
\r
719 function parserUsedByTag($link, $description)
\r
721 $this->value = $description;
\r
722 $this->_link = $link;
\r
729 function Convert(&$c)
\r
731 $see = $c->returnSee($this->_link);
\r
732 $desc_val = parserTag::Convert($c);
\r
733 if (!empty($desc_val)) {
\r
734 $see .= ' - '.$desc_val;
\r
741 * represents "@tutorial"
\r
743 * This is exactly like @see except that it only links to tutorials
\r
744 * @tutorial phpDocumentor/tutorials.pkg
\r
745 * @tutorial tags.tutorial.pkg
\r
746 * @package phpDocumentor
\r
747 * @subpackage DocBlockTags
\r
750 class parserTutorialTag extends parserSeeTag
\r
753 * Always "tutorial"
\r
756 var $keyword = 'tutorial';
\r
759 * @see parserStringWithInlineTags::Convert()
\r
761 function Convert(&$converter)
\r
763 $a = $converter->getTutorialLink(trim($this->value->Convert($converter)));
\r
768 if (is_object($a)) return $converter->returnSee($a);
\r
769 // getLink parsed a comma-delimited list of linked thingies, add the commas back in
\r
773 foreach($a as $i => $bub)
\r
775 if (!empty($b)) $b .= ', ';
\r
776 if (is_string($a[$i])) $b .= $a[$i];
\r
777 if (is_object($a[$i])) $b .= $converter->returnSee($a[$i]);
\r
786 * represents "@filesource"
\r
788 * Use this to create a link to a highlighted phpxref-style source file listing
\r
789 * @package phpDocumentor
\r
790 * @subpackage DocBlockTags
\r
791 * @tutorial tags.filesource.pkg
\r
793 class parserFileSourceTag extends parserTag
\r
796 * Always "filesource"
\r
799 var $keyword = 'filesource';
\r
805 * Flag variable, controls double writes of file for each converter
\r
809 var $_converted = array();
\r
811 * Set {@link $source} to $value, and set up path
\r
813 * @param array output from {@link phpDocumentorTWordParser::getFileSource()}
\r
815 function parserFileSourceTag($filepath, $value)
\r
817 parent::parserTag($this->keyword, '');
\r
818 $this->path = $filepath;
\r
819 $this->source = $value;
\r
823 * Return a link to the highlighted source and generate the source
\r
824 * @uses ConvertSource() generate source code and write it out
\r
825 * @return string output from {@link getSourceLink()}
\r
828 function Convert(&$c)
\r
830 $this->ConvertSource($c);
\r
831 return $this->getSourceLink($c);
\r
836 * @uses phpDocumentor_HighlightParser highlights source code
\r
837 * @uses writeSource()
\r
839 function ConvertSource(&$c)
\r
841 $this->writeSource($c, $c->ProgramExample($this->source, true, false, false, false, $this->path));
\r
843 $parser = new phpDocumentor_HighlightParser;
\r
845 $return = $parser->parse($this->source,$c, false, false, false, $this->path);
\r
846 $this->writeSource($c, $return);
\r
851 * @param string highlighted source code
\r
852 * @uses Converter::writeSource() export highlighted file source
\r
854 function writeSource(&$c, $source)
\r
856 $c->writeSource($this->path, $source);
\r
860 * @uses Converter::getSourceLink()
\r
862 * @return output from getSourceLink()
\r
864 function getSourceLink(&$c)
\r
866 return $c->getSourceLink($this->path);
\r
871 * represents "@example"
\r
874 * @package phpDocumentor
\r
875 * @subpackage DocBlockTags
\r
876 * @tutorial tags.example.pkg
\r
878 class parserExampleTag extends parserFileSourceTag
\r
884 var $keyword = 'example';
\r
886 * Reads and parses the example file indicated
\r
888 * The example tag takes one parameter: the full path to a php file that
\r
889 * should be parsed and included as an example.
\r
890 * @uses phpDocumentorTWordParser::getFileSource() uses to parse an example
\r
891 * and retrieve all tokens by line number
\r
892 * @param parserStringWithInlineTags
\r
893 * @param string path of file containing this @example tag
\r
895 function parserExampleTag($value, $current_path)
\r
897 global $_phpDocumentor_setting;
\r
898 parent::parserTag('example', $value);
\r
900 // code thanks to Sam Blum, modified by Greg Beaver
\r
901 $tagValue = $value->getString();
\r
902 $path = $isAbsPath = $pathOnly = $fileName = $fileExt = $original_path = $title = FALSE;
\r
905 // make sure the format is stuff.ext description
\r
906 if (!preg_match('`(.*)\.(\w*)\s(.*)`', $tagValue, $match))
\r
908 // or format is stuff.ext
\r
909 if (!preg_match('`(.*)\.(\w*)\s*$`', $tagValue, $match))
\r
911 // Murphy: Some funny path was given
\r
912 $original_path = $tagValue; // used for error output
\r
913 break; // try-block
\r
916 if (strlen($match[1]) === 0)
\r
918 // Murphy: Some funny path was given
\r
919 $original_path = $tagValue; // used for error output
\r
920 break; // try-block
\r
922 $fileExt = $match[2];
\r
923 $title = 'example';
\r
924 if (isset($match[3]))
\r
926 $title = trim($match[3]);
\r
928 $pathTmp = str_replace('\\', '/', $match[1]); // Replace windows '\' the path.
\r
930 // Is there a path and a file or is it just a file?
\r
931 if (strpos($pathTmp,'/') === false)
\r
935 $fileName = $pathTmp .'.'. $fileExt;
\r
938 $splitPos = strrpos($pathTmp,'/'); // split the path on the last directory, find the filename
\r
939 $pathOnly = substr($match[1], 0, $splitPos+1);
\r
940 $fileName = substr($match[1], $splitPos+1) .'.'. $fileExt;
\r
941 // Is the path absolute? (i.e. does it start like an absolute path?)
\r
942 if (('/' === $pathTmp[0]) || preg_match('`^\w*:`i', $pathTmp))
\r
943 { // works for both windows 'C:' and URLs like 'http://'
\r
944 $isAbsPath = true; // Yes
\r
948 $original_path = $pathOnly . $fileName;
\r
950 // Now look for the file starting with abs. path.
\r
953 $tmp = realpath($original_path); // remove any weirdities like /../file.ext
\r
954 if ($tmp && is_file($tmp))
\r
958 // Alway break if abs. path was detected; even if file was not found.
\r
959 break; // try-block
\r
962 // Search for the example file some standard places
\r
963 // 1) Look if the ini-var examplesdir is set and look there ...
\r
964 if (isset($_phpDocumentor_setting['examplesdir']))
\r
966 $tmp = realpath($_phpDocumentor_setting['examplesdir'] . PATH_DELIMITER . $original_path);
\r
967 if ($tmp && is_file($tmp))
\r
969 $path = $tmp; // Yo! found it :)
\r
970 break; // try-block
\r
974 // 2) Then try to look for an 'example/'-dir below the *currently* parsed file ...
\r
975 if (!empty($current_path))
\r
977 $tmp = realpath(dirname($current_path) . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $fileName);
\r
978 if ($tmp && is_file($tmp))
\r
980 $path = $tmp; // Yo! found it :)
\r
981 break; // try-block
\r
985 // 3) Then try to look for the example file below the subdir PHPDOCUMENTOR_BASE/examples/ ...
\r
986 if (is_dir(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples'))
\r
988 $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . 'examples' . PATH_DELIMITER . $original_path);
\r
989 if ($tmp && is_file($tmp))
\r
991 $path = $tmp; // Yo! found it :)
\r
992 break; // try-block
\r
996 $tmp = realpath(PHPDOCUMENTOR_BASE . PATH_DELIMITER . $original_path);
\r
997 if ($tmp && is_file($tmp))
\r
999 $path = $tmp; // Yo! found it :)
\r
1000 break; // try-block
\r
1002 // If we reach this point, nothing was found and $path is false.
\r
1007 addWarning(PDERROR_EXAMPLE_NOT_FOUND, $original_path);
\r
1008 $this->_title = 'example not found';
\r
1009 $this->path = false;
\r
1012 $this->_title = ($title) ? $title : 'example';
\r
1013 // make a unique html-filename but avoid it to get too long.
\r
1014 $uniqueFileName = str_replace(array(':', DIRECTORY_SEPARATOR,'/'), array('_', '_', '_'), $path);
\r
1015 $uniqueFileName = substr($uniqueFileName,-50) . '_' . md5($path);
\r
1016 $this->path = $uniqueFileName;
\r
1018 $f = @fopen($path,'r');
\r
1021 $example = fread($f,filesize($path));
\r
1022 if (tokenizer_ext)
\r
1024 $obj = new phpDocumentorTWordParser;
\r
1025 $obj->setup($example);
\r
1026 $this->source = $obj->getFileSource();
\r
1027 $this->origsource = $example;
\r
1031 $this->source = $example;
\r
1038 * @param Converter
\r
1039 * @uses phpDocumentor_HighlightParser highlights source code
\r
1040 * @uses writeSource()
\r
1042 function ConvertSource(&$c)
\r
1044 $this->writeSource($c, $c->ProgramExample($this->source, true, null,
\r
1045 null, null, null, $this->origsource));
\r
1047 $parser = new phpDocumentor_HighlightParser;
\r
1049 $return = $parser->parse($this->source,$c);
\r
1050 $this->writeSource($c, $return);
\r
1054 * @param Converter $c
\r
1055 * @param string parsed example source
\r
1056 * @uses Converter::writeExample() writes final example out
\r
1059 function writeSource(&$c, $source)
\r
1062 $c->writeExample($this->_title, $this->path, $source);
\r
1066 * Retrieve a converter-specific link to the example
\r
1068 * @param Converter
\r
1069 * @uses Converter::getExampleLink() retrieve the link to the example
\r
1071 function getSourceLink(&$c)
\r
1073 if (!$this->path) return $this->_title;
\r
1074 return $c->getExampleLink($this->path, $this->_title);
\r