Page MenuHomePhabricator

Simplify `nowiki_text` parsing
Closed, ResolvedPublic

Description

The nowiki_text PEG rule is

nowiki_text
  = extToken:nowiki
  {
    var txt = Util.getExtArgInfo(extToken).dict.body.extsrc;
    return Util.decodeWtEntities(txt);
  }

and Util.getExtArgInfo() is

getExtArgInfo: function(extToken) {
	var name = extToken.getAttribute('name');
	var options = extToken.getAttribute('options');
	return {
		dict: {
			name: name,
			attrs: TokenUtils.kvToHash(options, true),
			body: { extsrc: Util.extractExtBody(extToken) },
		},
	};
},

It should be apparent that the nowiki_text PEG rule can be simplified as

nowiki_text
  = extToken:nowiki
  {
    var txt = Util.extractExtBody(extToken);
    return Util.decodeWtEntities(txt);
  }

Event Timeline

Change 507607 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/services/parsoid@master] Simplify nowiki_text rule

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

Change 507607 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Simplify nowiki_text rule

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

ssastry claimed this task.
ssastry reassigned this task from ssastry to cscott.
ssastry triaged this task as Low priority.
ssastry subscribed.