Module:ruby

From Wiktionary, the free dictionary
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.show(frame)
	local word = frame:getParent().args[1]
	word = mw.ustring.gsub(word, "%[([^%[%]]+)%]%(([^%(%)]+)%)", "<ruby><rb>%1</rb><rt>%2</rt></ruby>")
	word = mw.ustring.gsub(word, "(.)%(([^%(%)]+)%)", "<ruby><rb>%1</rb><rt>%2</rt></ruby>")
	return word
end

return export