Index: trunk/extensions/SemanticGlossary/SemanticGlossaryElement.php |
— | — | @@ -85,9 +85,8 @@ |
86 | 86 | |
87 | 87 | private function getLinkTemplate ( DOMDocument &$doc ) { |
88 | 88 | |
89 | | - // create template if it doesnot yet exist |
90 | | - // FIXME: Is it safe to use a singleton here? |
91 | | - if ( !self::$mLinkTemplate ) { |
| 89 | + // create template if it does not yet exist |
| 90 | + if ( !self::$mLinkTemplate || ( self::$mLinkTemplate -> ownerDocument !== $doc ) ) { |
92 | 91 | |
93 | 92 | global $wgScriptPath; |
94 | 93 | |
Index: trunk/extensions/SemanticGlossary/SemanticGlossaryParser.php |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | |
154 | 154 | //Find all text in HTML. |
155 | 155 | $xpath = new DOMXpath( $doc ); |
156 | | - $elements = $xpath -> query( "//*[not(ancestor::*[@class='noglossary'])][text()!=' ']/text()" ); |
| 156 | + $elements = $xpath -> query( "//*[not(ancestor-or-self::*[@class='noglossary'] or ancestor-or-self::a)][text()!=' ']/text()" ); |
157 | 157 | |
158 | 158 | //Iterate all HTML text matches |
159 | 159 | $nb = $elements -> length; |