模块:Phlaman

来自「荏苒之境」
Sicusa留言 | 贡献2025年12月7日 (日) 13:46的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

此模块的文档可以在模块:Phlaman/doc创建

local ustring = mw.ustring

local phlaman = {}

phlaman.split_words = function(text)
	local ws = {}
	for sign, word, punc in ustring.gmatch(text, "([]?)([^ ]+)([ ]?)") do
		ws[#ws+1] = sign..word..punc
	end
	return ws
end

phlaman.show_resplitted = function(frame)
	local delimiter = frame.args[1]
	local text = frame.args[2]
	return table.concat(phlaman.split_words(text), delimiter)
end

return phlaman