Documentation for this module may be created at Մոդուլ:wiki-utils/doc

-- Module:wiki-utils v0.2
-- 2015-07-06

-- 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

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

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

function export.anchor(prefix, name)
	return '{{anchor|' .. prefix .. ' ' .. name .. '}}'
end

return export