C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394627 )

Change subject: Fix RT issues with duplicate heading ids
......................................................................

Fix RT issues with duplicate heading ids

We were running saveDataParsoid *before* tweaking heading IDs to make them
unique; as a result, headings with conflicting ids got their data-parsoid
attributes mixed up which resulted in RT errors, since saveDataParsoid
assigns IDs to every node and makes a map keyed on IDs.

Swapping the order of these two passes fixes the problems.

Change-Id: Ia388a9734f93cfc8f3b87551599c7b1f739aaab5
---
M lib/wt2html/DOMPostProcessor.js
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/27/394627/1

diff --git a/lib/wt2html/DOMPostProcessor.js b/lib/wt2html/DOMPostProcessor.js
index 39392fa..b291406 100644
--- a/lib/wt2html/DOMPostProcessor.js
+++ b/lib/wt2html/DOMPostProcessor.js
@@ -203,13 +203,6 @@
        // Add <section> wrappers around sections
        addPP('wrapSections', wrapSections);
 
-       // Save data.parsoid into data-parsoid html attribute.
-       // Make this its own thing so that any changes to the DOM
-       // don't affect other handlers that run alongside it.
-       domVisitor = new DOMTraverser(env);
-       domVisitor.addHandler(null, CleanUp.cleanupAndSaveDataParsoid);
-       addPP('cleanupAndSaveDP', domVisitor.traverse.bind(domVisitor));
-
        // Make heading IDs unique
        domVisitor = new DOMTraverser(env);
        domVisitor.addHandler(null, function(node, env) {
@@ -248,6 +241,14 @@
                return true;
        });
        addPP('heading id uniqueness', domVisitor.traverse.bind(domVisitor));
+
+       // Save data.parsoid into data-parsoid html attribute.
+       // Make this its own thing so that any changes to the DOM
+       // don't affect other handlers that run alongside it.
+       domVisitor = new DOMTraverser(env);
+       domVisitor.addHandler(null, CleanUp.cleanupAndSaveDataParsoid);
+       addPP('cleanupAndSaveDP', domVisitor.traverse.bind(domVisitor));
+
 }
 
 // Inherit from EventEmitter

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia388a9734f93cfc8f3b87551599c7b1f739aaab5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to