bjori Fri Aug 10 20:16:14 2007 UTC
Modified files:
/phd build.php mktoc.php
/phd/formats xhtml.php
/phd/include PhDHelper.class.php
/phd/themes/php bightml.php chunkedhtml.php phpdotnet.php
phpweb.php
Log:
Simplify
http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.14&r2=1.15&diff_format=u
Index: phd/build.php
diff -u phd/build.php:1.14 phd/build.php:1.15
--- phd/build.php:1.14 Thu Aug 9 15:25:34 2007
+++ phd/build.php Fri Aug 10 20:16:13 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: build.php,v 1.14 2007/08/09 15:25:34 bjori Exp $ */
+/* $Id: build.php,v 1.15 2007/08/10 20:16:13 bjori Exp $ */
function err($no, $str, $file, $line) {
global $notify;
@@ -38,6 +38,7 @@
if ($OPTIONS["index"]) {
require "./mktoc.php";
+
if ($err) {
$mktoc = microtime(true);
$notify
@@ -56,7 +57,7 @@
}
require "./formats/$output_format.php";
- $format = new $classname($IDs, $IDMap);
+ $format = new $classname($IDs);
$formatmap = $format->getElementMap();
$themes = $elementmaps = $textmaps = array();
@@ -75,10 +76,10 @@
require "./themes/$theme/$themename.php";
switch($theme) {
case "php":
- $themes[$themename] = new $themename($IDs, $IDMap,
$OPTIONS["xml_root"]."/phpbook/phpbook-xsl/version.xml");
+ $themes[$themename] = new $themename($IDs,
$OPTIONS["xml_root"]."/phpbook/phpbook-xsl/version.xml");
break;
default:
- $themes[$themename] = new $themename($IDs, $IDMap);
+ $themes[$themename] = new $themename($IDs);
}
$elementmaps[$themename] = $themes[$themename]->getElementMap();
$textmaps[$themename] = $themes[$themename]->getTextMap();
http://cvs.php.net/viewvc.cgi/phd/mktoc.php?r1=1.2&r2=1.3&diff_format=u
Index: phd/mktoc.php
diff -u phd/mktoc.php:1.2 phd/mktoc.php:1.3
--- phd/mktoc.php:1.2 Thu Aug 9 17:06:26 2007
+++ phd/mktoc.php Fri Aug 10 20:16:13 2007
@@ -1,13 +1,11 @@
<?php
-/* $Id: mktoc.php,v 1.2 2007/08/09 17:06:26 bjori Exp $ */
-
+/* $Id: mktoc.php,v 1.3 2007/08/10 20:16:13 bjori Exp $ */
$r = new PhDReader($OPTIONS["xml_root"]."/.manual.xml");
-$FILENAMES = $IDs = $IDMap = array();
+$FILENAMES = array();
$CURRENT_FILENAME = $LAST_CHUNK = "";
-$PARENTS = array(-1 => "");
+$PARENTS = array(-1 => "ROOT");
$lastid = 0;
-/* someone really needs to fix this messed up logic */
while($r->read()) {
if (!($id = $r->getID())) {
$name = $r->name;
@@ -30,43 +28,40 @@
continue 2;
}
}
+
continue;
}
switch($r->isChunk) {
case PhDReader::OPEN_CHUNK:
- $FILENAMES[] = $id;
- $CURRENT_FILENAME = $id;
- $PARENTS[$r->depth] = $id;
-
- $IDMap[$id] = array("parent" => $PARENTS[$r->depth-1]);
-
+ $CURRENT_FILENAME = $FILENAMES[] = $PARENTS[$r->depth] = $id;
break;
case PhDReader::CLOSE_CHUNK:
$LAST_CHUNK = array_pop($FILENAMES);
$CURRENT_FILENAME = end($FILENAMES);
- $IDMap[$CURRENT_FILENAME][$id] =& $IDMap[$LAST_CHUNK];
+ $IDs[$CURRENT_FILENAME]["children"][$LAST_CHUNK] = $IDs[$LAST_CHUNK];
+
+
continue 2;
}
if ($r->nodeType != XMLReader::ELEMENT) {
continue;
}
-
- $IDs[$id] = array("filename" => $CURRENT_FILENAME, "sdesc" => null,
"ldesc" => null);
+
+ $IDs[$id] = array(
+ "filename" => $CURRENT_FILENAME,
+ "parent" => $r->isChunk ? $PARENTS[$r->depth-1] : end($FILENAMES),
+ "sdesc" => null,
+ "ldesc" => null,
+ "children" => array(),
+ );
+
$lastid = $id;
+
}
-#print_r($IDs);
-#var_dump($IDs["funcref"]);
-/*
-foreach($IDMap[$IDMap["function.strpos"]["parent"]] as $id => $junk) {
- if ($id == "parent") {
- continue;
- }
- printf("%s (%s): %s\n", $id, $IDs[$id]["sdesc"], $IDs[$id]["ldesc"]);
-}
-*/
+
/*
* vim600: sw=4 ts=4 fdm=syntax syntax=php et
* vim<600: sw=4 ts=4
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.14&r2=1.15&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.14 phd/formats/xhtml.php:1.15
--- phd/formats/xhtml.php:1.14 Wed Aug 8 23:45:26 2007
+++ phd/formats/xhtml.php Fri Aug 10 20:16:13 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.14 2007/08/08 23:45:26 bjori Exp $ */
+/* $Id: xhtml.php,v 1.15 2007/08/10 20:16:13 bjori Exp $ */
class XHTMLPhDFormat extends PhDFormat {
protected $elementmap = array( /* {{{ */
@@ -144,8 +144,8 @@
protected $role = false;
- public function __construct(array $IDs, array $IDMap) {
- parent::__construct($IDs, $IDMap);
+ public function __construct(array $IDs) {
+ parent::__construct($IDs);
}
/* Overwrite PhDFormat::readContent() to convert special HTML chars */
public function readContent($content = null) {
http://cvs.php.net/viewvc.cgi/phd/include/PhDHelper.class.php?r1=1.2&r2=1.3&diff_format=u
Index: phd/include/PhDHelper.class.php
diff -u phd/include/PhDHelper.class.php:1.2 phd/include/PhDHelper.class.php:1.3
--- phd/include/PhDHelper.class.php:1.2 Thu Aug 9 15:15:40 2007
+++ phd/include/PhDHelper.class.php Fri Aug 10 20:16:14 2007
@@ -1,15 +1,13 @@
<?php
-/* $Id: PhDHelper.class.php,v 1.2 2007/08/09 15:15:40 bjori Exp $ */
+/* $Id: PhDHelper.class.php,v 1.3 2007/08/10 20:16:14 bjori Exp $ */
class PhDHelper {
private $IDs = array();
- private $IDMap = array();
/* abstract */ protected $elementmap = array();
/* abstract */ protected $textmap = array();
- public function __construct(array $IDs, array $IDMap) {
+ public function __construct(array $IDs) {
$this->IDs = $IDs;
- $this->IDMap = $IDMap;
}
final public function getFilename($id) {
return isset($this->IDs[$id]) ? $this->IDs[$id]["filename"] : false;
@@ -20,10 +18,10 @@
($this->IDs[$id]["sdesc"] ? $this->IDs[$id]["sdesc"] :
$this->IDs[$id]["ldesc"]);
}
final public function getContainer($id) {
- return $this->IDMap[$id];
+ return $this->IDs[$id]["children"];
}
final public function getParent($id) {
- return $this->IDMap[$id]["parent"];
+ return $this->IDs[$id]["parent"];
}
final public function getElementMap() {
return $this->elementmap;
http://cvs.php.net/viewvc.cgi/phd/themes/php/bightml.php?r1=1.2&r2=1.3&diff_format=u
Index: phd/themes/php/bightml.php
diff -u phd/themes/php/bightml.php:1.2 phd/themes/php/bightml.php:1.3
--- phd/themes/php/bightml.php:1.2 Thu Aug 9 15:25:35 2007
+++ phd/themes/php/bightml.php Fri Aug 10 20:16:14 2007
@@ -1,9 +1,9 @@
<?php
-/* $Id: bightml.php,v 1.2 2007/08/09 15:25:35 bjori Exp $ */
+/* $Id: bightml.php,v 1.3 2007/08/10 20:16:14 bjori Exp $ */
class bightml extends phpdotnet implements PhDTheme {
- public function __construct(array $IDs, array $IDMap, $filename, $ext =
"html") {
- phpdotnet::__construct($IDs, $IDMap, $filename, $ext, false);
+ public function __construct(array $IDs, $filename, $ext = "html") {
+ parent::__construct($IDs, $filename, $ext, false);
$this->stream = fopen("bightml.html", "w");
self::header();
}
http://cvs.php.net/viewvc.cgi/phd/themes/php/chunkedhtml.php?r1=1.3&r2=1.4&diff_format=u
Index: phd/themes/php/chunkedhtml.php
diff -u phd/themes/php/chunkedhtml.php:1.3 phd/themes/php/chunkedhtml.php:1.4
--- phd/themes/php/chunkedhtml.php:1.3 Thu Aug 9 15:33:21 2007
+++ phd/themes/php/chunkedhtml.php Fri Aug 10 20:16:14 2007
@@ -1,7 +1,7 @@
<?php
class chunkedhtml extends phpweb {
- public function __construct(array $IDs, array $IDMap, $filename, $ext =
"html") {
- phpdotnet::__construct($IDs, $IDMap, $filename, $ext, true);
+ public function __construct(array $IDs, $filename, $ext = "html") {
+ phpdotnet::__construct($IDs, $filename, $ext, true);
if(!file_exists("html") || is_file("html")) mkdir("html") or
die("Can't create the cache directory");
}
public function header($id) {
http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.1&r2=1.2&diff_format=u
Index: phd/themes/php/phpdotnet.php
diff -u phd/themes/php/phpdotnet.php:1.1 phd/themes/php/phpdotnet.php:1.2
--- phd/themes/php/phpdotnet.php:1.1 Wed Aug 8 23:46:19 2007
+++ phd/themes/php/phpdotnet.php Fri Aug 10 20:16:14 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: phpdotnet.php,v 1.1 2007/08/08 23:46:19 bjori Exp $ */
+/* $Id: phpdotnet.php,v 1.2 2007/08/10 20:16:14 bjori Exp $ */
class phpdotnet extends PhDHelper {
protected $elementmap = array(
@@ -66,8 +66,8 @@
protected $CURRENT_ID = "";
protected $refname;
- public function __construct(array $IDs, array $IDMap, $filename, $ext =
"php", $chunked = true) {
- parent::__construct($IDs, $IDMap, $ext);
+ public function __construct(array $IDs, $filename, $ext = "php", $chunked
= true) {
+ parent::__construct($IDs, $ext);
$this->ext = $ext;
$this->versions = self::generateVersionInfo($filename);
$this->chunked = $chunked;
http://cvs.php.net/viewvc.cgi/phd/themes/php/phpweb.php?r1=1.2&r2=1.3&diff_format=u
Index: phd/themes/php/phpweb.php
diff -u phd/themes/php/phpweb.php:1.2 phd/themes/php/phpweb.php:1.3
--- phd/themes/php/phpweb.php:1.2 Thu Aug 9 15:25:35 2007
+++ phd/themes/php/phpweb.php Fri Aug 10 20:16:14 2007
@@ -1,13 +1,13 @@
<?php
-/* $Id: phpweb.php,v 1.2 2007/08/09 15:25:35 bjori Exp $ */
+/* $Id: phpweb.php,v 1.3 2007/08/10 20:16:14 bjori Exp $ */
class phpweb extends phpdotnet implements PhDTheme {
protected $streams = array();
protected $writeit = false;
- public function __construct($IDs, $IDMap, $filename, $ext = "php",
$chunked = true) {
- parent::__construct($IDs, $IDMap, $filename, $ext, $chunked);
+ public function __construct($IDs, $filename, $ext = "php", $chunked =
true) {
+ parent::__construct($IDs, $filename, $ext, $chunked);
if(!file_exists("php") || is_file("php")) mkdir("php") or die("Can't
create the cache directory");
}
public function writeChunk($id, $stream) {