Внимание! Начат процесс обновления Wiki до версии игры 10.x. Если у Вас есть желание принять участие, то Вы можете найти больше информации в нашем ECO Contribution Wiki Discord.

Модуль:UtilsHTML

Материал из Eco - Русская Wiki
Перейти к:навигация, поиск

Для документации этого модуля может быть создана страница Модуль:UtilsHTML/doc

local p = {}

--- Create HTML <code>abbr</code>-tag (abbreviation).
-- @param #string abbreviation The abbreviation (visible text)
-- @param #string title Explanation of the abbreviation (show in tooltip when hovered)
-- @return #string HTML code: "&lt;abbr title="<code>abbreviation</code>"><code>text</code>&lt;/abbr>"
-- @author User:Demian
function p.tagAbbr(abbreviation, title)
	-- Cast to string to avoid errors from using the format string.
	return mw.ustring.format("<abbr style=\"text-decoration: underline dotted 0.0625em;\" title=\"%s\">%s</abbr>", tostring(title), tostring(abbreviation))
end

--- Create HTML code for table with two cells on the same row.
--
-- Intended for displaying two pieces of content side-by-side.
-- @param #string leftCell Content in left cell
-- @param #string rightCell Content in right cell
-- @return #string HTML code for a table with the specified content.
-- @author User:Demian
function p.twoCellTable(leftCell, rightCell)
	return mw.ustring.format("<table><tr><td>%s</td><td>%s</td></tr></table>", leftCell, rightCell)
end

return p