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:26, 17 March 2013 (I think this little thing should be helpful). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

 ---- 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 args=frame.args
   local parent=frame.parent(frame)
   if parent then pargs=parent.args or {} else pargs={} end
   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