Module:Sandbox/RexxS/Watchlist

-- Convert watchlist Module:Sandbox/RexxS/Watchlist --

local p = {}

function p.convert(frame) args = frame.args if not args then args = frame:getParent.args end local page = args.page or "" if page == "" then return "No page supplied" end

local articlesonly = args.articlesonly if articlesonly == "true" then articlesonly = true else articlesonly = false end

local ttlobj = mw.title.new(page) local cont = ttlobj:getContent local out = "" for ttl in cont:gmatch("%C*") do		ttl = mw.text.trim(ttl) if ttl ~= "" then local qid = mw.wikibase.getEntityIdForTitle(ttl) if qid then out = out .. " " .. qid elseif not articlesonly then out = out .. " " .. ttl end end end

return out end

return p