Module:LatinRunes

From Puella Magi Wiki
Jump to navigation Jump to search
Module Documentation    [edit]

A module for displaying Latin Witch Runes. For using other runic typefaces, see Template:Runes.

Functions

Function name Arguments Output
svg
  • 1 - string to be displayed as Witch runes
  • 2 - image size (if left empty, is treated as x10px)
  • 3 - font size for text that isn't available as Latin rune SVG
Substitutes every Latin alphabet letter (case-insensitive A-Z, Cyrillic and German letters not included) in 1 into [[File:Latin {uppercase letter}.svg|{2}|class=invert-dark|alt={uppercase letter}]], and leaves other characters (such as periods or numbers) as regular text. Lowercase letters are automatically converted.

If 3 is specified, additionally encases everything in <span style="font-size:{value of 3}>{the rest of output}</span>.

Usage examples

{{#invoke:LatinRunes|svg|MAGIA RECORD}}

MAGIA RECORD

{{#invoke:LatinRunes|svg|Deny the obvious, uphold the inane...?|x40px}}

DENY THE OBVIOUS, UPHOLD THE INANE...?

{{#invoke:LatinRunes|svg|Deny the obvious, uphold the inane...?|x40px|4em}}

DENY THE OBVIOUS, UPHOLD THE INANE...?


-- temporary solution until i figure out how to utilize SDF fonts properly and make a normal font

local _ = {}

_.svg = function(frame)
	-- t - text
	local t = frame.args[1]
	-- s - size of SVGs
	local s = frame.args[2]
	-- st - size of non-SVG plaintext
	local st = frame.args[3]
	-- r - result
	local r = ""
	
	if s == nil or s == "" then
		s = "x10px"
	end
	
	for v in t:gmatch"." do
    	if string.match(v,"[a-zA-Z]") then
    		r = r .. "[[File:Latin " .. string.upper(v) .. ".svg|" .. s .. "|class=invert-dark|alt=" .. string.upper(v) .. "]]"
    	else
    		r = r .. v
    	end
	end
	if st ~= nil and st ~= "" then
		r = "<span style=\"font-size:" .. st .. "\">" .. r .. "</span>"
	end
	
	return r
end

return _