Jump to content
Wikipedia The Free Encyclopedia

Module:Respell

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
[画像:Ready for use] This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing.
[画像:Protected] This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.
Warning This Lua module is used on approximately 20,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them.

This module implements {{Respell }}. Please see the template page for documentation.

The above documentation is transcluded from Module:Respell/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.

 local p = {}

 function p._main(args)
	local ret = {}
	for i, v in ipairs(args) do
		v = mw.text.trim(v)
		-- Compatibility: Ignore arguments that only contain an apostrophe
		if v ~= '' and v ~= "'" then
			if ret[#ret]
				and not (ret[#ret]:find('_') or ret[#ret]:find('%-%)?$'))
				and not (v:find('_') or v:find('^%(?%-'))
			then
				table.insert(ret, '-')
			end
			if v:find('^[%u%(%)]+$') then
				v = '<span style="font-size:90%">' .. v .. '</span>'
			end
			table.insert(ret, v)
		end
	end
	ret = '<i title="English pronunciation respelling">' ..
		table.concat(ret):gsub('_', ' ')
			 -- Avoid dangling hyphens
			:gsub(' %-', ' -&#8288;')
			:gsub('^%-', '-&#8288;')
		.. '</i>'
	if args.link ~= 'no' then
		ret = '[[Help:Pronunciation respelling key|' .. ret .. ']]'
	end
	return ret
 end

 function p.main(frame)
	return p._main(frame:getParent().args)
 end

 return p

AltStyle によって変換されたページ (->オリジナル) /