Jump to content

Module:Sandbox/Wnt/WikiLink

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Wnt (talk | contribs) at 21:28, 17 March 2013 (One of these days I gotta figure out "parent" but this didn't even get used). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

 ---- This module is meant to be processed by putting "{{#invoke:WikiLinkEverything|main}}" into an existing page of flat text to deliver all Wikilinked text (nowiki) for you to copy and paste.  For starting a new page from a Special: index that you can't directly access for example, or a list of place names most of which should exist etc.

local p = {}

function p.main(frame)
   local page=mw.title.getCurrentTitle()
   if page then input=getContent(page) else return "error didn't get the page contents :(" end
   input=mw.ustring.gsub(input,"{{#invoke:WikiLinkEverything|main}}","") --we don't want loops, etc.
   input=mw.ustring.gsub(input,"(%S+)","%[%[%1%]%]")
   return input
end

return p