Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68005


Change subject: (Bug 49375) Fixed heading production to handle fake heading ends
......................................................................

(Bug 49375) Fixed heading production to handle fake heading ends

* Unrelated: Replaced space+ uses to spaces.
* No change in parser test results.

Change-Id: I9e9e0e25c7f28a89ca1742d6eb59557e1ad1f445
---
M js/lib/pegTokenizer.pegjs.txt
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/05/68005/1

diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt
index 41a6639..52c64ac 100644
--- a/js/lib/pegTokenizer.pegjs.txt
+++ b/js/lib/pegTokenizer.pegjs.txt
@@ -694,25 +694,29 @@
 
 /* Headings  */
 
+fake_heading_end =
+    '='+ (spaces / comment)* & [^ \t\n\r]
+
 h = & "=" // guard, to make sure '='+ will match.
           // XXX: Also check to end to avoid inline parsing?
     r:(
      s:'='+ // moved in here to make s accessible to inner action
      & { return stops.inc('h'); }
-     c:inlineline
+     c:(((urltext / ! inline_breaks inline_element) fake_heading_end?) / 
!inline_breaks [^\r\n])+
      e:'='+
      endTPos:({ return pos; })
-     spc:(sp:space+ { return sp.join(''); } / comment)*
+     spc:(spaces / comment)*
      &eolf
      {
         stops.dec('h');
+        c = flatten_stringlist(c);
         var level = Math.min( s.length, e.length );
         level = Math.min( 6, level );
         // convert surplus equals into text
-        if(s.length > level) {
+        if (s.length > level) {
             s = s.join('');
             var extras1 = s.substr(0, s.length - level);
-            if(c[0].constructor === String) {
+            if (c[0].constructor === String) {
                 c[0] = extras1 + c[0];
             } else {
                 c.unshift( extras1 );
@@ -1315,7 +1319,7 @@
 // FIXME: fix tag end position
 pre_indent_in_tags
   = & { return stops.inc('pre'); }
-       space+ // XXX: capture space for round-tripping
+       spaces // XXX: capture space for round-tripping
     "<" pre_tag_name
     attribs:generic_attribute*
     ">"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e9e0e25c7f28a89ca1742d6eb59557e1ad1f445
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>

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

Reply via email to