Module:BibliographyLink: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
slug = mw.ustring.gsub(slug, " ", "-") | slug = mw.ustring.gsub(slug, " ", "-") | ||
local url = "https://adarislibrary.org | local url = "https://adarislibrary.org/books/" .. category .. "/" .. slug | ||
return string.format("<noautolinks>[%s %s]</noautolinks>", url, title) | return string.format("<noautolinks>[%s %s]</noautolinks>", url, title) | ||
end | end | ||
return p | return p |
Latest revision as of 21:07, 23 March 2025
Documentation for this module may be created at Module:BibliographyLink/doc
local p = {}
function p.link(frame)
local args = frame:getParent().args
local title = args["Title"] or ""
local category = args["Category"] or "general"
-- Get text before the first colon
local base = mw.ustring.match(title, "^[^:]+") or title
-- Clean slug: lowercase, replace spaces with dashes
local slug = mw.ustring.lower(base)
slug = mw.ustring.gsub(slug, " ", "-")
local url = "https://adarislibrary.org/books/" .. category .. "/" .. slug
return string.format("<noautolinks>[%s %s]</noautolinks>", url, title)
end
return p