Home
Random
Log in
Settings
About Brighter Shores Wiki
Disclaimers
Search
Editing
Module:Variants
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function sort_entries(entry1, entry2) -- Sort the variants based on the sum of the profession levels local entry1_value = (entry1['Profession Level A'] or 0) + (entry1['Profession Level B'] or 0) local entry2_value = (entry2['Profession Level A'] or 0) + (entry2['Profession Level B'] or 0) return entry1_value < entry2_value end function format_entry(entry) -- Format the search result as [[Page]]. At the moment, don't include profession data in the table local page = entry[1] return page end function get_table_info(args) local variant_name = args.variant or mw.title.getCurrentTitle().fullText local query = { '[[Variant of::'..variant_name..']]', -- '?Profession A', '?Profession Level A', -- '?Profession B', '?Profession Level B', limit = args.limit or 500, } local smw_data = mw.smw.ask(query) table.sort(smw_data, sort_entries) local table_contents = {} for _, entry in ipairs(smw_data) do table.insert(table_contents, format_entry(entry)) end return table_contents end function p.variant_table(args) local elements = get_table_info(args) local table_contents = table.concat(elements, ' β’ ') local html = mw.html.create('div'):addClass('variants-header'):wikitext(table_contents) return html end function p.main(frame) local args = frame:getParent().args args.variant = args[1] or args.variant return p.variant_table(args) end return p
Summary:
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see
Brighter Shores:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Templates used on this page:
Template:Variants
(
edit
)
Module:Variants
(
edit
)
Module:Variants/doc
(
edit
)