From be125adb521de0d7891aca73c0a110aa11ef0a64 Mon Sep 17 00:00:00 2001 From: Mickael Perraud Date: Tue, 20 Dec 2011 19:40:36 +0100 Subject: [PATCH] ZFDocumentor: some corrections and begin the PDF version --- Makefile.in | 33 +++--- generate-doc.sh | 3 + generate-lucene.sh | 1 + searchLanguage.sh | 0 tools/IndexLucene.php | 4 +- tools/phpdotnet/phd/Format/Abstract/PDF.php | 14 ++- tools/phpdotnet/phd/Package/Generic/PDF.php | 4 +- tools/phpdotnet/phd/Package/Mkk/CHM.php | 2 +- .../phd/Package/Mkk/ChunkedXHTML.php | 20 ++-- tools/phpdotnet/phd/Package/Mkk/PDF.php | 105 ++++++++++++++++-- 10 files changed, 148 insertions(+), 38 deletions(-) mode change 100644 => 100755 searchLanguage.sh diff --git a/Makefile.in b/Makefile.in index 7b1380c..f2cbea8 100755 --- a/Makefile.in +++ b/Makefile.in @@ -49,9 +49,9 @@ ZF_LANG=en ZF_VERSION=1.11 # "make" or "make -e" -all: $(MANUAL_XML) htmlhelp +all: html -$(MANUAL_XML): ../standard/branches/release-$(ZF_VERSION)/documentation/manual/en/$(MANUAL_XML).in rev-svn +$(MANUAL_XML): ../standard/branches/release-$(ZF_VERSION)/documentation/manual/en/$(MANUAL_XML).in rev-svn version-zf @echo "Creating temporary manual and preprocessing it..." @rm -Rf ./temp/files/ @rm -Rf ./temp/en/ @@ -83,6 +83,11 @@ $(MANUAL_XML): ../standard/branches/release-$(ZF_VERSION)/documentation/manual/e @php -f tools/ManualXML.php $(ZF_VERSION) @rm -Rf ./temp/files/ +test: + @[ -d temp ] || mkdir temp + echo $(ZF_LANG) | tr [:lower:] [:upper:] > temp/lang + echo "toto" > temp/`cat temp/lang` + docbook-migration: $(MANUAL_XML) $(XSLTPROC) --xinclude ./tools/db4-upgrade.xsl ./temp/manual.xml > ./temp/manual-db5.xml @@ -94,20 +99,19 @@ figures: rev-svn: @[ -d temp ] || mkdir temp @export LANG=en_US.UTF8 - @svn info ../standard/branches/release-$(ZF_VERSION)/documentation/manual/$(ZF_LANG) | grep '^Last Changed Rev' | sed -e 's!Last Changed Rev: !!m' -e 's!(\n)!!' > ./temp/svn_rev \ + @svn info ../standard/branches/release-$(ZF_VERSION)/documentation/manual/$(ZF_LANG) | grep '^Last Changed Rev' | sed -e 's!Last Changed Rev: !!m' | tr -d '\n'> ./temp/svn_rev \ || @echo "Impossible to read svn revision" +version-zf: + @[ -d temp ] || mkdir temp + @php -r "include_once '../standard/branches/release-$(ZF_VERSION)/library/Zend/Version.php'; echo Zend_Version::VERSION;" > ./temp/zf_version + # Build the docs in HTML format website: html zipdoc html: docbook-migration figures - @if [ -d output/website/$(ZF_VERSION)/$(ZF_LANG)/ ] ; then \ - echo "Rendering already done" ; \ - else \ - rm -Rf output/website/$(ZF_VERSION)/$(ZF_LANG)/ ; \ - echo "Rendering the whole manual as html..." ; \ - ./phd --xinclude --forceindex -f xhtml -P Mkk -o output/website/$(ZF_VERSION)/$(ZF_LANG) -d ./temp/manual-db5.xml ; \ - fi + @rm -Rf output/website/$(ZF_VERSION)/$(ZF_LANG)/ + @./phd --xinclude --forceindex -f xhtml -P Mkk -L $(ZF_LANG) -o output/website/$(ZF_VERSION)/$(ZF_LANG) -d ./temp/manual-db5.xml @[ -f output/website/$(ZF_VERSION)/$(ZF_LANG)/index.sqlite ] && rm output/website/$(ZF_VERSION)/$(ZF_LANG)/index.sqlite @[ -d output/website/images ] || mkdir output/website/images @[ -d output/website/scripts ] || mkdir output/website/scripts @@ -125,7 +129,6 @@ zipdoc: @mkdir temp/zfdoc/scripts @mkdir temp/zfdoc/styles @cp -R output/website/$(ZF_VERSION)/$(ZF_LANG)/* temp/zfdoc - @[ -f temp/zfdoc/index.sqlite ] && rm temp/zfdoc/index.sqlite @cp -R output/website/figures/*.* temp/zfdoc/figures @cp -f images/*.* temp/zfdoc/images @cp -f styles/*.* temp/zfdoc/styles @@ -135,15 +138,14 @@ zipdoc: @echo '.editions{display:none;}' >> temp/zfdoc/styles/zfdocumentor.css @echo '#searchZf{display:none;}' >> temp/zfdoc/styles/zfdocumentor.css @echo '#header{height:60px;}' >> temp/zfdoc/styles/zfdocumentor.css - @(cd temp ; zip -q -r ../docs/Zend_Framework_$(ZF_VERSION).x_$(ZF_LANG).zip zfdoc) + @(cd temp ; zip -q -r ../docs/Zend_Framework_$(ZF_VERSION).x_`echo $(ZF_LANG) | tr [:lower:] [:upper:]`.zip zfdoc) lucene: @php -f tools/IndexLucene.php $(ZF_VERSION) $(ZF_LANG) htmlhelp: docbook-migration figures @rm -Rf output/htmlhelp/$(ZF_VERSION)/$(ZF_LANG)/ - @echo "Rendering the whole manual as htmlhelp..." - ./phd --xinclude --forceindex -f chm -P Mkk -o output/htmlhelp/$(ZF_VERSION)/$(ZF_LANG) -d ./temp/manual-db5.xml + @./phd --xinclude --forceindex -f chm -P Mkk -L $(ZF_LANG) -o output/htmlhelp/$(ZF_VERSION)/$(ZF_LANG) -d ./temp/manual-db5.xml @cp -f figures/*.* output/htmlhelp/$(ZF_VERSION)/$(ZF_LANG)/res @cp -f images/*.* output/htmlhelp/$(ZF_VERSION)/$(ZF_LANG)/res @cp -f styles/*.* output/htmlhelp/$(ZF_VERSION)/$(ZF_LANG)/res @@ -163,7 +165,7 @@ chm: htmlhelp # Build the docs in PDF format pdf: docbook-migration figures @rm -Rf output/pdf/$(ZF_VERSION)/$(ZF_LANG)/ - ./phd --xinclude --forceindex -f chm -P Mkk -o output/pdf/$(ZF_VERSION)/$(ZF_LANG) -d ./temp/manual-db5.xml + @./phd --xinclude --forceindex -g 'phpdotnet\phd\Highlighter_GeSHi' -f pdf -P Mkk -L $(ZF_LANG) -o output/pdf/$(ZF_VERSION)/$(ZF_LANG) -d ./temp/manual-db5.xml # checking manual check: $(MANUAL_XML) @@ -193,6 +195,7 @@ clean: cleanall: clean -rm -Rf ./output -rm -Rf ./figures + -rm -Rf ./docs -rm -f config.* configure -rm -rf autom4te.cache -rm -f Makefile diff --git a/generate-doc.sh b/generate-doc.sh index 2540eb9..412c52f 100755 --- a/generate-doc.sh +++ b/generate-doc.sh @@ -18,7 +18,10 @@ # date export LANG=en_US.UTF8 +export LANGUAGE=en_US.UTF8 echo Cleaning +autoconf +./configure make clean make -e website ZF_LANG=en ZF_VERSION=1.11 make -e website ZF_LANG=de ZF_VERSION=1.11 diff --git a/generate-lucene.sh b/generate-lucene.sh index 0f61bfa..63898c3 100755 --- a/generate-lucene.sh +++ b/generate-lucene.sh @@ -18,6 +18,7 @@ # date export LANG=en_US.UTF8 +export LANGUAGE=en_US.UTF8 echo Cleaning make -e lucene ZF_LANG=en ZF_VERSION=1.11 make -e lucene ZF_LANG=de ZF_VERSION=1.11 diff --git a/searchLanguage.sh b/searchLanguage.sh old mode 100644 new mode 100755 diff --git a/tools/IndexLucene.php b/tools/IndexLucene.php index 40f10ac..63bf2f3 100755 --- a/tools/IndexLucene.php +++ b/tools/IndexLucene.php @@ -41,9 +41,9 @@ public static function makeSearchIndexAction($version = '1.11', $lang = 'en') $index->addDocument($doc); } } - echo ' - optimisation...'; + echo ' - optimisation...' . PHP_EOL; $index->optimize(); - echo "Index is created and optimized."; + echo "Index is created and optimized." . PHP_EOL; } /** diff --git a/tools/phpdotnet/phd/Format/Abstract/PDF.php b/tools/phpdotnet/phd/Format/Abstract/PDF.php index d8cc223..92b0cee 100644 --- a/tools/phpdotnet/phd/Format/Abstract/PDF.php +++ b/tools/phpdotnet/phd/Format/Abstract/PDF.php @@ -4,7 +4,7 @@ abstract class Format_Abstract_PDF extends Format { protected $pdfDoc; - + public function getPdfDoc() { return $this->pdfDoc; } @@ -46,6 +46,8 @@ class PdfWriter { const FONT_VERBATIM = 0x04; const FONT_VERBATIM_ITALIC = 0x05; const FONT_MANUAL = 0x06; + const FONT_VERBATIM_BOLD = 0x07; + const FONT_VERBATIM_BOLDITALIC = 0x08; // "Objects" constants (for add()) const PARA = 0x10; @@ -151,7 +153,9 @@ function __construct($pageWidth = 210, $pageHeight = 297) { $this->fonts["Helvetica-Bold"] = $this->haruDoc->getFont("Helvetica-Bold", "WinAnsiEncoding"); $this->fonts["Helvetica-Oblique"] = $this->haruDoc->getFont("Helvetica-Oblique", "WinAnsiEncoding"); $this->fonts["Courier"] = $this->haruDoc->getFont("Courier", "WinAnsiEncoding"); + $this->fonts["Courier-Bold"] = $this->haruDoc->getFont("Courier-Bold", "WinAnsiEncoding"); $this->fonts["Courier-Oblique"] = $this->haruDoc->getFont("Courier-Oblique", "WinAnsiEncoding"); + $this->fonts["Courier-BoldOblique"] = $this->haruDoc->getFont("Courier-BoldOblique", "WinAnsiEncoding"); // Add first page and default font settings $this->currentFont = $this->fonts["Helvetica"]; @@ -454,10 +458,18 @@ public function setFont($type, $size = null, $color = null, $font = null) { $this->currentPage->setFontAndSize($this->currentFont = $this->fonts["Courier"], $this->currentFontSize); break; + case self::FONT_VERBATIM_BOLD: + $this->currentPage->setFontAndSize($this->currentFont = $this->fonts["Courier-Bold"], + $this->currentFontSize); + break; case self::FONT_VERBATIM_ITALIC: $this->currentPage->setFontAndSize($this->currentFont = $this->fonts["Courier-Oblique"], $this->currentFontSize); break; + case self::FONT_VERBATIM_BOLDITALIC: + $this->currentPage->setFontAndSize($this->currentFont = $this->fonts["Courier-BoldOblique"], + $this->currentFontSize); + break; case self::FONT_MANUAL: $this->currentPage->setFontAndSize($this->currentFont = $font, $this->currentFontSize); break; diff --git a/tools/phpdotnet/phd/Package/Generic/PDF.php b/tools/phpdotnet/phd/Package/Generic/PDF.php index ca9a4de..1a0c01c 100644 --- a/tools/phpdotnet/phd/Package/Generic/PDF.php +++ b/tools/phpdotnet/phd/Package/Generic/PDF.php @@ -299,7 +299,7 @@ abstract class Package_Generic_PDF extends Format_Abstract_PDF { public function __construct() { parent::__construct(); $this->setExt(Config::ext() === null ? ".pdf" : Config::ext()); - $this->pdfDoc = new PdfWriter(); + $this->pdfDoc = new PdfWriter(); } public function __destruct() { @@ -510,7 +510,7 @@ public function format_verbatim_block($open, $name, $attrs, $props) { public function format_verbatim_inline($open, $name, $attrs, $props) { if ($open) { - $this->pdfDoc->setFont(PdfWriter::FONT_VERBATIM, 10); + $this->pdfDoc->setFont(PdfWriter::FONT_VERBATIM, 12); } else { $this->pdfDoc->revertFont(); } diff --git a/tools/phpdotnet/phd/Package/Mkk/CHM.php b/tools/phpdotnet/phd/Package/Mkk/CHM.php index 1b75c36..d1de34a 100644 --- a/tools/phpdotnet/phd/Package/Mkk/CHM.php +++ b/tools/phpdotnet/phd/Package/Mkk/CHM.php @@ -332,7 +332,7 @@ protected function headerChm() { fwrite($this->hhpStream, '[OPTIONS] Binary TOC=Yes Compatibility=1.1 or later -Compiled file=zf.chm +Compiled file=../../Zend_Framework_' . $this->minorZf . '.x_' . strtoupper($this->lang) . '.chm Contents file=zf.hhc Default Font=' . ($this->LANGUAGES[$lang]["preferred_font"] ? $this->LANGUAGES[$lang]["preferred_font"] : self::DEFAULT_FONT). ' Default topic=res' . DIRECTORY_SEPARATOR . 'manual.html diff --git a/tools/phpdotnet/phd/Package/Mkk/ChunkedXHTML.php b/tools/phpdotnet/phd/Package/Mkk/ChunkedXHTML.php index 0a831e7..f721588 100644 --- a/tools/phpdotnet/phd/Package/Mkk/ChunkedXHTML.php +++ b/tools/phpdotnet/phd/Package/Mkk/ChunkedXHTML.php @@ -4,9 +4,9 @@ class Package_Mkk_ChunkedXHTML extends Package_Generic_ChunkedXHTML { - private $minorZf = '1.11'; - private $revisionZf = '1.11.11'; - private $revisionSvn = 24783; + protected $minorZf = null; + protected $revisionZf = null; + protected $revisionSvn = null; private $myelementmap = array(); private $replaceElementMap = array( @@ -41,6 +41,10 @@ class Package_Mkk_ChunkedXHTML extends Package_Generic_ChunkedXHTML public function __construct() { + // Read ZF version + $this->revisionSvn = file_get_contents('temp/svn_rev'); + $this->revisionZf = file_get_contents('temp/zf_version'); + $this->minorZf = implode('.', array_slice(explode('.', $this->revisionZf), 0, 2)); parent::__construct(); $this->zfOutputDir = Config::output_dir(); $this->registerFormatName("Mkk-Chunked-XHTML"); @@ -79,10 +83,10 @@ public function format_programlisting($open, $name, $attrs) $tag = '
role = $attrs[Reader::XMLNS_DOCBOOK]["language"];
-                $tag .= ' brush: ' . $this->role;
             } else {
-                $this->role = false;
+                $this->role = 'php';
             }
+            $tag .= ' brush: ' . $this->role;
 
             $tag .= '">';
             return $tag;
@@ -166,9 +170,9 @@ public function header($id)
   
 
   
- Downloadable version of this documentation - PDF version of this documentation - CHM version of this documentation + Downloadable version of this documentation + PDF version of this documentation + CHM version of this documentation