Документация
local p = {}

function p.co( frame )
	return frame:expandTemplate{ title = frame.args[1], args = { } }
end

function p.full_wiki_text( frame )
	local co = frame:expandTemplate{ title = frame.args[1], args = { } }
	--local description = "<nowiki><pre>" .. co .. "</pre></nowiki>"
	local description = co
	--[[
	for i=1, #co do 
		local c = co:sub(i,i)
		description = description .. c 
	end
	local pattern =  "div"
	local no_div = string.gsub(co, pattern, '...')
	local description = ""
	for i=1, #no_div do 
		local c = no_div:sub(i,i)
		description = description .. c .. "$"
	end
	description = description .. "</nowiki>"
	]]--
	return description
end

function p.find_words( frame )
	local co = frame:expandTemplate{ title = frame.args[1], args = { } }
	local data = string.find(co, "datebegin")
	return data
end

function p.get_segment( frame )
	local co = frame:expandTemplate{ title = frame.args[1], args = { } }
	local segment_start = string.find(co, "datebegin")
	local segment_end = string.find(co, "dateend")
	local segment = ""
	for i = segment_start, segment_end do
		local c = co:sub(i,i)
		segment = segment .. c
	end
	return segment
end

function p.get_data(frame)
	local co = frame:expandTemplate{title = frame.args[1], args = {}}
	local segment_start = string.find(co, "<span id=\"datebegin\"></span>")
	if segment_start == nil then return "" end
	segment_start = segment_start + 28
	local segment_end = string.find(co, " года<span id=\"dateend\"></span>", segment_start)
	if segment_end == nil then 
	 segment_end = string.find(co, "<span id=\"dateend\"></span>", segment_start)
	 if segment_end == nil then return "" end
	end
	segment = co:sub(segment_start,segment_end)
	return segment
	--[[
	for i = segment_start, segment_end do
		local c = co:sub(i,i)
		segment = segment .. c
	end
	local data = ""
	if string.find(segment, "года") == nil then
		local space = 0
		for i = (string.find(segment, ">") + 1), (#segment - 1) do
			local c = segment:sub(i,i)
			if c == " " then space = space + 1 end
			if space == 3 then break end
			data = data .. c
		end
	else
		for i = (string.find(segment, ">") + 1), (string.find(segment, "года") - 1) do
			local c = segment:sub(i,i)
			data = data .. c
		end
	end
	
	return data
	--]]
end

return p