Module:also: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local export = {} local m_links = require("Module:links") function export.show(frame) local args = frame:getParent().args local links = {} local i = 1 while args[i] do table.insert(links, "'''" .. m_links.full_link{term = args[i]} .. "'''") i = i + 1 end return "''See also:'' " .. table.concat(links, ", ") end") |
TheNightAvl (talk | contribs) No edit summary |
||
(19 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
local m_links = require("Module:links") | local m_links = require("Module:links") | ||
local getArgs = require('Module:Arguments').getArgs | |||
function export.show(frame) | function export.show(frame) | ||
local args = frame | local args = getArgs(frame) | ||
local links = {} | local links = {} | ||
local i = 1 | 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 | |||
table.sort(links) | |||
return "<dt><dd>''See also:'' " .. table.concat(links, ", ") .. "</dd></dt>" | |||
else | |||
return nil | |||
end | end | ||
end | end | ||
return export |
Latest revision as of 01:37, 17 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
table.sort(links)
return "<dt><dd>''See also:'' " .. table.concat(links, ", ") .. "</dd></dt>"
else
return nil
end
end
return export