From cad97e2b8ad63f0d20ee5f9c607f7ad5b61ec397 Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Tue, 28 Dec 2004 15:31:06 +0000 Subject: [PATCH] trying to include link t(r)ails --- includes/ParserXML.php | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/includes/ParserXML.php b/includes/ParserXML.php index 0d6b9299f8..4208c41607 100644 --- a/includes/ParserXML.php +++ b/includes/ParserXML.php @@ -53,6 +53,42 @@ class element { return implode ( " " , $ret ) ; } + function fixLinkTails ( &$parser , $key ) + { + $k2 = $key + 1 ; + if ( !isset ( $this->children[$k2] ) ) return ; + if ( !is_string ( $this->children[$k2]) ) return ; + if ( is_string ( $this->children[$key]) ) return ; + if ( $this->children[$key]->name != "LINK" ) return ; + + $n = $this->children[$k2] ; + $s = "" ; + while ( $n != "" AND + ( ( $n[0] >= 'a' AND $n[0] <= 'z' ) OR + $n[0] == 'ä' OR $n[0] == 'ö' OR + $n[0] == 'ü' OR $n[0] == 'ß' ) ) + { + $s .= $n[0] ; + $n = substr ( $n , 1 ) ; + } + $this->children[$k2] = $n ; + + if ( count ( $this->children[$key]->children ) > 1 ) + { + $kl = array_keys ( $this->children[$key]->children ) ; + $kl = array_pop ( $kl ) ; + $this->children[$key]->children[$kl]->children[] = $s ; + } + else + { + $e = new element ; + $e->name = "LINKOPTION" ; + $t = $this->children[$key]->sub_makeXHTML ( $parser ) ; + $e->children[] = trim ( $t ) . $s ; + $this->children[$key]->children[] = $e ; + } + } + /** * This function generates the XHTML for the entire subtree */ @@ -71,7 +107,10 @@ class element { $ret .= ">" ; } - foreach ($this->children as $child) { +# foreach ( array_keys ( $this->children ) AS $x ) +# $this->fixLinkTails ( $parser , $x ) ; + + foreach ($this->children as $key => $child) { if ( is_string($child) ) { $ret .= $child ; } else if ( $child->name != "ATTRS" ) { -- 2.20.1