Module:also: Difference between revisions
Jump to navigation
Jump to search
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
local m_links = require("Module:links") | local m_links = require("Module:links") | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
function export.show(frame) | function export.show(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local links = {} | local links = {} | ||
local here = args["test"] or mw.title.getCurrentTitle().subpageText | |||
if args[1] then -- manual mode | if args[1] then -- manual mode | ||
local i = 1 | local i = 1 | ||
while args[i] do | while args[i] do | ||
table.insert(links, "'''" .. m_links.full_link{term = args[i]} .. "'''") | if args[i] ~= here then | ||
table.insert(links, "'''" .. m_links.full_link{term = args[i]} .. "'''") | |||
end | |||
i = i + 1 | i = i + 1 | ||
end | end | ||
else | else | ||
return nil | |||
end | end | ||
if links[1] then | if links[1] then | ||
return "<dt><dd>''See also:'' " .. table.concat(links, ", ") .. "</dd></dt>" | return "<dt><dd>''See also:'' " .. table.concat(links, ", ") .. "</dd></dt>" | ||
else | else |
Revision as of 22:48, 16 June 2024
{{also}}
local export = {}
local m_links = require("Module:links")
local getArgs = require('Module:Arguments').getArgs
function export.show(frame)
local args = getArgs(frame)
local links = {}
local here = args["test"] or mw.title.getCurrentTitle().subpageText
if args[1] then -- manual mode
local i = 1
while args[i] do
if args[i] ~= here then
table.insert(links, "'''" .. m_links.full_link{term = args[i]} .. "'''")
end
i = i + 1
end
else
return nil
end
if links[1] then
return "<dt><dd>''See also:'' " .. table.concat(links, ", ") .. "</dd></dt>"
else
return nil
end
end
return export