Introduce a parseTokenContentsToDOM helper

It calls out to a slimmed down parseWikitextToDOM, since only a subset
of that functionality is needed in some extensions, like gallery.

Change-Id: I72e29c4b285fc8cae0207966cc2eddd0fe3ebcf3
This commit is contained in:
Arlo Breault 2018-11-19 12:02:29 -05:00
parent 678effaf0e
commit e644753c6b

View file

@ -53,7 +53,7 @@ Ref.prototype.toDOM = function(state, content, args) {
// The php preprocessor did our expansion.
const allowNestedRef = state.parseContext.inTemplate && state.parseContext.extTag !== 'ref';
return ParsoidExtApi.parseWikitextToDOM(state, args, '', content, {
return ParsoidExtApi.parseTokenContentsToDOM(state, args, '', content, {
// NOTE: sup's content model requires it only contain phrasing
// content, not flow content. However, since we are building an
// in-memory DOM which is simply a tree data structure, we can
@ -373,7 +373,7 @@ var createReferences = function(env, body, refsOpts, modifyDp, autoGenerated) {
};
References.prototype.toDOM = function(state, content, args) {
return ParsoidExtApi.parseWikitextToDOM(state, args, '', content, {
return ParsoidExtApi.parseTokenContentsToDOM(state, args, '', content, {
wrapperTag: 'div',
extTag: 'references',
inTemplate: state.parseContext.inTemplate,