Модуль:wiki-utils
Зовнішній вигляд
Документацію для цього модуля можна створити у Модуль:wiki-utils/документація
-- Module:wiki-utils v0.2.1
-- 2016-10-21
-- This module contains useful functions which help to generate wiki-text.
-- It can be used in other modules with using "require" command.
local export = {}
function export.table_class()
return 'class="sortable prettytable"'
end
function export.link(name, value)
return '[[#' .. name .. '|' .. value .. ']]'
end
function export.bold(value)
return "'''" .. value .. "'''"
end
function export.italic(value)
return "''" .. value .. "''"
end
-- CODE
function export.colored_code(value, color)
return '<code style="color: ' .. color .. '">' .. value .. '</code>'
end
function export.code_green(value)
return export.colored_code(value, 'green')
end
function export.code_blue(value)
return export.colored_code(value, 'darkblue')
end
function export.code_purple(value)
return export.colored_code(value, 'purple')
end
function export.code_maroon(value)
return export.colored_code(value, 'maroon')
end
function export.code_olive_bold(value)
return export.bold(export.colored_code(value, 'olive'))
end
-- SPAN
function export.colored_span(value, color)
return '<span style="color: ' .. color .. '">' .. value .. '</span>'
end
function export.span_blue(value)
return export.colored_span(value, 'blue')
end
function export.span_darkblue(value)
return export.colored_span(value, 'darkblue')
end
function export.span_purple(value)
return export.colored_span(value, 'purple')
end
function export.span_green(value)
return export.colored_span(value, 'green')
end
function export.span_red(value)
return export.colored_span(value, 'red')
end
function export.span_gray(value)
return export.colored_span(value, 'gray')
end
function export.span_silver(value)
return export.colored_span(value, 'silver')
end
-- DIV
function export.colored_div(value, color)
return '<div style="color: ' .. color .. '">' .. value .. '</div>'
end
function export.div_red(value)
return export.colored_div(value, 'red')
end
-- TODO: add other colored div's
function export.anchor(prefix, name)
return '{{anchor|' .. prefix .. ' ' .. name .. '}}'
end
return export