svn: /phd/trunk/ phpdotnet/phd/Reader/Partial.php render.php
| From: | Moacir de Oliveira Miranda Júnior | Date: | Thu, 06 Aug 2009 16:25:43 +0000 |
| Subject: | svn: /phd/trunk/ phpdotnet/phd/Reader/Partial.php render.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-4619@lists.php.net to get a copy of this message | ||
moacir Thu, 06 Aug 2009 16:25:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286893
Log:
adding the partial rendering
Changed paths:
U phd/trunk/phpdotnet/phd/Reader/Partial.php
U phd/trunk/render.php
Modified: phd/trunk/phpdotnet/phd/Reader/Partial.php
===================================================================
--- phd/trunk/phpdotnet/phd/Reader/Partial.php 2009-08-06 16:17:27 UTC (rev 286892)
+++ phd/trunk/phpdotnet/phd/Reader/Partial.php 2009-08-06 16:25:43 UTC (rev 286893)
@@ -2,13 +2,13 @@
namespace phpdotnet\phd;
/* $Id$ */
-class Reader_Partial extends Reader_Legacy
+class Reader_Partial extends Reader
{
protected $partial = array();
protected $skip = array();
- public function __construct($encoding = "UTF-8", $xml_opts = NULL) {
- parent::__construct($encoding, $xml_opts);
+ public function __construct() {
+ parent::__construct();
$render_ids = Config::render_ids();
if ($render_ids !== NULL) {
@@ -26,7 +26,7 @@
}
}
} else {
- throw new Exception("Didn't get any IDs to seek");
+ throw new \Exception("Didn't get any IDs to seek");
}
}
@@ -34,60 +34,65 @@
static $seeked = 0;
static $currently_reading = false;
static $currently_skipping = false;
+ static $arrayPartial = array();
+ static $arraySkip = array();
$ignore = false;
while($ret = parent::read()) {
- if ($this->isChunk) {
- $id = $this->getAttributeNs("id", self::XMLNS_XML);
- if (isset($this->partial[$id])) {
- if ($this->isChunk == self::CLOSE_CHUNK) {
- v("%s done", $id, VERBOSE_PARTIAL_READING);
+ $id = $this->getAttributeNs("id", self::XMLNS_XML);
+ $currentPartial = end($arrayPartial);
+ $currentSkip = end($arraySkip);
+ if (isset($this->partial[$id])) {
+ if ($currentPartial == $id) {
+ v("%s done", $id, VERBOSE_PARTIAL_READING);
- unset($this->partial[$id]);
- --$seeked;
- $currently_reading = false;
- } else {
- v("Starting %s...", $id, VERBOSE_PARTIAL_READING);
+ unset($this->partial[$id]);
+ --$seeked;
+ $currently_reading = false;
+ array_pop($arrayPartial);
+ } else {
+ v("Starting %s...", $id, VERBOSE_PARTIAL_READING);
- $currently_reading = $id;
- ++$seeked;
- }
- return $ret;
- } elseif (isset($this->skip[$id])) {
- if ($this->isChunk == self::CLOSE_CHUNK) {
- v("%s done", $id, VERBOSE_PARTIAL_READING);
+ $currently_reading = $id;
+ ++$seeked;
+ $arrayPartial[] = $id;
+ }
+ return $ret;
+ } elseif (isset($this->skip[$id])) {
+ if ($currentSkip == $id) {
+ v("%s done", $id, VERBOSE_PARTIAL_READING);
- unset($this->skip[$id]);
- $currently_skipping = false;
- $ignore = false;
- } else {
- v("Skipping %s...", $id, VERBOSE_PARTIAL_READING);
+ unset($this->skip[$id]);
+ $currently_skipping = false;
+ $ignore = false;
+ array_pop($arraySkip);
+ } else {
+ v("Skipping %s...", $id, VERBOSE_PARTIAL_READING);
- $currently_skipping = $id;
- $ignore = true;
- }
- } elseif ($currently_skipping && $this->skip[$currently_skipping]) {
- if ($this->isChunk == self::OPEN_CHUNK) {
- v("Skipping child of %s, %s", $currently_reading, $id,
VERBOSE_PARTIAL_CHILD_READING);
- } else {
- v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING);
- }
-
+ $currently_skipping = $id;
$ignore = true;
- } elseif ($currently_reading && $this->partial[$currently_reading]) {
- if ($this->isChunk == self::OPEN_CHUNK) {
- v("Rendering child of %s, %s", $currently_reading, $id,
VERBOSE_PARTIAL_CHILD_READING);
- } else {
- v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING);
- }
- return $ret;
- } elseif (empty($this->partial)) {
- return false;
+ $arraySkip[] = $id;
+ }
+ } elseif ($currently_skipping && $this->skip[$currently_skipping]) {
+ if ($currentSkip == $id) {
+ v("Skipping child of %s, %s", $currently_reading, $id,
VERBOSE_PARTIAL_CHILD_READING);
} else {
- $ignore = true;
+ v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING);
}
- } elseif (!$ignore && $seeked > 0) {
+
+ $ignore = true;
+ } elseif ($currently_reading && $this->partial[$currently_reading]) {
+ if ($currentPartial == $id) {
+ v("Rendering child of %s, %s", $currently_reading, $id,
VERBOSE_PARTIAL_CHILD_READING);
+ } else {
+ v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING);
+ }
+
return $ret;
+ } elseif (empty($this->partial)) {
+ return false;
+ } else {
+ $ignore = true;
}
}
return $ret;
Modified: phd/trunk/render.php
===================================================================
--- phd/trunk/render.php 2009-08-06 16:17:27 UTC (rev 286892)
+++ phd/trunk/render.php 2009-08-06 16:25:43 UTC (rev 286893)
@@ -54,6 +54,15 @@
v("Skipping indexing", VERBOSE_INDEXING);
}
+//Partial Rendering
+$idlist = Config::render_ids() + Config::skip_ids();
+if (!empty($idlist)) {
+ v("Running partial build", VERBOSE_RENDER_STYLE);
+ $reader = new Reader_Partial();
+} else {
+ v("Running full build", VERBOSE_RENDER_STYLE);
+}
+
foreach((array)Config::package() as $package) {
$factory = Format_Factory::createFactory($package);