cvs: phd / build.php mktoc.php /formats xhtml.php /include PhDReader.class.php /themes/php phpdotnet.php
| From: | Hannes Magnusson | Date: | Sun, 30 Sep 2007 18:30:03 +0000 |
| Subject: | cvs: phd / build.php mktoc.php /formats xhtml.php /include PhDReader.class.php /themes/php phpdotnet.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-110@lists.php.net to get a copy of this message | ||
bjori Sun Sep 30 18:30:03 2007 UTC
Modified files:
/phd build.php mktoc.php
/phd/formats xhtml.php
/phd/include PhDReader.class.php
/phd/themes/php phpdotnet.php
Log:
Implement optional legalnotice chunking
http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.28&r2=1.29&diff_format=u
Index: phd/build.php
diff -u phd/build.php:1.28 phd/build.php:1.29
--- phd/build.php:1.28 Sat Sep 29 16:44:19 2007
+++ phd/build.php Sun Sep 30 18:30:03 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: build.php,v 1.28 2007/09/29 16:44:19 bjori Exp $ */
+/* $Id: build.php,v 1.29 2007/09/30 18:30:03 bjori Exp $ */
function err($no, $str, $file, $line) {
global $notify;
@@ -32,6 +32,9 @@
&& is_array($OPTIONS["output_theme"])
or die("Invalid configuration/file not found.\nYou need to run setup/setup.php
first\n");
+$OPTIONS["chunk_extra"]["legalnotice"] = true;
+$OPTIONS["xml_file"] = $OPTIONS["xml_root"] . "/.manual.xml";
+
require "./include/PhDReader.class.php";
require "./include/PhDHelper.class.php";
require "./include/PhDFormat.class.php";
@@ -104,7 +107,7 @@
}
}
- $reader = new PhDReader($OPTIONS["xml_root"] . "/.manual.xml");
+ $reader = new PhDReader($OPTIONS);
while($reader->read()) {
$nodetype = $reader->nodeType;
http://cvs.php.net/viewvc.cgi/phd/mktoc.php?r1=1.3&r2=1.4&diff_format=u
Index: phd/mktoc.php
diff -u phd/mktoc.php:1.3 phd/mktoc.php:1.4
--- phd/mktoc.php:1.3 Fri Aug 10 20:16:13 2007
+++ phd/mktoc.php Sun Sep 30 18:30:03 2007
@@ -1,9 +1,9 @@
<?php
-/* $Id: mktoc.php,v 1.3 2007/08/10 20:16:13 bjori Exp $ */
-$r = new PhDReader($OPTIONS["xml_root"]."/.manual.xml");
+/* $Id: mktoc.php,v 1.4 2007/09/30 18:30:03 bjori Exp $ */
+$r = new PhDReader($OPTIONS);
$FILENAMES = array();
$CURRENT_FILENAME = $LAST_CHUNK = "";
-$PARENTS = array(-1 => "ROOT");
+$PARENTS = array(-1 => "ROOT", 2 => "");
$lastid = 0;
while($r->read()) {
http://cvs.php.net/viewvc.cgi/phd/formats/xhtml.php?r1=1.30&r2=1.31&diff_format=u
Index: phd/formats/xhtml.php
diff -u phd/formats/xhtml.php:1.30 phd/formats/xhtml.php:1.31
--- phd/formats/xhtml.php:1.30 Sun Sep 30 15:23:40 2007
+++ phd/formats/xhtml.php Sun Sep 30 18:30:03 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: xhtml.php,v 1.30 2007/09/30 15:23:40 bjori Exp $ */
+/* $Id: xhtml.php,v 1.31 2007/09/30 18:30:03 bjori Exp $ */
class XHTMLPhDFormat extends PhDFormat {
protected $elementmap = array( /* {{{ */
@@ -97,6 +97,7 @@
'indexentry' => 'dd',
'initializer' => 'format_initializer',
'itemizedlist' => 'ul',
+ 'legalnotice' => 'format_legalnotice_chunk',
'listitem' => array(
/* DEFAULT */ 'li',
'varlistentry' => 'format_varlistentry_listitem',
@@ -241,14 +242,12 @@
protected $role = false;
protected $tmp = array();
- public $errors;
public function __construct(array $IDs) {
parent::__construct($IDs);
}
public function __call($func, $args) {
if ($args[0]) {
- $this->errors[$func]++;
trigger_error("No mapper found for '{$func}'", E_USER_WARNING);
return "<font color='red'
size='+3'>{$args[1]}</font>";
}
@@ -294,6 +293,12 @@
}
return "</div>";
}
+ public function format_legalnotice_chunk($open, $name, $attrs) {
+ if ($open) {
+ return '<div id="legalnotice">';
+ }
+ return "</div>\n";
+ }
public function format_chunk($open, $name, $attrs) {
if ($open) {
if(isset($attrs[PhDReader::XMLNS_XML]["id"])) {
http://cvs.php.net/viewvc.cgi/phd/include/PhDReader.class.php?r1=1.9&r2=1.10&diff_format=u
Index: phd/include/PhDReader.class.php
diff -u phd/include/PhDReader.class.php:1.9 phd/include/PhDReader.class.php:1.10
--- phd/include/PhDReader.class.php:1.9 Tue Aug 14 12:04:12 2007
+++ phd/include/PhDReader.class.php Sun Sep 30 18:30:03 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: PhDReader.class.php,v 1.9 2007/08/14 12:04:12 bjori Exp $ */
+/* $Id: PhDReader.class.php,v 1.10 2007/09/30 18:30:03 bjori Exp $ */
//6271
class PhDReader extends XMLReader {
@@ -40,6 +40,7 @@
'book' => true,
'part' => true,
),
+ 'legalnotice' => false,
'part' => true,
'preface' => true,
'refentry' => true,
@@ -56,9 +57,14 @@
'setindex' => true,
); /* }}} */
- public function __construct($file, $encoding = "UTF-8", $options = NULL) {
- if (!XMLReader::open($file, $encoding, $options)) {
- throw new Exception();
+ public function __construct($opts, $encoding = "UTF-8", $xml_opts = NULL) {
+ if (!XMLReader::open($opts["xml_file"], $encoding, $xml_opts)) {
+ throw new Exception("Cannot open {$opts["file"]}");
+ }
+ if (isset($opts["chunk_extra"]) &&
is_array($opts["chunk_extra"])) {
+ foreach($opts["chunk_extra"] as $el => $v) {
+ $this->CHUNK_ME[$el] = $v;
+ }
}
}
http://cvs.php.net/viewvc.cgi/phd/themes/php/phpdotnet.php?r1=1.18&r2=1.19&diff_format=u
Index: phd/themes/php/phpdotnet.php
diff -u phd/themes/php/phpdotnet.php:1.18 phd/themes/php/phpdotnet.php:1.19
--- phd/themes/php/phpdotnet.php:1.18 Sun Sep 30 15:43:17 2007
+++ phd/themes/php/phpdotnet.php Sun Sep 30 18:30:03 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: phpdotnet.php,v 1.18 2007/09/30 15:43:17 bjori Exp $ */
+/* $Id: phpdotnet.php,v 1.19 2007/09/30 18:30:03 bjori Exp $ */
class phpdotnet extends PhDHelper {
protected $elementmap = array(
@@ -42,6 +42,7 @@
'book' => 'format_chunk',
'part' => 'format_chunk',
),
+ 'legalnotice' => 'format_chunk',
'part' => 'format_container_chunk',
'preface' => 'format_chunk',
'refentry' => 'format_chunk',