Module:Test

local ustring = mw.ustring local str = {} -- for local char_width = { ['zh'] = 2, }

str._limit = function(s, len, suffix, lang) suffix = suffix or ' ...' -- truncate s = ustring.sub( s, 0, len ) -- word pruning local s2 = ustring.match(s, '.+%s') return (s2 or s) .. suffix; end

str.limit = function(frame) return str._limit(frame.args[1], frame.args[2], frame.args['suffix'], frame.args['lang'] ) end

return str