Current mission: fill in OTDs. Example: Dailyjak:On This Day/March 29
Module:Wingdings
From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
Documentation for this module may be created at Module:Wingdings/doc
local p = {}
-- English to Wingdings Unicode Character Map
-- Key is the English character, Value is the Wingdings Unicode representation
local char_map = {
['A'] = 'A', ['a'] = 'a', -- These will render as Wingdings A/a glyphs if the font is applied
['B'] = 'B', ['b'] = 'b',
['C'] = 'C', ['c'] = 'c',
['D'] = 'D', ['d'] = 'd',
['E'] = 'E', ['e'] = 'e',
['F'] = 'F', ['f'] = 'f',
['G'] = 'G', ['g'] = 'g',
['H'] = 'H', ['h'] = 'h',
['I'] = 'I', ['i'] = 'i',
['J'] = 'J', ['j'] = 'j',
['K'] = 'K', ['k'] = 'k',
['L'] = 'L', ['l'] = 'l',
['M'] = 'M', ['m'] = 'm',
['N'] = 'N', ['n'] = 'n',
['O'] = 'O', ['o'] = 'o',
['P'] = 'P', ['p'] = 'p',
['Q'] = 'Q', ['q'] = 'q',
['R'] = 'R', ['r'] = 'r',
['S'] = 'S', ['s'] = 's',
['T'] = 'T', ['t'] = 't',
['U'] = 'U', ['u'] = 'u',
['V'] = 'V', ['v'] = 'v',
['W'] = 'W', ['w'] = 'w',
['X'] = 'X', ['x'] = 'x',
['Y'] = 'Y', ['y'] = 'y',
['Z'] = 'Z', ['z'] = 'z',
-- Punctuation/Symbols (Use Unicode equivalent for cross-platform)
['!'] = '✎', -- U+270E (Pencil)
['?'] = '✉', -- U+2709 (Envelope)
['.'] = '✍', -- U+270D (Writing Hand)
[' '] = ' ', -- Space
-- NOTE: In the standard Wingdings font, the characters A-Z are just different glyphs.
-- The key is applying the font in the output.
}
function p.translate(frame)
-- Input is the text to be translated (e.g., "Hello World")
local input = frame.args[1] or ''
local result = {}
-- Process the input string character by character
for i = 1, mw.ustring.len(input) do
local char = mw.ustring.sub(input, i, i)
local translated = char_map[char]
-- Use the mapped character, or the original character if no map entry exists
if translated then
table.insert(result, translated)
else
table.insert(result, char)
end
end
-- The CRUCIAL STEP: Return the text wrapped in a span tag
-- to force the browser to use the Wingdings font.
return '<span style="font-family: Wingdings, Symbol, sans-serif;">' .. table.concat(result) .. '</span>'
end
return p