Board Thread:Lua Help/@comment-4405550-20160124224015/@comment-24473195-20160207205048

What I meant is that parsoid already does this, and provides an API to facilitate wikitext parsing :

> var text = ""; > var pdoc = yield Parsoid.parse(text, { pdoc: true }); > console.log(yield Promise.map(pdoc.filterTemplates, Parsoid.toWikitext));

[ , , '' ] https://doc.wikimedia.org/Parsoid/master/#!/guide/jsapi

I'm not sure how big this parsoid npm package is or how many dependencies it has, but it seems like a more viable solution than writing the adhoc regex for this.

Anyway, perhaps the capability to view a module result on a page could probably be done separately as a javascript gadget. It would benefit many more users than a npm package. As shown by the extension use in Wikipedia.