From Wikipedia, the free encyclopedia


local p = {}

p._cachedData = {}

local function getCategoriesFromWikitext(wikitext)

    local categories = {}

    for category in mw.ustring.gmatch(wikitext, "%[%[Category:([%w%s%-_]+)%]%]") do

        table.insert(categories, category)

    end

    return categories

end



function p.getCategories(title, skipProcessing)

	title = tostring(title)

	-- if cached then return that

	if p._cachedDatatitle ~= nil then

		mw.log("Cached")

		return p._cachedDatatitle

	else

		mw.incrementExpensiveFunctionCount()

	    local wikitext = skipProcessing and mw.title.new(title):getContent() or mw.getCurrentFrame():preprocess(mw.title.new(title):getContent())

	    local categories = getCategoriesFromWikitext(wikitext)

		mw.log("Caching...")

	    p._cachedDatatitle = categories

	    return categories

    end

end



function p.main(frame)

	local args = require('Module:Arguments').getArgs(frame)

	return table.concat(p.getCategories(args1], require("Module:Yesno")(args2])), '|')

end



return p
From Wikipedia, the free encyclopedia


local p = {}

p._cachedData = {}

local function getCategoriesFromWikitext(wikitext)

    local categories = {}

    for category in mw.ustring.gmatch(wikitext, "%[%[Category:([%w%s%-_]+)%]%]") do

        table.insert(categories, category)

    end

    return categories

end



function p.getCategories(title, skipProcessing)

	title = tostring(title)

	-- if cached then return that

	if p._cachedDatatitle ~= nil then

		mw.log("Cached")

		return p._cachedDatatitle

	else

		mw.incrementExpensiveFunctionCount()

	    local wikitext = skipProcessing and mw.title.new(title):getContent() or mw.getCurrentFrame():preprocess(mw.title.new(title):getContent())

	    local categories = getCategoriesFromWikitext(wikitext)

		mw.log("Caching...")

	    p._cachedDatatitle = categories

	    return categories

    end

end



function p.main(frame)

	local args = require('Module:Arguments').getArgs(frame)

	return table.concat(p.getCategories(args1], require("Module:Yesno")(args2])), '|')

end



return p

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook