FANDOM

!
19 Pages

local helloworld = {}
local replace = mw.ustring.gsub
local trim = mw.text.trim
local itersplit = mw.text.gsplit
local split = mw.text.split
local match = mw.ustring.match
local itermatch = mw.ustring.gmatch
local find = mw.ustring.find
 
function helloworld.gallery(frame)
	local args = mw.clone(frame:getParent().args)
 
	local caption, colorpair = args['caption'] or '', args['color'] or 'royalblue; white'
 
	colorpair = split(colorpair, '; ?')
 
	local gallery = mw.html.create('gallery')
	gallery
		:attr('caption', caption)
 
		:attr('bordercolor', colorpair[1])
		:attr('captiontextcolor', colorpair[2])
 
		:attr('bordersize', 'none')
 
		:attr('captionposition', 'within')
		:attr('captionalign', 'center')
 
		:attr('widths', '115')
		:attr('position', 'center')
		:attr('spacing', 'small')
		:attr('orientation', 'square')
 
		:attr('navigation', 'true')
		:attr('orientation', 'true')
 
	local files, captions, targets = {}, {}, {}
	local skip_me_i_am_not_a_link = false
	for i = 1, #args do
		local one, two, three = args[i], args[i+1] or '', args[i+2] or ''
 
		if skip_me_i_am_not_a_link == true then
			skip_me_i_am_not_a_link = false
		elseif skip_me_i_am_not_a_link == false then
			if find(one, '%.%w%w%w$') then
				table.insert(files, trim(one))
				table.insert(captions, trim(two))
 
				if find(three, '%.%w%w%w$') then
					table.insert(targets, '')
					skip_me_i_am_not_a_link = true
				else
					table.insert(targets, trim(three))
				end
			end
		end
	end
 
	for i = 1, #files do
		if not find(captions[i], '%[%[') and targets[i] ~= '' then
			captions[i] = '[[' .. targets[i] .. '|' .. captions[i] .. ']]'
		end
 
		gallery:wikitext('\n' .. files[i] .. '|' .. captions[i] .. '|link=' .. targets[i])
	end
 
	gallery = tostring(gallery)
	gallery = frame:preprocess(gallery)
 
	return gallery
end
 
 
 
function helloworld.a(frame)
	local text = mw.text.unstripNoWiki(frame.args[1])
 
	text = trim(text)
 
	text = replace(text, '\n([%a%d]+)\n', '\n{{center|— %1 —}}\n')
	text = replace(text, '&lt;br&gt;', '<br>')
	text = replace(text, '&lt;hr&gt;', '<noinclude>{{multicol-break}}</noinclude>')
	text = replace(text, '%[([%a%d%|%.%-]+)%]', function(a) return '{{swatow entry|〓|' .. replace(a, '[|.]', '|') .. '}}' end)
 
	text = replace(text, '([%a])2', '%1́')
	text = replace(text, '([%a])3', '%1̀')
	text = replace(text, '([%a])5', '%1̂')
	text = replace(text, '([%a])6', '%1̆')
	text = replace(text, '([%a])7', '%1̄')
 
	text = replace(text, 'OO', 'o̤')
	text = replace(text, 'UU', 'ṳ')
	text = replace(text, 'NN', 'ⁿ')
 
	text = mw.ustring.toNFC(text)
 
	return frame:preprocess('<pre><nowiki>' .. text .. '\n\n</nowiki></pre>')
end
 
function helloworld.b(frame)
	local text = mw.text.unstripNoWiki(frame.args[1])
 
	text = trim(text)
 
	text = '{{rh|000|{{bold|000—000}}|000}}\n{{rule}}\n{{multicol|line=1px solid black}}\n' .. text .. '\n{{multicol-end}}\n{{nop}}'
 
	text = replace(text, '\n\n', '\n{{multicol-break}}\n')
 
	text = replace(text, '\n([^\n ]+) ', '\n{{bold|%1}} ')
	text = replace(text, '「', '{{ol|')
	text = replace(text, '」', '}}')
	text = replace(text, '([^\n]+)', '%1\n')
 
	text = trim(text)
 
	return frame:preprocess('<pre><nowiki>' .. text .. '\n\n</nowiki></pre>')
end
 
function helloworld.gen(frame)
	local start = tonumber(frame.args[1]) or 1
	local roof = tonumber(frame.args[2]) or 50
	local increment = tonumber(frame.args[3]) or 1
 
	local prepend = frame.args['^'] or ''
	local append = frame.args['$'] or ''
 
	local numbers = {}
 
	local i = start
 
	while not (i > roof) do
		table.insert(numbers, ' ' .. prepend .. i .. append)
		i = i + increment
	end
 
	return table.concat(numbers, '\n')
end
 
return helloworld

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.