local p = {} function p.table(frame) local max_pieces = 500 local args = (frame == mw.getCurrentFrame() and frame.args) or frame res_table = {} local title = mw.text.trim(args["标题"] or "") table.insert(res_table, "\n{|class=voicescripttable mw-collapsible ") table.insert(res_table, "style=\"width:835px;max-width:100%;line-height:30px;text-align:center;display:table;white-space:normal;font-size:unset;\"\n") if title ~= "" then table.insert(res_table, string.format("|+ style=\"text-align=center;font-weight:bold;font-size:1.25em;line-height:50px;letter-spacing: 0.1em;word-spacing: 0.2em;\"|%s", title)) end for i = 1, max_pieces do local piece_title = mw.text.trim(args["标题" .. i] or "") if piece_title ~= "" then local piece_name = mw.text.trim(args["名字" .. i] or "") local piece_text = mw.text.trim(args["文本" .. i] or "") local piece_cond = mw.text.trim(args["条件" .. i] or "") local cond_str1 = (piece_cond ~= "") and string.format(" (%s)", piece_cond) or "" local cond_str2 = (piece_cond ~= "") and string.format("<br>'''(%s)'''", piece_cond) or "" table.insert(res_table, "\n|-\n|style=\"text-align:left;\"|") if piece_name ~= "" then table.insert(res_table, string.format("<p class=\"voicescript-name-cn\">'''%s%s'''</p>", piece_name, cond_str1)) table.insert(res_table, string.format("<p class=\"voicescript-text-cn\" style=\"margin:20px 2em 20px 2em;\">%s</p>", piece_text)) else table.insert(res_table, string.format("<p class=\"voicescript-text-cn\" style=\"margin:30px 2em 30px 2em;\">%s%s</p>", piece_text, cond_str2)) end end end table.insert(res_table, "\n|}") return table.concat(res_table) end return p