Module:redlink category: difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
use getLinkPage function in Module:links to get correct location of reconstructed entries |
||
Line 12: | Line 12: | ||
local lang = m_languages.getByCode(frame.args[1]) |
local lang = m_languages.getByCode(frame.args[1]) |
||
local langname = lang:getCanonicalName() |
local langname = lang:getCanonicalName() |
||
local |
local entry = require("Module:links").getLinkPage(frame.args[2], lang) |
||
local text = lang:makeEntryName(entry) -- entry name (parameter 2 in Template:m, Template:l) |
|||
local link_object = mw.title.new (text) or "" |
local link_object = mw.title.new (text) or "" |
Revision as of 20:19, 14 September 2017
- The following documentation is located at Module:redlink category/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
I want to repurpose this for categorising redlinked form-of entries, but it hasn't been done yet.
Initially I will make it functional for English only, on pages with >6 characters in the title, to try and minimise the risk of Lua errors.
This, that and the other (talk)
![]() |
Do not use |
local export = {}
function export.cat (frame)
local redlink_category = ""
if pcall(mw.incrementExpensiveFunctionCount) then
local m_languages = require("Module:languages")
local code = frame.args[1] -- language code
local template = frame.args["template"]
local lang = m_languages.getByCode(frame.args[1])
local langname = lang:getCanonicalName()
local entry = require("Module:links").getLinkPage(frame.args[2], lang)
local text = lang:makeEntryName(entry) -- entry name (parameter 2 in Template:m, Template:l)
local link_object = mw.title.new (text) or ""
local link_id = link_object.id
if link_object.id == 0 then
redlink_category = "[[Category:" .. langname .. " redlinks]]"
if template and template ~= "-" then
redlink_category = redlink_category .. "[[Category:" .. langname .. " redlinks/" .. template .. "]]"
end
end
end
return redlink_category
end
return export