BUG#206: replace <!--LINK tags by the link text for displaying text in TOCs
authorJens Frank <jeluf@users.mediawiki.org>
Thu, 26 Aug 2004 18:48:13 +0000 (18:48 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Thu, 26 Aug 2004 18:48:13 +0000 (18:48 +0000)
Thanks to Daniel D�sentrieb for his help writing the regexp.

includes/Parser.php

index f95cbfa..37d4d99 100644 (file)
@@ -1959,6 +1959,11 @@ class Parser
                        $canonized_headline = $this->unstrip( $headline, $this->mStripState );
                        $canonized_headline = $this->unstripNoWiki( $headline, $this->mStripState );
 
+                       # Remove link placeholders by the link text.
+                       #     <!--LINK namespace page_title link text with suffix-->
+                       # turns into 
+                       #     link text with suffix
+                       $canonized_headline = preg_replace( '/<!--LINK [0-9]* [^ ]* *(.*?)-->/','$1', $canonized_headline );
                        # strip out HTML
                        $canonized_headline = preg_replace( '/<.*?' . '>/','',$canonized_headline );
                        $tocline = trim( $canonized_headline );