cvs: phd(PHD_0_2) / build.php config.php package.xml /formats pdf.php /themes/php phpbigpdf.php phppdf.php

From: Date: Fri, 01 Aug 2008 11:17:06 +0000
Subject: cvs: phd(PHD_0_2) / build.php config.php package.xml /formats pdf.php /themes/php phpbigpdf.php phppdf.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1969@lists.php.net to get a copy of this message
loudi Fri Aug 1 11:17:06 2008 UTC Added files: (Branch: PHD_0_2) /phd/themes/php phpbigpdf.php phppdf.php /phd/formats pdf.php Modified files: /phd build.php config.php package.xml Log: * added pdf output & its associate themes (phppdf for <book> chunked pdfs & phpbigpdf for the full PHP manual PDF) * added -f pdf, -t phppdf & -t phpbigpdf modifiers * updated package.xml

http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.54.2.1&r2=1.54.2.2&diff_format=u Index: phd/build.php diff -u phd/build.php:1.54.2.1 phd/build.php:1.54.2.2 --- phd/build.php:1.54.2.1 Thu Jul 24 10:21:06 2008 +++ phd/build.php Fri Aug 1 11:17:06 2008 @@ -1,6 +1,6 @@ #!@php_bin@ <?php -/* $Id: build.php,v 1.54.2.1 2008/07/24 10:21:06 loudi Exp $ */ +/* $Id: build.php,v 1.54.2.2 2008/08/01 11:17:06 loudi Exp $ */ /* {{{ Find the $ROOT directory of PhD @php_dir@ will be replaced by the pear package manager @@ -71,6 +71,9 @@ case "manpage": $classname = "ManpagePhDFormat"; break; + case "pdf": + $classname = "PDFPhDFormat"; + break; } http://cvs.php.net/viewvc.cgi/phd/config.php?r1=1.45.2.7&r2=1.45.2.8&diff_format=u Index: phd/config.php diff -u phd/config.php:1.45.2.7 phd/config.php:1.45.2.8 --- phd/config.php:1.45.2.7 Thu Jul 24 21:08:06 2008 +++ phd/config.php Fri Aug 1 11:17:06 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: config.php,v 1.45.2.7 2008/07/24 21:08:06 bjori Exp $ */ +/* $Id: config.php,v 1.45.2.8 2008/08/01 11:17:06 loudi Exp $ */ /* {{{ PhD error & message handler */ @@ -127,7 +127,7 @@ /* {{{ Default $OPTIONS */ $OPTIONS = array ( - 'output_format' => array('xhtml', /* 'manpage' */ ), + 'output_format' => array('xhtml', /* 'manpage', 'pdf' */ ), 'output_theme' => array( 'xhtml' => array( 'php' => array( @@ -143,6 +143,11 @@ /* 'phpfunctions', */ ), ), + 'pdf' => array( + 'php' => array( + /* 'phppdf', 'phpbigpdf' */ + ) + ) ), 'chunk_extra' => array( "legalnotice" => true, @@ -276,12 +281,13 @@ switch($val) { case "xhtml": case "manpage": + case "pdf": if (!in_array($val, $formats)) { $formats[] = $val; } break; default: - trigger_error("Only xhtml and manpage are supported at this time", E_USER_ERROR); + trigger_error("Only xhtml, pdf and manpage are supported at this time", E_USER_ERROR); } } $OPTIONS["output_format"] = $formats; @@ -329,6 +335,9 @@ echo "\t\tphpkdevelop\n"; echo "\tmanpage:\n"; echo "\t\tphpfunctions\n"; + echo "\tpdf:\n"; + echo "\t\tphppdf\n"; + echo "\t\tphpbigpdf\n"; break; default: @@ -339,6 +348,7 @@ echo "Supported formats:\n"; echo "\txhtml\n"; echo "\tmanpage\n"; + echo "\pdf\n"; echo "Supported themes:\n"; echo "\txhtml:\n"; echo "\t\tphpweb\n"; @@ -348,6 +358,9 @@ echo "\t\tphpkdevelop\n"; echo "\tmanpage:\n"; echo "\t\tphpfunctions\n"; + echo "\tpdf:\n"; + echo "\t\tphppdf\n"; + echo "\t\tphpbigpdf\n"; break; } } @@ -413,6 +426,12 @@ $OPTIONS["output_theme"]["manpage"]["php"][] = $val; } break; + case "phppdf": + case "phpbigpdf": + if (!in_array($val, $OPTIONS["output_theme"]["pdf"]["php"])) { + $OPTIONS["output_theme"]["pdf"]["php"][] = $val; + } + break; default: trigger_error(sprintf("Unknown theme '%s'", $val), E_USER_ERROR); } http://cvs.php.net/viewvc.cgi/phd/package.xml?r1=1.74.2.12&r2=1.74.2.13&diff_format=u Index: phd/package.xml diff -u phd/package.xml:1.74.2.12 phd/package.xml:1.74.2.13 --- phd/package.xml:1.74.2.12 Sat Jul 26 08:57:25 2008 +++ phd/package.xml Fri Aug 1 11:17:06 2008 @@ -46,6 +46,7 @@ </stability> <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license> <notes> + - Added PDF output format. (Rudy) - Fixed bug#45627 (Unix manpages using non-standard folder name). (Rudy) - Fixed bug#45626 (Unix manpages should be gzipped). (Rudy) - Fixed bug#45618 (Bad filenames in man pages). (Rudy) @@ -55,6 +56,7 @@ <dir baseinstalldir="phd" name="/"> <file baseinstalldir="phd" name="formats/xhtml.php" role="php"/> <file baseinstalldir="phd" name="formats/manpage.php" role="php"/> + <file baseinstalldir="phd" name="formats/pdf.php" role="php"/> <file baseinstalldir="phd" name="include/PhDFormat.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDTheme.class.php" role="php"/> <file baseinstalldir="phd" name="include/PhDHelper.class.php" role="php"/> @@ -80,6 +82,8 @@ <file baseinstalldir="phd" name="themes/php/phpweb.php" role="php"/> <file baseinstalldir="phd" name="themes/php/phpkdevelop.php" role="php"/> <file baseinstalldir="phd" name="themes/php/phpfunctions.php" role="php"/> + <file baseinstalldir="phd" name="themes/php/phppdf.php" role="php"/> + <file baseinstalldir="phd" name="themes/php/phpbigpdf.php" role="php"/> <file baseinstalldir="" name="build.php" role="script"> <tasks:replace from="@php_bin@" to="php_bin" type="pear-config"/> <tasks:replace from="@php_dir@" to="php_dir" type="pear-config"/> http://cvs.php.net/viewvc.cgi/phd/themes/php/phpbigpdf.php?view=markup&rev=1.1 Index: phd/themes/php/phpbigpdf.php +++ phd/themes/php/phpbigpdf.php <?php require_once $ROOT . '/themes/php/phppdf.php'; class phpbigpdf extends phppdf { public function __construct(array $IDs, array $filenames, $format = "pdf", $chunked = true) { parent::__construct($IDs, $filenames, $format, $chunked); $this->outputdir = PhDConfig::output_dir(); } // Do nothing public function appendData($data, $isChunk) {} public function format_root_set($open, $name, $attrs, $props) { if ($open) { $this->format->newChunk(); $pdfDoc = new PdfWriter(); $this->format->setPdfDoc($pdfDoc); $this->cchunk = $this->dchunk; $id = $attrs[PhDReader::XMLNS_XML]["id"]; $this->cchunk["id-to-outline"][$id] = $pdfDoc->createOutline(PhDHelper::getDescription($id), null, true); $this->setIdToPage($id); } else { $this->resolveLinks($this->cchunk["setname"]); $pdfDoc = $this->format->getPdfDoc(); v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING); $pdfDoc->saveToFile($this->outputdir . "php_manual_en.pdf"); unset($pdfDoc); } return ""; } public function format_set($open, $name, $attrs, $props) { return $this->format_tocnode_newpage($open, $name, $attrs, $props); } public function format_book($open, $name, $attrs, $props) { return $this->format_tocnode_newpage($open, $name, $attrs, $props); } } http://cvs.php.net/viewvc.cgi/phd/themes/php/phppdf.php?view=markup&rev=1.1 Index: phd/themes/php/phppdf.php +++ phd/themes/php/phppdf.php <?php class phppdf extends PhDTheme { protected $elementmap = array( 'article' => 'format_tocnode_newpage', 'appendix' => 'format_tocnode_newpage', 'book' => 'format_book', 'bibliography' => array( /* DEFAULT */ false, 'article' => 'format_tocnode_newpage', 'book' => 'format_tocnode_newpage', 'part' => 'format_tocnode_newpage', ), 'chapter' => 'format_tocnode_newpage', 'colophon' => 'format_tocnode_newpage', 'glossary' => array( /* DEFAULT */ false, 'article' => 'format_tocnode_newpage', 'book' => 'format_tocnode_newpage', 'part' => 'format_tocnode_newpage', ), 'index' => array( /* DEFAULT */ false, 'article' => 'format_tocnode_newpage', 'book' => 'format_tocnode_newpage', 'part' => 'format_tocnode_newpage', ), 'legalnotice' => 'format_tocnode_newpage', 'part' => 'format_tocnode_newpage', 'preface' => 'format_tocnode_newpage', 'refentry' => 'format_tocnode_newpage', 'reference' => 'format_tocnode_newpage', 'sect1' => 'format_tocnode', 'sect2' => 'format_tocnode', 'sect3' => 'format_tocnode', 'sect4' => 'format_tocnode', 'sect5' => 'format_tocnode', 'section' => 'format_tocnode', 'set' => array( /* DEFAULT */ 'format_root_set', 'set' => 'format_set', ), 'setindex' => 'format_tocnode_newpage', ); protected $textmap = array( 'title' => array( /* DEFAULT */ false, 'book' => 'format_bookname', 'set' => array( /* DEFAULT */ 'format_setname', 'set' => false, ), ), ); private $acronyms = array(); /* Common properties for all functions pages */ protected $bookName = ""; protected $outputdir = ""; /* Current Chunk settings */ protected $cchunk = array(); /* Default Chunk settings */ protected $dchunk = array( "bookname" => null, "setname" => null, "toc-root" => null, "id-to-outline" => array(), "id-to-page" => array(), ); public function __construct(array $IDs, array $filenames, $format = "pdf", $chunked = true) { parent::__construct($IDs); $this->format = $format; $this->outputdir = PhDConfig::output_dir() . $this->format . DIRECTORY_SEPARATOR; if(!file_exists($this->outputdir) || is_file($this->outputdir)) mkdir($this->outputdir) or die("Can't create the cache directory"); } public function __destruct() {} // Do nothing public function appendData($data, $isChunk) {} // To override public function format_root_set($open, $name, $attrs, $props) {} public function format_set($open, $name, $attrs, $props) {} public function format_book($open, $name, $attrs, $props) { if ($open) { $this->format->newChunk(); $pdfDoc = new PdfWriter(); $this->format->setPdfDoc($pdfDoc); $this->cchunk = $this->dchunk; $id = $attrs[PhDReader::XMLNS_XML]["id"]; $this->cchunk["id-to-outline"][$id] = $pdfDoc->createOutline(PhDHelper::getDescription($id), null, true); $this->setIdToPage($id); } else { $this->resolveLinks($this->cchunk["bookname"]); $pdfDoc = $this->format->getPdfDoc(); v("Writing PDF Manual (%s)", $this->cchunk["bookname"], VERBOSE_TOC_WRITING); $pdfDoc->saveToFile($this->outputdir . $this->toValidName($this->cchunk["bookname"]) . ".pdf"); unset($pdfDoc); } return false; } public function format_bookname($value, $tag) { $this->cchunk["bookname"] = trim($value); return false; } public function format_setname($value, $tag) { $this->cchunk["setname"] = trim($value); return false; } public function format_tocnode($open, $name, $attrs, $props, $newpage = false) { if ($open) { if ($newpage) $this->format->getPdfDoc()->add(PdfWriter::PAGE); else $this->format->getPdfDoc()->add(PdfWriter::LINE_JUMP); if (isset($attrs[PhDReader::XMLNS_XML]["id"]) && $id = $attrs[PhDReader::XMLNS_XML]["id"]) { $parentId = PhDHelper::getParent($id); $this->cchunk["id-to-outline"][$id] = $this->format->getPdfDoc()->createOutline (PhDHelper::getDescription($id), $this->cchunk["id-to-outline"][$parentId], false); $this->setIdToPage($id); } } return ""; } public function format_tocnode_newpage($open, $name, $attrs, $props) { return $this->format_tocnode($open, $name, $attrs, $props, true); } // Convert the function name to a Unix valid filename protected function toValidName($functionName) { return str_replace(array(":", "::", "->", "/", "\\", " "), array(".", ".", ".", "-", "-", "-"), $functionName); } protected function setIdToPage($id) { if (isset($this->cchunk["id-to-page"]) && is_array($this->cchunk["id-to-page"])) { $this->cchunk["id-to-page"][$id] = $this->format->getPdfDoc()->getCurrentPage(); } } protected function resolveLinks($name) { v("Resolving Internal Links... (%s)", $name, VERBOSE_TOC_WRITING); $linksToResolve = $this->format->getChunkInfo("links-to-resolve"); foreach ($linksToResolve as $link => $targets) { if (isset($this->cchunk["id-to-page"][$link]) && $destPage = $this->cchunk["id-to-page"][$link]) { foreach ($targets as $target) { $page = $target[0]; $rectangle = array($target[1], $target[2], $target[3], $target[4]); $this->format->getPdfDoc()->resolveInternalLink($page, $rectangle, $destPage); } } } } } http://cvs.php.net/viewvc.cgi/phd/formats/pdf.php?view=markup&rev=1.1 Index: phd/formats/pdf.php +++ phd/formats/pdf.php
« previous php.doc.cvs (#1969) next »