cvs: phd / build.php /formats xhtml.php /include PhDFormat.class.php PhDTheme.class.php /themes/pear pearbightml.php peartheme.php pearweb.php
/themes/php bightml.php phpdotnet.php phpfunctions.php

From: Date: Tue, 17 Feb 2009 19:03:32 +0000
Subject: cvs: phd / build.php /formats xhtml.php /include PhDFormat.class.php PhDTheme.class.php /themes/pear pearbightml.php peartheme.php pearweb.php
/themes/php bightml.php phpdotnet.php phpfunctions.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-3298@lists.php.net to get a copy of this message
cweiske Tue Feb 17 19:03:32 2009 UTC Modified files: /phd build.php /phd/formats xhtml.php /phd/include PhDFormat.class.php PhDTheme.class.php /phd/themes/pear pearbightml.php peartheme.php pearweb.php /phd/themes/php bightml.php phpdotnet.php phpfunctions.php Log: Finally fix big bad bug #47413: pear themes don't work when rendered together at once. That also fixes bug #47408: Same image directory used for each theme.

http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.62&r2=1.63&diff_format=u Index: phd/build.php diff -u phd/build.php:1.62 phd/build.php:1.63 --- phd/build.php:1.62 Mon Feb 16 17:48:32 2009 +++ phd/build.php Tue Feb 17 19:03:31 2009 @@ -1,6 +1,6 @@ #!@php_bin@ <?php -/* $Id: build.php,v 1.62 2009/02/16 17:48:32 cweiske Exp $ */ +/* $Id: build.php,v 1.63 2009/02/17 19:03:31 cweiske Exp $ */ /* {{{ Find the $ROOT directory of PhD @php_dir@ will be replaced by the pear package manager @@ -64,6 +64,7 @@ require $ROOT. "/include/PhDHelper.class.php"; require $ROOT. "/include/PhDFormat.class.php"; require $ROOT. "/include/PhDTheme.class.php"; +require $ROOT. "/include/PhDThemeXhtml.class.php"; /* {{{ 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'); http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.92&r2=1.93&diff_format=u Index: phd/formats/xhtml.php diff -u phd/formats/xhtml.php:1.92 phd/formats/xhtml.php:1.93 --- phd/formats/xhtml.php:1.92 Mon Feb 16 17:48:32 2009 +++ phd/formats/xhtml.php Tue Feb 17 19:03:31 2009 @@ -1,5 +1,5 @@ <?php -/* $Id: xhtml.php,v 1.92 2009/02/16 17:48:32 cweiske Exp $ */ +/* $Id: xhtml.php,v 1.93 2009/02/17 19:03:31 cweiske Exp $ */ class XHTMLPhDFormat extends PhDFormat { protected $elementmap = array( /* {{{ */ @@ -111,7 +111,6 @@ 'glossterm' => 'span', 'holder' => 'span', 'imageobject' => 'format_div', - 'imagedata' => 'format_imagedata', 'important' => 'format_admonition', 'index' => array( /* DEFAULT */ 'format_div', @@ -174,7 +173,6 @@ 'partintro' => 'format_div', 'personname' => 'format_personname', 'personblurb' => 'format_div', - 'phd:toc' => 'format_phd_toc', 'phrase' => 'span', 'preface' => 'format_chunk', 'primaryie' => 'format_suppressed_tags', @@ -371,7 +369,7 @@ public $role = false; /* Current Chunk variables */ - protected $cchunk = array(); + public $cchunk = array(); /* Default Chunk variables */ protected $dchunk = array( "classsynopsis" => array( @@ -445,56 +443,6 @@ } /** - * Creates a table of contents for the given id. - * Also creates nested TOCs if that's wanted ($depth) - * - * @param string $id ID of section for which to generate TOC - * @param string $name Tag name (for ul class) - * @param array $props Build properties (?? FIXME) - * @param integer $depth Depth of TOC - * @param boolean $header If the header shall be shown ("Table of contents") - * - * @return string HTML code for TOC - */ - public function createToc($id, $name, $props, $depth = 1, $header = true) - { - $chunks = PhDHelper::getChildren($id); - if ($depth == 0 || !count($chunks)) { - return ''; - } - - $content = ''; - if ($header) { - $content .= " <strong>" . $this->autogen("toc", $props["lang"]) . "</strong>\n"; - } - $content .= " <ul class=\"chunklist chunklist_$name\">\n"; - foreach ($chunks as $chunkid => $junk) { - $long = $this->TEXT(PhDHelper::getDescription($chunkid, true)); - $short = $this->TEXT(PhDHelper::getDescription($chunkid, false)); - if ($long && $short && $long != $short) { - $desc = $short . '</a> -- ' . $long; - } else { - $desc = ($long ? $long : $short) . '</a>'; - } - //FIXME - if ($this->theme->chunked) { - $content .= " <li><a href=\"{$chunkid}.{$this->theme->ext}\">" . $desc; - } else { - $content .= " <li><a href=\"#{$chunkid}\">" . $this->TEXT(PhDHelper::getDescription($chunkid, false)) . "</a>"; - } - if ($depth > 1) { - $content .= $this->createToc($chunkid, $name, $props, $depth - 1, false); - } - - $content .= "</li>\n";; - } - - $content .= " </ul>\n"; - - return $content; - } - - /** * Closes a para tag when we are already in a paragraph. * * @return string HTML code @@ -1004,20 +952,6 @@ return '</p>'; } - public function format_phd_toc($open, $name, $attrs, $props) { - if ($open) { - return '<div class="phd-toc">'; - } - return $this->createToc( - $attrs[PhDReader::XMLNS_PHD]['element'], - 'phd-toc', - $props, - isset($attrs[PhDReader::XMLNS_PHD]['toc-depth']) - ? (int)$attrs[PhDReader::XMLNS_PHD]['toc-depth'] : 1, - false - ) . "</div>\n"; - } - public function format_segmentedlist($open, $name, $attrs) { $this->cchunk["segmentedlist"] = $this->dchunk["segmentedlist"]; if ($open) { @@ -1235,15 +1169,6 @@ public function format_alt_text($value, $tag) { $this->cchunk["mediaobject"]["alt"] = $value; } - public function format_imagedata($open, $name, $attrs) { - $file = $attrs[PhDReader::XMLNS_DOCBOOK]["fileref"]; - $newpath = $this->theme->mediamanager->handleFile($file); - - if ($this->cchunk["mediaobject"]["alt"] !== false) { - return '<img src="' . $newpath . '" alt="' .$this->cchunk["mediaobject"]["alt"]. '" />'; - } - return '<img src="' . $newpath . '" />'; - } public function format_dl($open, $name, $attrs, $props) { http://cvs.php.net/viewvc.cgi/phd/include/PhDFormat.class.php?r1=1.12&r2=1.13&diff_format=u Index: phd/include/PhDFormat.class.php diff -u phd/include/PhDFormat.class.php:1.12 phd/include/PhDFormat.class.php:1.13 --- phd/include/PhDFormat.class.php:1.12 Fri Jan 2 00:44:58 2009 +++ phd/include/PhDFormat.class.php Tue Feb 17 19:03:32 2009 @@ -1,25 +1,15 @@ <?php -/* $Id: PhDFormat.class.php,v 1.12 2009/01/02 00:44:58 bjori Exp $ */ +/* $Id: PhDFormat.class.php,v 1.13 2009/02/17 19:03:32 cweiske Exp $ */ abstract class PhDFormat extends PhDHelper { private $TABLE = array(); - /** - * @var PhDTheme - */ - protected $theme = null; - /* abstract functions */ abstract public function transformFromMap($open, $tag, $name, $attrs, $props); abstract public function CDATA($data); abstract public function TEXT($data); abstract public function __call($func, $args); - public function registerTheme(PhDTheme $theme) - { - $this->theme = $theme; - } - /* Table helper functions */ public function tgroup($attrs) { if (isset($attrs["cols"])) { http://cvs.php.net/viewvc.cgi/phd/include/PhDTheme.class.php?r1=1.3&r2=1.4&diff_format=u Index: phd/include/PhDTheme.class.php diff -u phd/include/PhDTheme.class.php:1.3 phd/include/PhDTheme.class.php:1.4 --- phd/include/PhDTheme.class.php:1.3 Mon Feb 16 17:48:32 2009 +++ phd/include/PhDTheme.class.php Tue Feb 17 19:03:32 2009 @@ -1,17 +1,10 @@ <?php -/* $Id: PhDTheme.class.php,v 1.3 2009/02/16 17:48:32 cweiske Exp $ */ +/* $Id: PhDTheme.class.php,v 1.4 2009/02/17 19:03:32 cweiske Exp $ */ require $ROOT. "/include/PhDMediaManager.class.php"; abstract class PhDTheme extends PhDHelper implements iPhDTheme { protected $format; - /** - * Media manager object - * - * @var PhDMediaManager - */ - public $mediamanager = null; - /** @@ -27,34 +20,16 @@ /** - * Called after the constructor finished. - * This is needed since themes set their outputdir and outputfile - * in the constructor. That file/dir is used for mediamanager. - * That means we cannot instantiate and complete the manager in our - * constructor centrally. + * Overwritten in xhtml themes only. * - * Each theme needs its own media manager, since the manager contains - * the output path. - * - * @return void + * @see PhDThemeXhtml::postConstruct() */ - public function postConstruct() - { - $this->mediamanager = new PhDMediaManager(); - - if (isset($this->outputdir)) { - $this->mediamanager->output_dir = $this->outputdir; - } else { - $this->mediamanager->output_dir = $this->outputfile . '-data/'; - $this->mediamanager->relative_path = basename($this->mediamanager->output_dir) . '/'; - } - }//public function postConstruct() + public function postConstruct() {} public function registerFormat($format) { $this->format = $format; - $this->format->registerTheme($this); } } http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearbightml.php?r1=1.3&r2=1.4&diff_format=u Index: phd/themes/pear/pearbightml.php diff -u phd/themes/pear/pearbightml.php:1.3 phd/themes/pear/pearbightml.php:1.4 --- phd/themes/pear/pearbightml.php:1.3 Wed Feb 11 20:28:48 2009 +++ phd/themes/pear/pearbightml.php Tue Feb 17 19:03:32 2009 @@ -9,6 +9,13 @@ */ public $outputfile = null; + /** + * We do not generate multiple chunks + * + * @var boolean + */ + public $chunked = false; + public function __construct(array $IDs, $ext = "html") { parent::__construct($IDs, $ext, false); $this->outputfile = PhDConfig::output_dir() . "pear_manual_{$this->lang}.html"; http://cvs.php.net/viewvc.cgi/phd/themes/pear/peartheme.php?r1=1.30&r2=1.31&diff_format=u Index: phd/themes/pear/peartheme.php diff -u phd/themes/pear/peartheme.php:1.30 phd/themes/pear/peartheme.php:1.31 --- phd/themes/pear/peartheme.php:1.30 Mon Feb 16 17:48:32 2009 +++ phd/themes/pear/peartheme.php Tue Feb 17 19:03:32 2009 @@ -1,6 +1,6 @@ <?php -abstract class peartheme extends PhDTheme { +abstract class peartheme extends PhDThemeXhtml { protected $elementmap = array( 'acronym' => 'span', 'article' => 'format_container_chunk', @@ -52,6 +52,7 @@ 'glossterm' => 'format_glossterm', 'guimenu' => 'format_guimenu', 'holder' => 'format_holder', + 'imagedata' => 'format_imagedata', 'important' => 'format_admonition', 'info' => array( /* DEFAULT */ false, @@ -106,6 +107,7 @@ 'replaceable' => 'format_replaceable', 'refentry' => 'format_chunk', 'reference' => 'format_container_chunk', + 'phd:toc' => 'format_phd_toc', 'phpdoc:exception' => 'format_exception_chunk', 'refname' => 'h1', 'refnamediv' => 'format_suppressed_tags', @@ -225,8 +227,6 @@ */ public $role = false; - public $chunked = true; - /** * File extension string * e.g. ".php" or ".htm" @@ -235,8 +235,6 @@ */ public $ext = null; - protected $lang = 'en'; - /** * If whitespace should be trimmed. * Helpful for programlistings that are encapsulated in <pre> tags @@ -349,7 +347,7 @@ $this->cchunk = $this->dchunk; } - $toc = $this->format->createToc( + $toc = $this->createToc( $id, $name, $props, isset($attrs[PhDReader::XMLNS_PHD]['toc-depth']) ? (int)$attrs[PhDReader::XMLNS_PHD]['toc-depth'] : 1 @@ -389,7 +387,7 @@ return "<div class=\"{$name}\">"; } - $content = $this->format->createToc( + $content = $this->createToc( $id, $name, $props, isset($attrs[PhDReader::XMLNS_PHD]['toc-depth']) ? (int)$attrs[PhDReader::XMLNS_PHD]['toc-depth'] : 1 @@ -473,7 +471,7 @@ return $props["empty"] ? '' : '<h1>'; } $ret = ''; - if ($this->cchunk['container_chunk']) { + if (isset($this->cchunk['container_chunk']) && $this->cchunk['container_chunk']) { $ret = $this->cchunk['container_chunk']; $this->cchunk['container_chunk'] = null; } http://cvs.php.net/viewvc.cgi/phd/themes/pear/pearweb.php?r1=1.12&r2=1.13&diff_format=u Index: phd/themes/pear/pearweb.php diff -u phd/themes/pear/pearweb.php:1.12 phd/themes/pear/pearweb.php:1.13 --- phd/themes/pear/pearweb.php:1.12 Sun Feb 15 09:53:10 2009 +++ phd/themes/pear/pearweb.php Tue Feb 17 19:03:32 2009 @@ -5,10 +5,15 @@ * PEAR theme for the many php files used for pearweb * * @package PhD -* @version CVS: $Id: pearweb.php,v 1.12 2009/02/15 09:53:10 cweiske Exp $ +* @version CVS: $Id: pearweb.php,v 1.13 2009/02/17 19:03:32 cweiske Exp $ */ class pearweb extends peartheme { + /** + * Array of file resources + * + * @var array + */ protected $streams = array(); protected $writeit = false; http://cvs.php.net/viewvc.cgi/phd/themes/php/bightml.php?r1=1.14&r2=1.15&diff_format=u Index: phd/themes/php/bightml.php diff -u phd/themes/php/bightml.php:1.14 phd/themes/php/bightml.php:1.15 --- phd/themes/php/bightml.php:1.14 Wed Feb 11 20:28:48 2009 +++ phd/themes/php/bightml.php Tue Feb 17 19:03:32 2009 @@ -1,5 +1,5 @@ <?php -/* $Id: bightml.php,v 1.14 2009/02/11 20:28:48 cweiske Exp $ */ +/* $Id: bightml.php,v 1.15 2009/02/17 19:03:32 cweiske Exp $ */ require_once $ROOT . '/themes/php/phpdotnet.php'; class bightml extends phpdotnet { @@ -10,6 +10,13 @@ */ public $outputfile = null; + /** + * We do not generate multiple chunks + * + * @var boolean + */ + protected $chunked = false; + public function __construct(array $IDs, $filename, $ext = "html") { parent::__construct($IDs, $filename, $ext, false); $this->outputfile = PhDConfig::output_dir() . 'bightml.html'; http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.67&r2=1.68&diff_format=u Index: phd/themes/php/phpdotnet.php diff -u phd/themes/php/phpdotnet.php:1.67 phd/themes/php/phpdotnet.php:1.68 --- phd/themes/php/phpdotnet.php:1.67 Sun Feb 15 21:19:52 2009 +++ phd/themes/php/phpdotnet.php Tue Feb 17 19:03:32 2009 @@ -1,7 +1,7 @@ <?php -/* $Id: phpdotnet.php,v 1.67 2009/02/15 21:19:52 bjori Exp $ */ +/* $Id: phpdotnet.php,v 1.68 2009/02/17 19:03:32 cweiske Exp $ */ -abstract class phpdotnet extends PhDTheme { +abstract class phpdotnet extends PhDThemeXhtml { protected $elementmap = array( 'acronym' => 'format_suppressed_tags', 'function' => 'format_suppressed_tags', @@ -60,6 +60,7 @@ 'book' => 'format_chunk', 'part' => 'format_chunk', ), + 'imagedata' => 'format_imagedata', 'index' => array( /* DEFAULT */ false, 'article' => 'format_chunk', @@ -72,6 +73,7 @@ 'refentry' => 'format_chunk', 'phpdoc:varentry' => 'format_varentry_chunk', 'reference' => 'format_container_chunk', + 'phd:toc' => 'format_phd_toc', 'phpdoc:exceptionref' => 'format_exception_chunk', 'phpdoc:classref' => 'format_class_chunk', 'sect1' => 'format_chunk', @@ -141,8 +143,6 @@ ); private $versions = array(); private $acronyms = array(); - protected $chunked = true; - protected $lang = "en"; /** * Name of the ID currently being processed http://cvs.php.net/viewvc.cgi/phd/themes/php/phpfunctions.php?r1=1.4&r2=1.5&diff_format=u Index: phd/themes/php/phpfunctions.php diff -u phd/themes/php/phpfunctions.php:1.4 phd/themes/php/phpfunctions.php:1.5 --- phd/themes/php/phpfunctions.php:1.4 Wed Feb 11 05:08:17 2009 +++ phd/themes/php/phpfunctions.php Tue Feb 17 19:03:32 2009 @@ -24,6 +24,12 @@ ); public $role = false; + + /** + * We do generate multiple chunks + * + * @var boolean + */ protected $chunked = true; protected $CURRENT_ID = "";
« previous php.doc.cvs (#3298) next »