Index: build.php =================================================================== RCS file: /repository/phd/build.php,v retrieving revision 1.54.2.2 diff -u -r1.54.2.2 build.php --- build.php 1 Aug 2008 11:17:06 -0000 1.54.2.2 +++ build.php 4 Aug 2008 18:44:37 -0000 @@ -28,32 +28,36 @@ /* {{{ Build the .ser file names to allow multiple sources for PHD. */ $OPTIONS['index_location'] = $OPTIONS['xml_root'] . DIRECTORY_SEPARATOR . '.index_' . basename($OPTIONS['xml_file'], '.xml') . '.ser'; $OPTIONS['refnames_location'] = $OPTIONS['xml_root'] . DIRECTORY_SEPARATOR . '.refnames_' . basename($OPTIONS['xml_file'], '.xml') . '.ser'; +$OPTIONS['classes_location'] = $OPTIONS['xml_root'] . DIRECTORY_SEPARATOR . '.classes_' . basename($OPTIONS['xml_file'], '.xml') . '.ser'; /* }}} */ /* {{{ Index the DocBook file or load from .ser cache files NOTE: There are two cache files (where * is the basename of the XML source file): - index_*.ser (containing the ID infos) - refnames_*.ser (containing => File ID) */ -if (!$OPTIONS["index"] && (file_exists($OPTIONS['index_location']) && file_exists($OPTIONS['refnames_location']))) { +if (!$OPTIONS["index"] && (file_exists($OPTIONS['index_location']) && file_exists($OPTIONS['refnames_location']) && file_exists($OPTIONS['classes_location']))) { /* FIXME: Load from sqlite db? */ v("Unserializing cached index files...", VERBOSE_INDEXING); $IDs = unserialize(file_get_contents($OPTIONS['index_location'])); $REFS = unserialize(file_get_contents($OPTIONS['refnames_location'])); + $CLASSES = unserialize(file_get_contents($OPTIONS['classes_location'])); v("Unserialization done", VERBOSE_INDEXING); } else { v("Indexing...", VERBOSE_INDEXING); - /* This file will "return" an $IDs & $REFS array */ + /* This file will "return" an $IDs, $REFS, $CLASSES array */ require $ROOT. "/mktoc.php"; file_put_contents($OPTIONS['index_location'], $ids = serialize($IDs)); file_put_contents($OPTIONS['refnames_location'], $refs = serialize($REFS)); + file_put_contents($OPTIONS['classes_location'], $classes = serialize($CLASSES)); $IDs2 = unserialize($ids); $REFS2 = unserialize($refs); - if ($IDs !== $IDs2 || $REFS !== $REFS2) { + $CLASSES2 = unserialize($classes); + if ($IDs !== $IDs2 || $REFS !== $REFS2 || $CLASSES !== $CLASSES2) { trigger_error("Serialized representation does not match", E_USER_WARNING); } @@ -79,7 +83,7 @@ // {{{ Initialize the output format and fetch the methodmaps require $ROOT. "/formats/$output_format.php"; - $format = new $classname(array($IDs, $REFS)); + $format = new $classname(array($IDs, $REFS, $CLASSES)); $formatmap = $format->getElementMap(); $formattextmap = $format->getTextMap(); /* }}} */ @@ -96,7 +100,7 @@ switch($theme) { // FIXME: This is stupid and definetly does not belong in here. case "php": - $themes[$themename] = new $themename(array($IDs, $REFS), + $themes[$themename] = new $themename(array($IDs, $REFS, $CLASSES), array( "version" => $OPTIONS["version_info"], "acronym" => $OPTIONS["acronyms_file"], @@ -104,7 +108,7 @@ ); break; default: - $themes[$themename] = new $themename(array($IDs, $REFS)); + $themes[$themename] = new $themename(array($IDs, $REFS, $CLASSES)); } // FIXME: this needs to go away when we add support for Index: config.php =================================================================== RCS file: /repository/phd/config.php,v retrieving revision 1.45.2.9 diff -u -r1.45.2.9 config.php --- config.php 1 Aug 2008 12:40:29 -0000 1.45.2.9 +++ config.php 4 Aug 2008 18:44:38 -0000 @@ -152,6 +152,7 @@ 'chunk_extra' => array( "legalnotice" => true, "phpdoc:exception" => true, + "phpdoc:class" => true, ), 'index' => true, 'xml_root' => '.', Index: mktoc.php =================================================================== RCS file: /repository/phd/mktoc.php,v retrieving revision 1.10 diff -u -r1.10 mktoc.php --- mktoc.php 24 May 2008 14:49:14 -0000 1.10 +++ mktoc.php 4 Aug 2008 18:44:38 -0000 @@ -1,7 +1,7 @@ element in the PHP manual @@ -19,7 +19,11 @@ continue; } elseif($name == "titleabbrev") { - $IDs[$lastid]["sdesc"] = trim($r->readContent($name)); + $IDs[$lastid]["sdesc"] = $class = trim($r->readContent($name)); + $elm = $r->getParentTagName(); + if ($elm == "phpdoc:class" || $elm == "phpdoc:exception") { + $CLASSES[strtolower($class)] = $lastid; + } continue; } } elseif($name == "refname") { Index: include/PhDHelper.class.php =================================================================== RCS file: /repository/phd/include/PhDHelper.class.php,v retrieving revision 1.9 diff -u -r1.9 PhDHelper.class.php --- include/PhDHelper.class.php 27 Jan 2008 14:32:33 -0000 1.9 +++ include/PhDHelper.class.php 4 Aug 2008 18:44:38 -0000 @@ -4,6 +4,7 @@ class PhDHelper { private $IDs = array(); private $refs = array(); + private $classes = array(); /* abstract */ protected $elementmap = array(); /* abstract */ protected $textmap = array(); private static $autogen = array(); @@ -11,6 +12,7 @@ public function __construct(array $a) { $this->IDs = $a[0]; $this->refs = $a[1]; + $this->classes = $a[2]; } final public function getFilename($id) { return isset($this->IDs[$id]) ? $this->IDs[$id]["filename"] : false; @@ -29,6 +31,9 @@ public function getRefnameLink($ref) { return isset($this->refs[$ref]) ? $this->refs[$ref] : null; } + public function getClassnameLink($class) { + return isset($this->classes[$class]) ? $this->classes[$class] : null; + } final public function getElementMap() { return $this->elementmap; } Index: themes/php/phpdotnet.php =================================================================== RCS file: /repository/phd/themes/php/phpdotnet.php,v retrieving revision 1.53.2.1 diff -u -r1.53.2.1 phpdotnet.php --- themes/php/phpdotnet.php 23 Jul 2008 18:31:49 -0000 1.53.2.1 +++ themes/php/phpdotnet.php 4 Aug 2008 18:44:38 -0000 @@ -5,6 +5,7 @@ protected $elementmap = array( 'acronym' => 'format_suppressed_tags', 'function' => 'format_suppressed_tags', + 'classname' => 'format_suppressed_tags', 'link' => 'format_link', 'refpurpose' => 'format_refpurpose', 'title' => array( @@ -69,6 +70,7 @@ 'refentry' => 'format_chunk', 'reference' => 'format_container_chunk', 'phpdoc:exception' => 'format_exception_chunk', + 'phpdoc:class' => 'format_class_chunk', 'sect1' => 'format_chunk', 'sect2' => 'format_chunk', 'sect3' => 'format_chunk', @@ -85,6 +87,7 @@ protected $textmap = array( 'acronym' => 'format_acronym_text', 'function' => 'format_function_text', + 'classname' => 'format_classname_text', 'methodname' => array( /* DEFAULT */ 'format_function_text', 'constructorsynopsis' => array( @@ -112,7 +115,11 @@ ), 'refname' => 'format_refname_text', - 'titleabbrev' => 'format_suppressed_tags', + 'titleabbrev' => array( + /* DEFAULT */ 'format_suppressed_tags', + 'phpdoc:class' => 'format_grep_classname_text', + 'phpdoc:exception' => 'format_grep_classname_text', + ), ); private $versions = array(); private $acronyms = array(); @@ -125,6 +132,7 @@ protected $cchunk = array(); /* Default Chunk settings */ protected $dchunk = array( + "phpdoc:class" => null, "fieldsynopsis" => array( "modifier" => "public", ), @@ -410,6 +418,9 @@ public function format_exception_chunk($open, $name, $attrs, $props) { return $this->format_container_chunk($open, "reference", $attrs, $props); } + public function format_class_chunk($open, $name, $attrs, $props) { + return $this->format_container_chunk($open, "reference", $attrs, $props); + } public function format_container_chunk_title($open, $name, $attrs) { if ($open) { @@ -489,6 +500,20 @@ } return '' .$display_value.($tag == "function" ? "()" : ""). ''; } + + public function format_grep_classname_text($value, $tag) { + $this->cchunk["phpdoc:class"] = strtolower($value); + } + public function format_classname_text($value, $tag) { + if (($filename = $this->getClassnameLink(strtolower($value))) !== null && $this->cchunk["phpdoc:class"] !== strtolower($value)) { + if ($this->chunked) { + return '' .$value. ''; + } + return ''.$value.''; + } + return '' .$value. ''; + } + public function format_type_if_object_or_pseudo_text($type, $tagname) { if (in_array(strtolower($type), array("bool", "int", "double", "boolean", "integer", "float", "string", "array", "object", "resource", "null"))) { return false;