Module:User:Rua/langspan

local export = {}

local LangSpan = {} LangSpan.__index = LangSpan

function export.new(text, lang, face, sc, tr) self = setmetatable({ _text = text, _lang = lang, _face = face, _sc = sc, _tr = tr }, LangSpan) -- Detect script if not self._sc then self._sc = require("Module:scripts").findBestScript(self._text, self._lang) end return self end

-- Wrap text in the appropriate HTML tags with language and script class. function LangSpan:show -- Add a script wrapper if self._face == nil then return '' .. self._text .. ' '	elseif self._face == "term" then return '' .. self._text .. '' elseif self._face == "head" then return '' .. self._text .. ' '	elseif self._face == "bold" then return '' .. self._text .. '' else error("Invalid script face \"" .. self._face .. "\".") end end

function LangSpan:getScript return self._sc end

return export