Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349223 )

Change subject: Properly transclude sections within extension tags
......................................................................

Properly transclude sections within extension tags

Bug: T163411
Change-Id: I303c94b739780849ae4894c999848d9ffcf09f95
---
M LabeledSectionTransclusion.class.php
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LabeledSectionTransclusion
 refs/changes/23/349223/1

diff --git a/LabeledSectionTransclusion.class.php 
b/LabeledSectionTransclusion.class.php
index f4ae2c6..25452c3 100644
--- a/LabeledSectionTransclusion.class.php
+++ b/LabeledSectionTransclusion.class.php
@@ -369,14 +369,16 @@
 
                $text = '';
                $node = $root->getFirstChild();
+
                while ( $node ) {
                        // If the name of the begin node was specified, find it.
                        // Otherwise transclude everything from the beginning 
of the page.
                        if ( $begin != '' ) {
                                // Find the begin node
                                $found = false;
-                               for ( ; $node; $node = $node->getNextSibling() 
) {
+                               while ( $node ) {
                                        if ( $node->getName() != 'ext' ) {
+                                               $node = $node->getNextSibling();
                                                continue;
                                        }
                                        $parts = $node->splitExt();
@@ -384,8 +386,15 @@
                                        if ( self::isSection( $parts['name'] ) 
) {
                                                if ( preg_match( $beginRegex, 
$parts['attr'] ) ) {
                                                        $found = true;
-                                                       break;
+                                               } else {
+                                                       $found = false;
                                                }
+                                               break;
+                                       } else {
+                                               // If we're inside another 
extension tag (such as <poem> or <ref>), look into the content
+                                               $dom = 
$parser->preprocessToDom( $parts['inner'] );
+                                               $node = $dom->getFirstChild();
+                                               continue;
                                        }
                                }
                                if ( !$found || !$node ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/349223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I303c94b739780849ae4894c999848d9ffcf09f95
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LabeledSectionTransclusion
Gerrit-Branch: master
Gerrit-Owner: Sophivorus <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to