ผลต่างระหว่างรุ่นของ "มอดูล:th-saurus"
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
ZilentFyld (คุย | ส่วนร่วม) // Edit via Wikiplus |
ZilentFyld (คุย | ส่วนร่วม) ไม่มีความย่อการแก้ไข |
||
บรรทัดที่ 15: | บรรทัดที่ 15: | ||
table.insert(set, item ~= title and item or nil) |
table.insert(set, item ~= title and item or nil) |
||
end |
end |
||
set["name"] = ((args["name"] or kind) == "ant") and "คำตรงข้ามของ" or "คำพ้องความของ" |
--set["name"] = ((args["name"] or kind) == "ant") and "คำตรงข้ามของ" or "คำพ้องความของ" |
||
set["title"] = args["title"] or nil |
set["title"] = args["title"] or nil |
||
if args["fold"] or #set > 10 then set["fold"] = 1 end |
if args["fold"] or #set > 10 then set["fold"] = 1 end |
รุ่นแก้ไขเมื่อ 22:16, 20 พฤศจิกายน 2563
- มอดูลนี้ขาดหน้าย่อยแสดงเอกสารการใช้งาน กรุณาสร้างขึ้น
- ลิงก์ที่เป็นประโยชน์: รายชื่อหน้าย่อย • การรวมมา • มอดูลทดสอบ
local M = {}
local match = mw.ustring.match
function M.syn(frame, kind)
local args = frame:getParent().args
local title = mw.title.getCurrentTitle().text
local word = args[1] or title
local content = mw.title.new("อรรถาภิธาน:" .. word):getContent()
local temp = kind or "syn"
local template = match(content, "{{th%-" .. temp .. "%-list|([^}]+)}}")
if template and template ~= "" then
local set = {}
for item in mw.text.gsplit(template, "|") do
table.insert(set, item ~= title and item or nil)
end
--set["name"] = ((args["name"] or kind) == "ant") and "คำตรงข้ามของ" or "คำพ้องความของ"
set["title"] = args["title"] or nil
if args["fold"] or #set > 10 then set["fold"] = 1 end
return '<div style="float: right; clear: right; font-size:60%"><span class="plainlinks">[' ..
tostring(mw.uri.fullUrl("อรรถาภิธาน:" .. word, { ["action"] = "edit" })) ..
' edit]</span></div>' .. frame:expandTemplate{ title = "template:th-syn-list", args = set }
else
return ""
end
end
return M