Module:Convert armoire event

From Final Fantasy XIV Online Wiki
Jump to navigation Jump to search
Documentation for Module:Convert armoire event [view] [edit] [history] [purge] (How does this work?)

Usage

This module converts strings of the form "A - N" (where N is a number) into "A (N)", typically to format seasonal events in {{Armoire list result format}}.

If the input does not match the expected format, it is returned unchanged.

Syntax

{{#invoke:Convert armoire event|convert|input}}

Parameters

Parameter Description
1 The input string to convert.

Examples

Input Output
{{#invoke:Convert armoire event|convert|Hatching-tide - 2025}} Hatching-tide (2025)
{{#invoke:Convert armoire event|convert|Make It Rain - 2025}} The Make It Rain (2025)
{{#invoke:Convert armoire event|convert|No dash here}} No dash here
{{#invoke:Convert armoire event|convert|Sword - Longsword}} Sword - Longsword

Notes

  • The separator must be a dash surrounded by single spaces ( - ).
    • Variants like A-B or A - B will not be converted.
  • The part after the separator must be a whole number (e.g. a year). Non-numeric values will not be converted.
  • If the input contains "Make It Rain", the output is prefixed with "The ".


local p = {}

function p.convert(frame)
    local input = frame.args[1] or ""
    local a, b = input:match("^(.+) %- (%d+)$")
    if a and b then
        local prefix = input:find("Make It Rain") and "The " or ""
        return prefix .. a .. " (" .. b .. ")"
    end
    return input
end

return p