12,564
edits
TheNightAvl (talk | contribs) No edit summary Tag: Reverted |
TheNightAvl (talk | contribs) No edit summary Tag: Reverted |
||
| Line 6: | Line 6: | ||
local delimiters = "%s%p" | local delimiters = "%s%p" | ||
function export.parse( | function export.parse(parameters) | ||
local | local gloss = parameters.gloss | ||
local gloss_keys = {} | local gloss_keys = {} | ||
for glosslet in gloss:gmatch("[^" .. delimiters .. "]+") do | for glosslet in gloss:gmatch("[^" .. delimiters .. "]+") do | ||
if glosslet:match("^[%d%u]+$") then | if glosslet:match("^[%d%u]+$") then | ||
| Line 18: | Line 18: | ||
local l_gloss = m_data.aliases[gloss_code] | local l_gloss = m_data.aliases[gloss_code] | ||
if l then l_gross = type(l.glossary) == "string" and l.glossary or l.label end | if l then l_gross = type(l.glossary) == "string" and l.glossary or l.label end | ||
glosslet_format = frame:expandTemplate{title = "hover", args = {glosslet_format, l_gloss, noline = parameters.noline, style = parameters.style}} | |||
if | if parameters.nolink == nil then glosslet_format = "[[Appendix:Glossary#" .. l_gloss .. "|" .. glosslet_format .. "]]" end | ||
end | end | ||
gloss_keys[glosslet] = '<span style="font-variant: small-caps">' .. glosslet_format .. '</span>' | gloss_keys[glosslet] = '<span style="font-variant: small-caps">' .. glosslet_format .. '</span>' | ||
end | end | ||
end | end | ||
for search, replace in pairs(gloss_keys) do gloss = gloss:gsub(search, replace) end | for search, replace in pairs(gloss_keys) do gloss = gloss:gsub(search, replace) end | ||
return gloss | return gloss | ||
end | |||
function export.show(frame) | |||
local args = getArgs(frame) | |||
return export.parse{ | |||
gloss = args[1], | |||
nolink = args["nolink"], | |||
noline = args["noline"], | |||
style = args["style"] | |||
} | |||
end | end | ||