Skip to content

Commit

Permalink
ZFDocumentor: some corrections and begin the PDF version
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkael committed Dec 20, 2011
1 parent a927c6d commit be125ad
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 38 deletions.
33 changes: 18 additions & 15 deletions Makefile.in
Expand Up @@ -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/
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions generate-doc.sh
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions generate-lucene.sh
Expand Up @@ -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
Expand Down
Empty file modified searchLanguage.sh 100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions tools/IndexLucene.php
Expand Up @@ -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;
}

/**
Expand Down
14 changes: 13 additions & 1 deletion tools/phpdotnet/phd/Format/Abstract/PDF.php
Expand Up @@ -4,7 +4,7 @@

abstract class Format_Abstract_PDF extends Format {
protected $pdfDoc;

public function getPdfDoc() {
return $this->pdfDoc;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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"];
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tools/phpdotnet/phd/Package/Generic/PDF.php
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion tools/phpdotnet/phd/Package/Mkk/CHM.php
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions tools/phpdotnet/phd/Package/Mkk/ChunkedXHTML.php
Expand Up @@ -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(
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -79,10 +83,10 @@ public function format_programlisting($open, $name, $attrs)
$tag = '<pre class="programlisting';
if (isset($attrs[Reader::XMLNS_DOCBOOK]["language"])) {
$this->role = $attrs[Reader::XMLNS_DOCBOOK]["language"];
$tag .= ' brush: ' . $this->role;
} else {
$this->role = false;
$this->role = 'php';
}
$tag .= ' brush: ' . $this->role;

$tag .= '">';
return $tag;
Expand Down Expand Up @@ -166,9 +170,9 @@ public function header($id)
</form>
<div id="alternateDoc" style="position: absolute;top: 10px; right:10px;">
<a href="/docs/Zend_Framework_{shortVersion}.x_{lang}.zip"><img src="/images/zip.png" alt="Downloadable version of this documentation" title="Downloadable version of this documentation" /></a>
<a style="{alternateDoc}" href="/docs/Zend_Framework_{shortVersion}.x_{LANG}.pdf"><img src="/images/pdf.png" alt="PDF version of this documentation" title="PDF version of this documentation" /></a>
<a style="{alternateDoc}" href="/docs/Zend_Framework_{shortVersion}.x_{LANG}.chm"><img src="/images/chm.png" alt="CHM version of this documentation" title="CHM version of this documentation" /></a>
<a href="/docs/Zend_Framework_' . $this->revisionZf . '.x_' . strtoupper($this->lang) . '.zip"><img src="/images/zip.png" alt="Downloadable version of this documentation" title="Downloadable version of this documentation" /></a>
<a style="{alternateDoc}" href="/docs/Zend_Framework_' . $this->revisionZf . '.x_' . strtoupper($this->lang) . '.pdf"><img src="/images/pdf.png" alt="PDF version of this documentation" title="PDF version of this documentation" /></a>
<a style="{alternateDoc}" href="/docs/Zend_Framework_' . $this->revisionZf . '.x_' . strtoupper($this->lang) . '.chm"><img src="/images/chm.png" alt="CHM version of this documentation" title="CHM version of this documentation" /></a>
</div>
<ul class="editions">
Expand Down

0 comments on commit be125ad

Please sign in to comment.