logo       

cvs: pear /XML_Transformer/Transformer/Driver DocBook.php /XML_Transformer: msg#00675

php.cvs.pear

Subject: cvs: pear /XML_Transformer/Transformer/Driver DocBook.php /XML_Transformer/Transformer/Namespace DocBook.php

sebastian Mon Sep 30 04:48:39 2002 EDT

Modified files:
/pear/XML_Transformer/Transformer/Driver DocBook.php
/pear/XML_Transformer/Transformer/Namespace DocBook.php
Log:
More work on second transformation pass.


Index: pear/XML_Transformer/Transformer/Driver/DocBook.php
diff -u pear/XML_Transformer/Transformer/Driver/DocBook.php:1.1
pear/XML_Transformer/Transformer/Driver/DocBook.php:1.2
--- pear/XML_Transformer/Transformer/Driver/DocBook.php:1.1 Mon Sep 30
04:09:51 2002
+++ pear/XML_Transformer/Transformer/Driver/DocBook.php Mon Sep 30 04:48:39 2002
@@ -13,7 +13,7 @@
// | license@xxxxxxx so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
//
-// $Id: DocBook.php,v 1.1 2002/09/30 08:09:51 sebastian Exp $
+// $Id: DocBook.php,v 1.2 2002/09/30 08:48:39 sebastian Exp $
//

require_once 'XML/Transformer.php';
@@ -61,16 +61,24 @@
* Output
*
* <html>
+* <head>
+* <title>
+* Sebastian Bergmann: An Article
+* </title>
+* </head>
* <body>
+* <h1 class="title">
+* Sebastian Bergmann: An Article
+* </h1>
* <div class="section">
* <a id="foo"></a>
-* <h2>
+* <h2 class="title">
* 1. Section One
* </h2>
* </div>
* <div class="section">
* <a id="bar"></a>
-* <h2>
+* <h2 class="title">
* 2. Section Two
* </h2>
* <p>
@@ -84,7 +92,7 @@
*
* @author Sebastian Bergmann <sb@xxxxxxxxxxxxxxxxxxxxx>
* @author Kristian Köhntopp <kris@xxxxxxxxxxxx>
-* @version $Revision: 1.1 $
+* @version $Revision: 1.2 $
* @access public
*/
class XML_Transformer_Driver_DocBook {
Index: pear/XML_Transformer/Transformer/Namespace/DocBook.php
diff -u pear/XML_Transformer/Transformer/Namespace/DocBook.php:1.16
pear/XML_Transformer/Transformer/Namespace/DocBook.php:1.17
--- pear/XML_Transformer/Transformer/Namespace/DocBook.php:1.16 Mon Sep 30
04:09:51 2002
+++ pear/XML_Transformer/Transformer/Namespace/DocBook.php Mon Sep 30
04:48:39 2002
@@ -13,7 +13,7 @@
// | license@xxxxxxx so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
//
-// $Id: DocBook.php,v 1.16 2002/09/30 08:09:51 sebastian Exp $
+// $Id: DocBook.php,v 1.17 2002/09/30 08:48:39 sebastian Exp $
//

require_once 'XML/Transformer/Namespace.php';
@@ -70,7 +70,7 @@
*
* @author Sebastian Bergmann <sb@xxxxxxxxxxxxxxxxxxxxx>
* @author Kristian Köhntopp <kris@xxxxxxxxxxxx>
-* @version $Revision: 1.16 $
+* @version $Revision: 1.17 $
* @access public
*/
class XML_Transformer_Namespace_DocBook extends XML_Transformer_Namespace {
@@ -153,7 +153,7 @@
* @var array
* @access private
*/
- var $_processXref = false;
+ var $_secondPass = false;

/**
* @var array
@@ -198,7 +198,14 @@
* @return string
* @access public
*/
- function start_artheader($attributes) {}
+ function start_artheader($attributes) {
+ if (!$this->_secondPass) {
+ return sprintf(
+ '<artheader%s>',
+ XML_Transformer_Util::attributesToString($attributes)
+ );
+ }
+ }

// }}}
// {{{ function end_artheader($cdata)
@@ -208,7 +215,16 @@
* @return string
* @access public
*/
- function end_artheader($cdata) {}
+ function end_artheader($cdata) {
+ if (!$this->_secondPass) {
+ $cdata = $cdata . '</artheader>';
+
+ return array(
+ $cdata,
+ false
+ );
+ }
+ }

// }}}
// {{{ function start_article($attributes)
@@ -219,12 +235,23 @@
* @access public
*/
function start_article($attributes) {
- $id = $this->_startSection(
- 'article',
- isset($attributes['id']) ? $attributes['id'] : ''
- );
+ if (!$this->_secondPass) {
+ $id = $this->_startSection(
+ 'article',
+ isset($attributes['id']) ? $attributes['id'] : ''
+ );
+
+ return '<article>' . $id;
+ } else {
+ return sprintf(
+ '<html><head><title>%s: %s</title><body><h1 class="title">%s:
%s</h1>',

- return '<html><body>' . $id;
+ $this->_author,
+ $this->_title,
+ $this->_author,
+ $this->_title
+ );
+ }
}

// }}}
@@ -236,11 +263,20 @@
* @access public
*/
function end_article($cdata) {
- $this->_endSection('article');
+ if (!$this->_secondPass) {
+ $this->_endSection('article');

- $this->_processXref = true;
+ $this->_secondPass = true;
+
+ $cdata = $cdata . '</article>';
+ } else {
+ $cdata = $cdata . '</body></html>';
+ }

- return $cdata . '</body></html>';
+ return array(
+ $cdata,
+ false
+ );
}

// }}}
@@ -727,17 +763,17 @@
switch ($this->_context[sizeof($this->_context)-1]) {
case 'chapter':
case 'section': {
- return '<h2>' . $this->_currentSectionNumber . '. ';
+ return '<h2 class="title">' . $this->_currentSectionNumber .
'. ';
}
break;

case 'example': {
- return '<h2>Example ' . $this->_currentExampleNumber;
+ return '<h3 class="title">Example ' .
$this->_currentExampleNumber;
}
break;

case 'figure': {
- return '<h2>Figure ' . $this->_currentFigureNumber;
+ return '<h3 class="title">Figure ' .
$this->_currentFigureNumber;
}
break;
}
@@ -766,13 +802,17 @@
break;

case 'chapter':
- case 'example':
- case 'figure':
case 'section': {
return $cdata . '</h2>';
}
break;

+ case 'example':
+ case 'figure': {
+ return $cdata . '</h3>';
+ }
+ break;
+
default: {
return $cdata;
}
@@ -812,7 +852,7 @@
* @access public
*/
function start_xref($attributes) {
- if ($this->_processXref) {
+ if ($this->_secondPass) {
return sprintf(
'<a href="#%s">%s</a>',

@@ -836,7 +876,7 @@
* @access public
*/
function end_xref($cdata) {
- if (!$this->_processXref) {
+ if (!$this->_secondPass) {
$cdata = $cdata . '</xref>';
}




--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise