Editing Module:AbilitySection

Jump to navigation Jump to search
Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 6: Line 6:
local AbilityHints    = require "Module:AbilityHints"
local AbilityHints    = require "Module:AbilityHints"
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")
local dictionary_data = mw.loadJsonData("Data:Dictionary")


-- Tab definitions — order here determines display order.
-- Tab definitions — order here determines display order.
-- label_dict_key names the [[Data:Dictionary]] entry holding the tab label; the Notes
-- tab reuses the existing 'Notes' entry rather than adding a duplicate.
local TABS = {
local TABS = {
     { key = 'notes',        label_dict_key = 'Notes'                     },
     { key = 'notes',        label = 'Notes'       },
     { key = 'tips',        label_dict_key = 'AbilityCardTabTips'        },
     { key = 'tips',        label = 'Tips'        },
     { key = 'interactions', label_dict_key = 'AbilityCardTabInteractions' },
     { key = 'interactions', label = 'Interactions' },
}
}
local SHOW_ALL_DICT_KEY = 'AbilityCardTabShowAll'
-- Tab labels are read from the dictionary directly instead of going through
-- Module:Dictionary, which appends Template:NeedsTranslationTooltip markup to
-- anything untranslated. mw.ext.tabber.render HTML-escapes a label and reuses it as a
-- DOM id, so that markup would show up as literal text in the tab and mangle the
-- anchor. Untranslated labels therefore fall back to English silently.
local function tab_label(dict_key)
    local entry = dictionary_data[dict_key]
    if entry == nil then return dict_key end
    return entry[lang.get_lang_code()] or entry.en or dict_key
end


local function get_hero_key(hero_name)
local function get_hero_key(hero_name)
Line 77: Line 61:
             table.insert(filled, {
             table.insert(filled, {
                 key    = tab.key,
                 key    = tab.key,
                 label  = tab_label(tab.label_dict_key),
                 label  = tab.label,
                 tab_wt = tab_wt,
                 tab_wt = tab_wt,
                 all_wt = wikitext_map[tab.key],
                 all_wt = wikitext_map[tab.key],
Line 105: Line 89:
         end
         end
         table.insert(tabs, {
         table.insert(tabs, {
             label  = tab_label(SHOW_ALL_DICT_KEY),
             label  = 'Show All',
             content = '<div class="ability-details-panel">' .. table.concat(all_parts) .. '</div>',
             content = '<div class="ability-details-panel">' .. table.concat(all_parts) .. '</div>',
         })
         })
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock: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

Pages included on this page:

This page is a member of a hidden category: