var $attrs = array();
var $children = array();
+ function getSourceAttrs ()
+ {
+ $ret = "" ;
+ foreach ($this->children as $child)
+ {
+ if ( !is_string($child) AND $child->name == "ATTRS" )
+ {
+ $ret = $child->makeXHTML ( $parser );
+ }
+ }
+ return $ret ;
+ }
+
+ function getTheseAttrs ()
+ {
+ $ret = array() ;
+ foreach ($this->children as $child)
+ {
+ if ( !is_string($child) AND $child->name == "ATTR" )
+ {
+ $s = $child->attrs["NAME"] . "='" . $child->children[0] . "'" ;
+# $s = "ATTRIBUTE=" . $child->attrs["NAME"] ;
+ $ret[] = $s ;
+ }
+ }
+ return implode ( " " , $ret ) ;
+ }
+
function sub_makeXHTML ( &$parser , $tag = "" , $attr = "" )
{
$ret = "" ;
+
+ $attr2 = $this->getSourceAttrs () ;
+ if ( $attr != "" AND $attr2 != "" ) $attr .= " " ;
+ $attr .= $attr2 ;
+
if ( $tag != "" )
{
$ret .= "<" . $tag ;
if ( $attr != "" ) $ret .= " " . $attr ;
$ret .= ">" ;
}
+
+
foreach ($this->children as $child) {
if ( is_string($child) ) {
$ret .= $child ;
- } else {
+ } else if ( $child->name != "ATTRS" ) {
$ret .= $child->makeXHTML ( $parser );
}
}
{
$ret = "" ;
$n = $this->name ; # Shortcut
+
+ if ( $n == "EXTENSION" ) # Fix allowed HTML
+ {
+ $ext = strtoupper ( $this->attrs["NAME"] ) ;
+ if ( $ext == "B" ) $n = "BOLD" ;
+ if ( $ext == "I" ) $n = "ITALICS" ;
+ if ( $ext == "P" ) $n = "PARAGRAPH" ;
+ }
+
if ( $n == "ARTICLE" )
$ret .= $this->sub_makeXHTML ( $parser ) ;
else if ( $n == "HEADING" )
$ret .= $this->sub_makeXHTML ( $parser , "caption" ) ;
}
+ else if ( $n == "ATTRS" ) # SPECIAL CASE : returning attributes
+ {
+ return $this->getTheseAttrs () ;
+ }
+
else if ( $n == "LISTITEM" )
$ret .= $this->sub_makeXHTML ( $parser , "li" ) ;