cvs: phd / build.php mktoc.php

From: Date: Sun, 19 Oct 2008 14:50:46 +0000
Subject: cvs: phd / build.php mktoc.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2264@lists.php.net to get a copy of this message
bjori Sun Oct 19 14:50:46 2008 UTC Modified files: /phd build.php mktoc.php Log: MFB0.4: Sync http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.60&r2=1.61&diff_format=u Index: phd/build.php diff -u phd/build.php:1.60 phd/build.php:1.61 --- phd/build.php:1.60 Sun Oct 5 16:06:50 2008 +++ phd/build.php Sun Oct 19 14:50:46 2008 @@ -1,6 +1,6 @@ #!@php_bin@ <?php -/* $Id: build.php,v 1.60 2008/10/05 16:06:50 cweiske Exp $ */ +/* $Id: build.php,v 1.61 2008/10/19 14:50:46 bjori Exp $ */ /* {{{ Find the $ROOT directory of PhD @php_dir@ will be replaced by the pear package manager @@ -68,32 +68,39 @@ /* {{{ Build the .ser file names to allow multiple sources for PHD. */ PhDConfig::set_index_location(PhDConfig::xml_root() . DIRECTORY_SEPARATOR . '.index_' . basename(PhDConfig::xml_file(), '.xml') . '.ser'); PhDConfig::set_refnames_location(PhDConfig::xml_root() . DIRECTORY_SEPARATOR . '.refnames_' . basename(PhDConfig::xml_file(), '.xml') . '.ser'); +PhDConfig::set_classes_location(PhDConfig::xml_root() . DIRECTORY_SEPARATOR . '.classes_' . basename(PhDConfig::xml_file(), '.xml') . '.ser'); +PhDConfig::set_vars_location(PhDConfig::xml_root() . DIRECTORY_SEPARATOR . '.vars_' . basename(PhDConfig::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 <refname> => File ID) */ -if (!PhDConfig::index() && (file_exists(PhDConfig::index_location()) && file_exists(PhDConfig::refnames_location()))) { +if (!PhDConfig::index() && (file_exists(PhDConfig::index_location()) && file_exists(PhDConfig::refnames_location()) && file_exists(PhDConfig::classes_location()) && file_exists(PhDConfig::vars_location()))) { /* FIXME: Load from sqlite db? */ v("Unserializing cached index files...", VERBOSE_INDEXING); $IDs = unserialize(file_get_contents(PhDConfig::index_location())); $REFS = unserialize(file_get_contents(PhDConfig::refnames_location())); + $CLASSES = unserialize(file_get_contents(PhDConfig::classes_location())); + $VARS = unserialize(file_get_contents(PhDConfig::vars_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, $VARS array */ require $ROOT. "/mktoc.php"; - file_put_contents(PhDConfig::index_location(), $ids = serialize($IDs)); file_put_contents(PhDConfig::refnames_location(), $refs = serialize($REFS)); + file_put_contents(PhDConfig::classes_location(), $classes = serialize($CLASSES)); + file_put_contents(PhDConfig::vars_location(), $vars = serialize($VARS)); $IDs2 = unserialize($ids); $REFS2 = unserialize($refs); - if ($IDs !== $IDs2 || $REFS !== $REFS2) { + $CLASSES2 = unserialize($classes); + $VARS2 = unserialize($vars); + if ($IDs !== $IDs2 || $REFS !== $REFS2 || $CLASSES !== $CLASSES2 || $VARS !== $VARS2) { trigger_error("Serialized representation does not match", E_USER_WARNING); } @@ -116,9 +123,10 @@ break; } + // {{{ 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, $VARS)); $formatmap = $format->getElementMap(); $formattextmap = $format->getTextMap(); /* }}} */ @@ -135,7 +143,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, $VARS), array( "version" => PhDConfig::version_info(), "acronym" => PhDConfig::acronyms_file(), @@ -143,7 +151,7 @@ ); break; default: - $themes[$themename] = new $themename(array($IDs, $REFS)); + $themes[$themename] = new $themename(array($IDs, $REFS, $CLASSES, $VARS)); } // FIXME: this needs to go away when we add support for @@ -205,6 +213,7 @@ "ns" => $reader->namespaceURI, "sibling" => $reader->getPreviousSiblingTagName(), ); + $skip = array(); foreach($elementmaps as $theme => $map) { if (isset($map[$nodename])) { http://cvs.php.net/viewvc.cgi/phd/mktoc.php?r1=1.14&r2=1.15&diff_format=u Index: phd/mktoc.php diff -u phd/mktoc.php:1.14 phd/mktoc.php:1.15 --- phd/mktoc.php:1.14 Thu Oct 16 19:54:09 2008 +++ phd/mktoc.php Sun Oct 19 14:50:46 2008 @@ -29,11 +29,11 @@ * PhDHelper::getRefnameLink(), and allows easy refname->link resolution. * * @package PhD -* @version CVS: $Id: mktoc.php,v 1.14 2008/10/16 19:54:09 cweiske Exp $ +* @version CVS: $Id: mktoc.php,v 1.15 2008/10/19 14:50:46 bjori Exp $ */ $r = new PhDReader(); -$REFS = $FILENAMES = array(); +$VARS = $CLASSES = $REFS = $FILENAMES = array(); $CURRENT_FILENAME = $LAST_CHUNK = ""; #FIXME: This is a workaround for the <legalnotice> element in the PHP manual @@ -50,16 +50,22 @@ $IDs[$lastid]["sdesc"] = $refname = trim($r->readContent($name)); $ref = strtolower(str_replace(array("_", "::", "->"), array("-", "-", "-"), $refname)); $REFS[$ref] = $lastid; + $VARS[$refname] = $lastid; continue; } else if ($name == "titleabbrev") { - $IDs[$lastid]["sdesc"] = trim($r->readContent($name)); + $IDs[$lastid]["sdesc"] = $class = trim($r->readContent($name)); + $elm = $r->getParentTagName(); + if ($elm == "phpdoc:classref" || $elm == "phpdoc:exceptionref") { + $CLASSES[strtolower($class)] = $lastid; + } continue; } } else if ($name == "refname") { $refname = trim($r->readContent($name)); $ref = strtolower(str_replace(array("_", "::", "->"), array("-", "-", "-"), $refname)); $REFS[$ref] = $lastid; + $VARS[$refname] = $lastid; } if (empty($IDs[$lastid]["ldesc"])) { if ($name == "title" || $name == "refpurpose") {

« previous php.doc.cvs (#2264) next »