cvs: phd /themes/php phpdotnet.php

From: Date: Wed, 03 Oct 2007 14:18:09 +0000
Subject: cvs: phd /themes/php phpdotnet.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-135@lists.php.net to get a copy of this message
bjori Wed Oct 3 14:18:09 2007 UTC Modified files: /phd/themes/php phpdotnet.php Log: Add example numbering http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.22&r2=1.23&diff_format=u Index: phd/themes/php/phpdotnet.php diff -u phd/themes/php/phpdotnet.php:1.22 phd/themes/php/phpdotnet.php:1.23 --- phd/themes/php/phpdotnet.php:1.22 Mon Oct 1 13:48:53 2007 +++ phd/themes/php/phpdotnet.php Wed Oct 3 14:18:09 2007 @@ -1,5 +1,5 @@ <?php -/* $Id: phpdotnet.php,v 1.22 2007/10/01 13:48:53 bjori Exp $ */ +/* $Id: phpdotnet.php,v 1.23 2007/10/03 14:18:09 bjori Exp $ */ class phpdotnet extends PhDHelper { protected $elementmap = array( @@ -12,12 +12,14 @@ 'article' => 'format_container_chunk_title', 'appendix' => 'format_container_chunk_title', 'chapter' => 'format_container_chunk_title', + 'example' => 'format_example_title', 'part' => 'format_container_chunk_title', 'info' => array( /* DEFAULT */ false, 'article' => 'format_container_chunk_title', 'appendix' => 'format_container_chunk_title', 'chapter' => 'format_container_chunk_title', + 'example' => 'format_example_title', 'part' => 'format_container_chunk_title', ), ), @@ -226,6 +228,7 @@ if (isset($attrs[PhDReader::XMLNS_XML]["id"])) { $this->CURRENT_ID = $attrs[PhDReader::XMLNS_XML]["id"]; } + $this->tmp["chunk"] = array("examples" => 0); if (isset($props["lang"])) { $this->lang = $props["lang"]; } @@ -234,6 +237,7 @@ public function format_container_chunk($open, $name, $attrs, $props) { $this->CURRENT_ID = $id = $attrs[PhDReader::XMLNS_XML]["id"]; if ($open) { + $this->tmp["chunk"] = array("examples" => 0); if ($name != "reference") { $chunks = PhDHelper::getChildren($id); if (!count($chunks)) { @@ -367,6 +371,16 @@ return sprintf('<span class="%s %s">%2$s</span>', $tagname, $type); } + public function format_example_title($open, $name, $attrs, $props) { + if ($props["empty"]) { + return ""; + } + if ($open) { + return "<p><b>Example#" .++$this->tmp["chunk"]["examples"]. " "; + } + return "</b></p>"; + } + /* FIXME: This function is a crazy performance killer */ public function qandaset($stream) { $xml = stream_get_contents($stream);

« previous php.doc.cvs (#135) next »