Module:Locations
Documentation for this module may be created at Module:Locations/doc
-- Module:Locations
local p = {}
p.groups = {
{
name = "Schools",
list = {
"Roseville Elementary School",
"Roseville Middle School",
"Roseville High School",
"Roseville High School#Auditorium|<small>Auditorium</small>",
"Roseville High School#Bus stop|<small>Bus stop</small>",
"Roseville High School#Cafeteria|<small>Cafeteria</small>",
"Roseville High School#Gymnasium|<small>Gymnasium</small>",
"Roseville High School#Library|<small>Library</small>",
"Roseville High School#Oval|<small>Oval</small>"
}
},
{
name = "Homes",
list = {
"Mike's house","Lucy's house","Paulo's house","Daisy's house",
"David's house","Augustus's house","Abbey's house","Rachel's house",
"Sandy's house","Tess's house"
}
},
{
name = "Businesses",
list = {
"Airport","Aquarium","Bowling alley","Burger-Tron","Carnival",
"Comic convention venue","Drive-in theater","Garden Square mall",
"Maraschino mall","Modeling agency","Eagle Cinema",
"Therapist's office"
}
},
{
name = "Concepts",
list = {
"Blasto","Roseville High Hornets","SwordsVale"
}
},
{
name = "Other locations",
list = {
"Abbey's old house","Alejandro's apartment","Art gallery",
"Cinder Station area","East Rutledge High School","Hospital",
"Maraschino City","Matt's aunt's beach house","Northern Highway",
"Old furniture place","Prom venue","Roseville neighborhood",
"Roseville Park","Silvershore Islands"
}
}
}
function p.renderNav(frame)
local args = {
"{{Navbox",
"| name = Locations",
"| title = Locations and concepts",
"| listclass = hlist",
"| state = " .. (frame.args.state or "autocollapse")
}
for i, grp in ipairs(p.groups) do
table.insert(args, "| group" .. i .. " = " .. grp.name)
local items = {}
for _, entry in ipairs(grp.list) do
-- Use ** for anything with a section (#), otherwise *
local star = entry:find("#") and "** " or "* "
local target, label
if entry:find("|") then
local parts = mw.text.split(entry, "|", true)
target = parts[1]
label = parts[2] or parts[1]
else
target = entry
label = entry
end
table.insert(items, star .. "[[" .. target .. "|" .. label .. "]]")
end
table.insert(args,
"| list" .. i .. " =\n" .. table.concat(items, "\n")
)
end
table.insert(args, "}}")
return frame:preprocess(table.concat(args, "\n"))
end
function p.renderList(frame)
local out = {""}
for _, grp in ipairs(p.groups) do
table.insert(out, "== " .. grp.name .. " ==\n")
table.insert(out, '<div style="column-count:3; column-gap:2em;">\n')
for _, entry in ipairs(grp.list) do
local target, label
if entry:find("|") then
local parts = mw.text.split(entry, "|", true)
target = parts[1]
label = parts[2] or parts[1]
else
target = entry
label = entry
end
table.insert(out, "* [[" .. target .. "|" .. label .. "]]\n")
end
table.insert(out, "</div>\n")
end
return table.concat(out, "\n")
end
return p