php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #51654
Patch phd-ext-ternary.patch revision 2010-04-25 20:22 UTC by pmjones88 at gmail dot com
Patch phd-ext.patch revision 2010-04-24 15:56 UTC by pmjones88 at gmail dot com

Patch phd-ext.patch for Doc Build problem Bug #51654

Patch version 2010-04-24 15:56 UTC

Return to Bug #51654 | Download this patch
Patch Revisions:

Developer: pmjones88@gmail.com

Index: phd/Package/IDE/Funclist.php
===================================================================
--- phd/Package/IDE/Funclist.php	(revision 298406)
+++ phd/Package/IDE/Funclist.php	(working copy)
@@ -17,7 +17,7 @@
 
     public function __construct() {
         $this->registerFormatName("IDE-Funclist");
-        $this->setExt("txt");
+        $this->setExt(Config::ext() === null ? ".txt" : Config::ext());
     }
 
     public function createLink($for, &$desc = null, $type = Format::SDESC) {}
@@ -39,7 +39,7 @@
             $this->registerTextMap($this->textmap);
             break;
        case Render::FINALIZE:
-            $filename = Config::output_dir() . strtolower($this->getFormatName()) . '.' . $this->getExt();
+            $filename = Config::output_dir() . strtolower($this->getFormatName()) . $this->getExt();
             file_put_contents($filename, $this->buffer);
             break;
         case Render::VERBOSE:            
Index: phd/Package/IDE/Functions.php
===================================================================
--- phd/Package/IDE/Functions.php	(revision 298406)
+++ phd/Package/IDE/Functions.php	(working copy)
@@ -75,7 +75,7 @@
 
     public function __construct() {
         $this->registerFormatName("IDE-Functions");
-        $this->setExt("xml");
+        $this->setExt(Config::ext() === null ? ".xml" : Config::ext());
     }
 
     public function createLink($for, &$desc = null, $type = Format::SDESC) {}
@@ -149,13 +149,13 @@
              return;
         }
         $index = 0;
-        $filename = $this->getOutputDir() . $this->cchunk["funcname"][$index] . '.' .$this->getExt();
+        $filename = $this->getOutputDir() . $this->cchunk["funcname"][$index] . $this->getExt();
 
         rewind($fp);
         file_put_contents($filename, $this->header());
         file_put_contents($filename, $fp, FILE_APPEND);
         while(isset($this->cchunk["funcname"][++$index])) {
-            $filename = $this->getOutputDir() . $this->cchunk["funcname"][$index] . '.' . $this->getExt();
+            $filename = $this->getOutputDir() . $this->cchunk["funcname"][$index] . $this->getExt();
             rewind($fp);
             // Replace the default function name by the alternative one
             $content = preg_replace('/'.$this->cchunk["funcname"][0].'/',
Index: phd/Package/PEAR/XHTML.php
===================================================================
--- phd/Package/PEAR/XHTML.php	(revision 298406)
+++ phd/Package/PEAR/XHTML.php	(working copy)
@@ -471,7 +471,7 @@
                     $fragment = "#$linkto";
                 }
                 if ($this->chunked) {
-                    $href .= '.'.$this->ext;
+                    $href .= $this->ext;
                 }
             } elseif (isset($attrs[Reader::XMLNS_XLINK]['href'])) {
                 $href = $attrs[Reader::XMLNS_XLINK]['href'];
@@ -744,7 +744,7 @@
     {
         if ($open) {
             if ($this->chunked) {
-                return '<p class="'.$name.'"><a href="copyright.' . $this->ext . '">Copyright</a> &copy; ';
+                return '<p class="'.$name.'"><a href="copyright' . $this->ext . '">Copyright</a> &copy; ';
             } else {
                 return '<p class="'.$name.'"><a href="#copyright">Copyright</a> &copy; ';
             }
Index: phd/Package/PEAR/Web.php
===================================================================
--- phd/Package/PEAR/Web.php	(revision 298406)
+++ phd/Package/PEAR/Web.php	(working copy)
@@ -19,7 +19,7 @@
     {
         parent::__construct();
         $this->registerFormatName('PEAR-Web');
-        $this->setExt('php');
+        $this->setExt(Config::ext() === null ? 'php' : Config::ext());
     }
 
     public function __destruct()
@@ -36,7 +36,7 @@
      */
     public function header($id)
     {
-        $ext = '.' . $this->ext;
+        $ext = $this->ext;
 
         $parent = Format::getParent($id);
 
@@ -125,7 +125,7 @@
      */
     public function footer($id)
     {
-        $ext = '.' . $this->ext;
+        $ext = $this->ext;
         $parent = Format::getParent($id);
 
         return '<?php manualFooter("'
Index: phd/Package/PEAR/BigXHTML.php
===================================================================
--- phd/Package/PEAR/BigXHTML.php	(revision 298406)
+++ phd/Package/PEAR/BigXHTML.php	(working copy)
@@ -7,7 +7,7 @@
         parent::__construct();
         $this->registerFormatName("PEAR-BigXHTML");
         $this->setTitle("PEAR Manual");
-        $this->setExt("html");
+        $this->setExt(Config::ext() === null ? ".html" : Config::ext());
         $this->setChunked(false);
     }
 
@@ -43,7 +43,7 @@
     }
 
     public function createFileName() {
-        return Config::output_dir() . strtolower($this->getFormatName()) . '.' . $this->getExt();
+        return Config::output_dir() . strtolower($this->getFormatName()) . $this->getExt();
     }
 
     public function createOutputFile() {
Index: phd/Package/PEAR/ChunkedXHTML.php
===================================================================
--- phd/Package/PEAR/ChunkedXHTML.php	(revision 298406)
+++ phd/Package/PEAR/ChunkedXHTML.php	(working copy)
@@ -7,7 +7,7 @@
         parent::__construct();        
         $this->registerFormatName("PEAR-Chunked-XHTML");
         $this->setTitle("PEAR Manual");
-        $this->setExt("html");
+        $this->setExt(Config::ext() === null ? ".html" : Config::ext());
         $this->setChunked(true);
     }
 
@@ -40,7 +40,7 @@
     }
 
     public function writeChunk($id, $fp) {
-        $filename = $this->getOutputDir() . $id . '.' .$this->getExt();
+        $filename = $this->getOutputDir() . $id . $this->getExt();
 
         rewind($fp);
         file_put_contents($filename, $this->header($id));
@@ -109,15 +109,15 @@
         $strPrev = $strNext = '';
 
         if ($parentId = $this->getParent($id)) {
-            $this->up = array("href" => $this->getFilename($parentId) . '.' .$this->ext,
+            $this->up = array("href" => $this->getFilename($parentId) . $this->ext,
                 "desc" => $this->getShortDescription($parentId));
         }
         if ($prevId = Format::getPrevious($id)) {
-            $this->prev = array("href" => Format::getFilename($prevId) . '.' .$this->ext,
+            $this->prev = array("href" => Format::getFilename($prevId) . $this->ext,
                 "desc" => $this->getShortDescription($prevId));
         }
         if ($nextId = Format::getNext($id)) {
-            $this->next = array("href" => Format::getFilename($nextId) . '.' .$this->ext,
+            $this->next = array("href" => Format::getFilename($nextId) . $this->ext,
                 "desc" => $this->getShortDescription($nextId));
         }
         $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Index: phd/Package/PEAR/CHM.php
===================================================================
--- phd/Package/PEAR/CHM.php	(revision 298406)
+++ phd/Package/PEAR/CHM.php	(working copy)
@@ -388,7 +388,7 @@
 			$this->lastContent = array(
 				"name" => Format::getShortDescription($id),
 				"reference" => "res\\" .
-					(Format::getFilename($id) ? Format::getFilename($id) : $id) . "." . $this->ext,
+					(Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->ext,
 				"hasChild" => (count(Format::getChildren($id)) > 0)
 			);
 		}
Index: phd/Package/PHP/KDevelop.php
===================================================================
--- phd/Package/PHP/KDevelop.php	(revision 298406)
+++ phd/Package/PHP/KDevelop.php	(working copy)
@@ -70,7 +70,7 @@
         parent::__construct();
         $this->registerFormatName("PHP-KDevelop");
         $this->setTitle("PHP Manual");
-        $this->setExt("php");
+        $this->setExt(Config::ext() === null ? ".php" : Config::ext());
     }
 
     public function __destruct() {
@@ -128,7 +128,7 @@
         $hasChild = (count(Format::getChildren($id)) > 0);
         if ($open) {
             $name = htmlspecialchars(Format::getShortDescription($id), ENT_QUOTES, 'UTF-8');
-            $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . "." . $this->getExt();
+            $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt();
             fwrite($this->getFileStream(), "<tocsect1 name=\"{$name}\" url=\"{$url}\"" . ($hasChild ? "" : "/") . ">\n");
         } else {
             if ($hasChild)
@@ -143,7 +143,7 @@
         $hasChild = (count(Format::getChildren($id)) > 0);
         if ($open) {
             $name = htmlspecialchars(Format::getShortDescription($id), ENT_QUOTES, 'UTF-8');
-            $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . "." . $this->getExt();
+            $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt();
             fwrite($this->getFileStream(), "    <tocsect2 name=\"{$name}\" url=\"{$url}\"/>\n");
         }
         return "";
@@ -156,7 +156,7 @@
             $this->currentEntryName = null;
         }
         if (!$open && $this->currentEntryName) {
-            $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . "." . $this->getExt();
+            $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt();
             $this->index[$this->currentEntryName] = $url;
         }
         return "";
Index: phd/Package/PHP/PDF.php
===================================================================
--- phd/Package/PHP/PDF.php	(revision 298406)
+++ phd/Package/PHP/PDF.php	(working copy)
@@ -166,7 +166,7 @@
             $this->resolveLinks($this->cchunk["bookname"]);
             $pdfDoc = parent::getPdfDoc();
             v("Writing PDF Manual (%s)", $this->cchunk["bookname"], VERBOSE_TOC_WRITING);
-            $pdfDoc->saveToFile($this->getOutputDir() . $this->toValidName($this->cchunk["bookname"]) . "." . $this->getExt());
+            $pdfDoc->saveToFile($this->getOutputDir() . $this->toValidName($this->cchunk["bookname"]) . $this->getExt());
             unset($pdfDoc);
         }
         return false;
Index: phd/Package/PHP/BigPDF.php
===================================================================
--- phd/Package/PHP/BigPDF.php	(revision 298406)
+++ phd/Package/PHP/BigPDF.php	(working copy)
@@ -52,7 +52,7 @@
             $this->resolveLinks($this->cchunk["setname"]);
             $pdfDoc = parent::getPdfDoc();
             v("Writing Full PDF Manual (%s)", $this->cchunk["setname"], VERBOSE_TOC_WRITING);
-            $pdfDoc->saveToFile($this->getOutputDir() . strtolower($this->getFormatName()) . "." . $this->getExt());
+            $pdfDoc->saveToFile($this->getOutputDir() . strtolower($this->getFormatName()) . $this->getExt());
             unset($pdfDoc);
         }
         return "";
Index: phd/Package/PHP/XHTML.php
===================================================================
--- phd/Package/PHP/XHTML.php	(revision 298406)
+++ phd/Package/PHP/XHTML.php	(working copy)
@@ -261,9 +261,9 @@
 
                 if ($this->chunked) {
                     if ($href != $linkto) {
-                        $href .= ".{$this->ext}#{$linkto}";
+                        $href .= "{$this->ext}#{$linkto}";
                     } else {
-                        $href .= '.' .$this->ext;
+                        $href .= $this->ext;
                     }
                 } else {
                     $href = '#' .$linkto;
@@ -294,7 +294,7 @@
         }
         if (($filename = $this->getVarnameLink($var)) !== null && !in_array($var, $this->cchunk["refname"])) {
             if ($this->chunked) {
-                return '<var class="varname"><a href="'.$filename. '.' .$this->ext. '" class="classname">' .$value. '</a></var>';
+                return '<var class="varname"><a href="'.$filename.$this->ext.'" class="classname">' .$value. '</a></var>';
             }
             return '<var><a href="#'.$filename. '" class="classname">'.$value.'</a></var>';
         }
@@ -345,7 +345,7 @@
         }
 
         if ($href && $this->chunked) {
-            return '<a href="' .$href. '.' .$this->getExt().($fragment ? "#$fragment" : ""). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>';
+            return '<a href="' .$href. $this->getExt().($fragment ? "#$fragment" : ""). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>';
         }
         if ($href) {
             return '<a href="#' .($fragment ? $fragment : $href). '" class="' .$tagname. ' ' .$type. '">' .$type. '</a>';
@@ -407,7 +407,7 @@
                 }
 
                 if ($this->chunked) {
-                    return '<a href="'.$filename. '.' .$this->ext. '" class="function"'.$rel.'>' .$display_value.($tag == "function" ? "()" : ""). '</a>'.$desc;
+                    return '<a href="'.$filename. $this->ext. '" class="function"'.$rel.'>' .$display_value.($tag == "function" ? "()" : ""). '</a>'.$desc;
                 }
                 return '<a href="#'.$filename. '" class="function"'.$rel.'>' .$display_value.($tag == "function" ? "()" : ""). '</a>'.$desc;
             }
@@ -429,7 +429,7 @@
     public function format_classname_text($value, $tag) {
         if (($filename = $this->getClassnameLink(strtolower($value))) !== null && $this->cchunk["phpdoc:classref"] !== strtolower($value)) {
             if ($this->chunked) {
-                return '<a href="'.$filename. '.' .$this->ext. '" class="' .$tag. '">' .$value. '</a>';
+                return '<a href="'.$filename. $this->ext. '" class="' .$tag. '">' .$value. '</a>';
             }
             return '<a href="#'.$filename. '" class="' .$tag. '">'.$value.'</a>';
         }
@@ -455,7 +455,7 @@
                 $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_'.$name.'">';
                 foreach($chunks as $chunkid) {
                     if ($this->chunked) {
-                        $content .= '<li><a href="'.$chunkid. '.' .$this->ext. '">' .(Format::getShortDescription($chunkid)). '</a></li>';
+                        $content .= '<li><a href="'.$chunkid. $this->ext. '">' .(Format::getShortDescription($chunkid)). '</a></li>';
                     } else {
                         $content .= '<li><a href="#'.$chunkid. '">' .(Format::getShortDescription($chunkid)). '</a></li>';
                     }
@@ -474,7 +474,7 @@
                 $content = '<h2>'.$this->autogen("toc", $props["lang"]). '</h2><ul class="chunklist chunklist_reference">';
                 foreach($chunks as $chunkid) {
                     if ($this->chunked) {
-                        $content .= '<li><a href="'.$chunkid. '.' .$this->ext. '">' .(Format::getShortDescription($chunkid)). '</a> — ' .(Format::getLongDescription($chunkid)). '</li>';
+                        $content .= '<li><a href="'.$chunkid. $this->ext. '">' .(Format::getShortDescription($chunkid)). '</a> — ' .(Format::getLongDescription($chunkid)). '</li>';
                     } else {
                         $content .= '<li><a href="#'.$chunkid.'">' .(Format::getShortDescription($chunkid)). '</a> — ' .(Format::getLongDescription($chunkid)). '</li>';
                     }
@@ -497,7 +497,7 @@
         $chunks = Format::getChildren($id);
         $content = '<ul class="chunklist chunklist_'.$name.'">';
         foreach($chunks as $chunkid) {
-            $href = $this->chunked ? $chunkid .'.'. $this->ext : "#$chunkid";
+            $href = $this->chunked ? $chunkid . $this->ext : "#$chunkid";
             $long = Format::getLongDescription($chunkid);
             $short = Format::getShortDescription($chunkid);
             if ($long && $short && $long != $short) {
@@ -509,7 +509,7 @@
             if (count($children)) {
                 $content .= '<ul class="chunklist chunklist_'.$name.' chunklist_children">';
                 foreach(Format::getChildren($chunkid) as $childid) {
-                    $href = $this->chunked ? $childid .'.'. $this->ext : "#$childid";
+                    $href = $this->chunked ? $childid . $this->ext : "#$childid";
                     $long = Format::getLongDescription($childid);
                     $short = Format::getShortDescription($childid);
                     if ($long && $short && $long != $short) {
Index: phd/Package/PHP/Web.php
===================================================================
--- phd/Package/PHP/Web.php	(revision 298406)
+++ phd/Package/PHP/Web.php	(working copy)
@@ -8,7 +8,7 @@
         $this->registerFormatName("PHP-Web");
         $this->setTitle("PHP Manual");
         $this->setChunked(true);
-        $this->setExt("php");
+        $this->setExt(Config::ext() === null ? ".php" : Config::ext());
     }
 
     public function close() {
@@ -46,7 +46,7 @@
     }
 
     public function writeChunk($id, $fp) {
-        $filename = $this->getOutputDir() . $id . '.' .$this->getExt();
+        $filename = $this->getOutputDir() . $id . $this->getExt();
 
         rewind($fp);
         file_put_contents($filename, $this->header($id));
@@ -96,7 +96,7 @@
     }
 
     public function header($id) {
-        $ext = '.' . $this->getExt();
+        $ext = $this->getExt();
         $parent = Format::getParent($id);
         $filename = "toc" . DIRECTORY_SEPARATOR . $parent . ".inc";
         $up = array(0 => null, 1 => null);
Index: phd/Package/PHP/BigXHTML.php
===================================================================
--- phd/Package/PHP/BigXHTML.php	(revision 298406)
+++ phd/Package/PHP/BigXHTML.php	(working copy)
@@ -40,7 +40,7 @@
     }
 
     public function createFileName() {
-        return Config::output_dir() . strtolower($this->getFormatName()) . '.' . $this->getExt(); 
+        return Config::output_dir() . strtolower($this->getFormatName()) . $this->getExt(); 
     }
 
     public function createOutputFile() {
Index: phd/Package/PHP/ChunkedXHTML.php
===================================================================
--- phd/Package/PHP/ChunkedXHTML.php	(revision 298406)
+++ phd/Package/PHP/ChunkedXHTML.php	(working copy)
@@ -8,7 +8,7 @@
     public function __construct() {
         parent::__construct();
         $this->registerFormatName("PHP-Chunked-XHTML");
-        $this->setExt("html");
+        $this->setExt(Config::ext() === null ? ".html" : Config::ext());
     }
 
     public function __destruct() {
@@ -36,19 +36,19 @@
         if ($parent && $parent != "ROOT") {
             if ($prevId = Format::getPrevious($id)) {
                 $prev = array(
-                    "href" => $this->getFilename($prevId) . "." . $this->getExt(),
+                    "href" => $this->getFilename($prevId) . $this->getExt(),
                     "desc" => $this->getShortDescription($prevId),
                 );
             }
             if ($nextId = Format::getNext($id)) {
                 $next = array(
-                    "href" => $this->getFilename($nextId) . "." . $this->getExt(),
+                    "href" => $this->getFilename($nextId) . $this->getExt(),
                     "desc" => $this->getShortDescription($nextId),
                 );
             }
             if ($parentId = Format::getParent($id)) {
                 $up = array(
-                    "href" => $this->getFilename($parentId) . "." . $this->getExt(),
+                    "href" => $this->getFilename($parentId) . $this->getExt(),
                     "desc" => $this->getShortDescription($parentId),
                 );
             }
Index: phd/Package/PHP/HowTo.php
===================================================================
--- phd/Package/PHP/HowTo.php	(revision 298406)
+++ phd/Package/PHP/HowTo.php	(working copy)
@@ -48,17 +48,17 @@
             $siblings = Format::getChildren($parent);
             if ($nextId = Format::getNext($id)) {
                 $next = array(
-                    Format::getFilename($nextId) . '.' . $this->getExt(),
+                    Format::getFilename($nextId) . $this->getExt(),
                     Format::getShortDescription($nextId),
                 );
             }
             if ($prevId = Format::getPrevious($id)) {
                 $prev = array(
-                    Format::getFilename($prevId) . '.' . $this->getExt(),
+                    Format::getFilename($prevId) . $this->getExt(),
                     Format::getShortDescription($prevId),
                 );
             }
-            $up = array($parent . '.' . $this->getExt(), Format::getShortDescription($parent));
+            $up = array($parent . $this->getExt(), Format::getShortDescription($parent));
         }
 
         $this->nav = <<<NAV
Index: phd/Package/PHP/CHM.php
===================================================================
--- phd/Package/PHP/CHM.php	(revision 298406)
+++ phd/Package/PHP/CHM.php	(working copy)
@@ -405,7 +405,7 @@
             $this->lastContent = array(
                 "name" => Format::getShortDescription($id),
                 "reference" => "res" . DIRECTORY_SEPARATOR .
-                    (Format::getFilename($id) ? Format::getFilename($id) : $id) . "." . $this->ext,
+                    (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->ext,
                 "hasChild" => (count(Format::getChildren($id)) > 0)
             );
         }
Index: phd/Package/PHP/Functions.php
===================================================================
--- phd/Package/PHP/Functions.php	(revision 298406)
+++ phd/Package/PHP/Functions.php	(working copy)
@@ -45,7 +45,7 @@
         parent::__construct();
         $this->registerFormatName("PHP-Functions");
         $this->setTitle("PHP Manual");
-        $this->setExt("3.gz");
+        $this->setExt(Config::ext() === null ? ".3.gz" : Config::ext());
         $this->setChunked(true); 
         $this->dchunk = array_merge(parent::getDefaultChunkInfo(), static::getDefaultChunkInfo());
     }
@@ -98,7 +98,7 @@
         $index = 0;
         rewind($stream);
 
-        $filename = $this->cchunk["funcname"][$index] . '.' .$this->getExt();
+        $filename = $this->cchunk["funcname"][$index] . $this->getExt();
         $gzfile = gzopen($this->getOutputDir() . $filename, "w9");
 
         gzwrite($gzfile, $this->header($index));
@@ -107,7 +107,7 @@
         v("Wrote %s", $this->getOutputDir() . $filename, VERBOSE_CHUNK_WRITING);
 
         while(isset($this->cchunk["funcname"][++$index])) {
-            $filename = $this->cchunk["funcname"][$index] . '.' . $this->getExt();
+            $filename = $this->cchunk["funcname"][$index] . $this->getExt();
             rewind($stream);
             // Replace the default function name by the alternative one
             $content = preg_replace('/'.$this->cchunk["funcname"][0].'/',
Index: phd/Package/Generic/PDF.php
===================================================================
--- phd/Package/Generic/PDF.php	(revision 298406)
+++ phd/Package/Generic/PDF.php	(working copy)
@@ -298,7 +298,7 @@
 
     public function __construct() {
         parent::__construct();
-        $this->setExt("pdf");
+        $this->setExt(Config::ext() === null ? ".pdf" : Config::ext());
         $this->pdfDoc = new PdfWriter(); 
     }
 
Index: phd/Package/Generic/TocFeed.php
===================================================================
--- phd/Package/Generic/TocFeed.php	(revision 298406)
+++ phd/Package/Generic/TocFeed.php	(working copy)
@@ -138,7 +138,7 @@
         $this->registerFormatName($this->formatName);
         $this->setTitle('Index');
         $this->setChunked(true);
-        $this->setExt('atom');
+        $this->setExt(Config::ext() === null ? ".atom" : Config::ext());
         $this->date = date('c');
         if ($this->feedBaseUri === null) {
             $this->feedBaseUri = $this->targetBaseUri;
@@ -281,7 +281,7 @@
 
         $filename = $this->getOutputDir()
             . $filepart
-            . '.' . $this->getExt();
+            . $this->getExt();
 
 
         file_put_contents($filename, $this->header($id));
@@ -497,7 +497,7 @@
      */
     public function createLink($id, &$desc = null, $type = Format::SDESC)
     {
-        return $this->feedBaseUri . $id . '.' . $this->ext;
+        return $this->feedBaseUri . $id . $this->ext;
     }
 
     /**
Index: phd/Package/Generic/XHTML.php
===================================================================
--- phd/Package/Generic/XHTML.php	(revision 298406)
+++ phd/Package/Generic/XHTML.php	(working copy)
@@ -448,9 +448,9 @@
     public function __construct() {
         parent::__construct();
         $this->registerPIHandlers($this->pihandlers);
-        $this->setExt("html");
+        $this->setExt(Config::ext() === null ? ".html" : Config::ext());
     }
-
+    
     public function getDefaultElementMap() {
         return $this->myelementmap;
     }
@@ -518,7 +518,7 @@
         $retval = null;
         if (isset($this->indexes[$for])) {
             $rsl = $this->indexes[$for];
-            $retval = $rsl["filename"] . "." . $this->ext;
+            $retval = $rsl["filename"] . $this->ext;
             if ($rsl["filename"] != $rsl["docbook_id"]) {
                 $retval .= '#' . $rsl["docbook_id"];
             }
Index: phd/Package/Generic/BigXHTML.php
===================================================================
--- phd/Package/Generic/BigXHTML.php	(revision 298406)
+++ phd/Package/Generic/BigXHTML.php	(working copy)
@@ -77,7 +77,7 @@
         case Render::INIT:
             if ($val) {
                 if (!is_resource($this->getFileStream())) {
-                    $filename = Config::output_dir() . strtolower($this->getFormatName()) . '.' . $this->getExt();
+                    $filename = Config::output_dir() . strtolower($this->getFormatName()) . $this->getExt();
                     $this->postConstruct();
                     if (Config::css()) {
                         $this->fetchStylesheet();
Index: phd/Package/Generic/ChunkedXHTML.php
===================================================================
--- phd/Package/Generic/ChunkedXHTML.php	(revision 298406)
+++ phd/Package/Generic/ChunkedXHTML.php	(working copy)
@@ -39,7 +39,7 @@
     }
 
     public function writeChunk($id, $fp) {
-        $filename = $this->getOutputDir() . Format::getFilename($id) . '.' . $this->getExt();
+        $filename = $this->getOutputDir() . Format::getFilename($id) . $this->getExt();
 
         rewind($fp);
         file_put_contents($filename, $this->header($id));
@@ -99,15 +99,15 @@
         $prev = $next = $parent = array("href" => null, "desc" => null);
 
         if ($parentId = $this->getParent($id)) {
-            $parent = array("href" => $this->getFilename($parentId) . '.' .$this->getExt(),
+            $parent = array("href" => $this->getFilename($parentId) . $this->getExt(),
                 "desc" => $this->getShortDescription($parentId));
         }
         if ($prevId = Format::getPrevious($id)) {
-            $prev = array("href" => Format::getFilename($prevId) . '.' .$this->getExt(),
+            $prev = array("href" => Format::getFilename($prevId) . $this->getExt(),
                 "desc" => $this->getShortDescription($prevId));
         }
         if ($nextId = Format::getNext($id)) {
-            $next = array("href" => Format::getFilename($nextId) . '.' .$this->getExt(),
+            $next = array("href" => Format::getFilename($nextId) . $this->getExt(),
                 "desc" => $this->getShortDescription($nextId));
         }
         $navBar = $this->createNavBar($id);
@@ -131,7 +131,7 @@
                 '.($prevId ? '<div class="prev" style="text-align: left; float: left;"><a href="' .$prev["href"]. '">' .$prev["desc"]. '</a></div>' : '') .'
                 '.($nextId ? '<div class="next" style="text-align: right; float: right;"><a href="' .$next["href"]. '">' .$next["desc"].'</a></div>' : '') .'
                 '.($parentId ? '<div class="up"><a href="' .$parent["href"]. '">' .$parent["desc"]. '</a></div>' : '') .'
-                <div class="home"><a href="'.$root["filename"].".".$this->getExt().'">'.$root["ldesc"].'</a></div>
+                <div class="home"><a href="'.$root["filename"].$this->getExt().'">'.$root["ldesc"].'</a></div>
             </div><hr/>
 ';
     }
@@ -178,7 +178,7 @@
 }
 </style>
  <ul class="toc">
-  <li class="header home"><a href="'.$root["filename"].".".$this->getExt().'">'.$root["ldesc"].'</a></li>
+  <li class="header home"><a href="'.$root["filename"].$this->getExt().'">'.$root["ldesc"].'</a></li>
 ';
         // Fetch ancestors of the current node
         $ancestors = array();
Index: phd/Config.php
===================================================================
--- phd/Config.php	(revision 298406)
+++ phd/Config.php	(working copy)
@@ -41,6 +41,7 @@
         ),
         'css'               => array(),
         'process_xincludes' => false,
+        'ext'               => null,
     );
 
     public static function init(array $a) {
Index: phd/BuildOptionsParser.php
===================================================================
--- phd/BuildOptionsParser.php	(revision 298406)
+++ phd/BuildOptionsParser.php	(working copy)
@@ -34,6 +34,7 @@
             'package:'     => 'P:',        // The package of formats            
             'css:'         => 'C:',        // External CSS 
             'xinclude'     => 'x',         // Automatically process xinclude directives
+            'ext:'         => 'e:',        // The file-format extension to use, including the dot
         );
     }
 
@@ -51,7 +52,25 @@
         }
         Config::set_output_format($formats);
     }
-
+    
+    public function option_e($k, $v)
+    {
+        $this->option_ext($k, $v);
+    }
+    public function option_ext($k, $v)
+    {
+        $bool = self::boolval($v);
+        if ($bool === false) {
+            // `--ext=false` means no extension will be used
+            $v = "";
+            Config::setExt($v);
+        } elseif ($bool === null) {
+            // `--ext=true` means use the default extension,
+            // `--ext=".foo"` means use ".foo" as the extension
+            Config::setExt($v);
+        }
+    }
+    
     public function option_g($k, $v)
     {
         $this->option_highlighter($k, $v);
@@ -328,6 +347,9 @@
   --version                  Print the PhD version information
   -h
   --help                     This help
+  -e <extension>
+  --ext <extension>          The alternative filename extension to use, including
+                             the dot. Use 'false' for no extension.
 
 Most options can be passed multiple times for greater effect.
 ";
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC