ผลต่างระหว่างรุ่นของ "มอดูล:Dashboard entry"
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
Patsagorn Y. (คุย | ส่วนร่วม) ไม่มีความย่อการแก้ไข ป้ายระบุ: แก้ไขจากอุปกรณ์เคลื่อนที่ แก้ไขจากเว็บสำหรับอุปกรณ์เคลื่อนที่ แก้ไขขั้นสูงด้วยอุปกรณ์เคลื่อนที่ |
Patsagorn Y. (คุย | ส่วนร่วม) ไม่มีความย่อการแก้ไข ป้ายระบุ: แก้ไขจากอุปกรณ์เคลื่อนที่ แก้ไขจากเว็บสำหรับอุปกรณ์เคลื่อนที่ แก้ไขขั้นสูงด้วยอุปกรณ์เคลื่อนที่ |
||
บรรทัด 40: | บรรทัด 40: | ||
end |
end |
||
⚫ | |||
-- lets copy all of main function ;) |
|||
⚫ | |||
local page = frame.args[1] |
local page = frame.args[1] |
||
local pipe = frame.args[2] |
local pipe = frame.args[2] |
||
บรรทัด 47: | บรรทัด 49: | ||
-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua. |
-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua. |
||
-- Therefore, we have to parse the page manuallly |
-- Therefore, we have to parse the page manuallly |
||
local |
local sections = content:gmatch("%* *(.* *– *.+)") |
||
local count = 0 |
local count = 0 |
||
local |
local sect |
||
-- copy array to table so it can be iterated in reverse |
-- copy array to table so it can be iterated in reverse |
||
local secttable = {} |
local secttable = {} |
||
for |
for sect in sections do |
||
secttable[#secttable + 1] = |
secttable[#secttable + 1] = sect |
||
end |
end |
||
local declutter |
local declutter |
||
บรรทัด 65: | บรรทัด 67: | ||
local count = 0 |
local count = 0 |
||
for i = #secttable, 1, -1 do |
for i = #secttable, 1, -1 do |
||
sect = secttable[i] |
|||
output = output .. string.format("\n* %s", |
output = output .. string.format("\n* %s", sect) |
||
count = count + 1 |
count = count + 1 |
||
if count == 3 then |
if count == 3 then |
||
บรรทัด 78: | บรรทัด 80: | ||
end |
end |
||
return frame:preprocess(output) |
return frame:preprocess(output) |
||
end |
end |
||
รุ่นแก้ไขเมื่อ 20:01, 20 เมษายน 2564
คู่มือการใช้งานมอดูล[สร้าง]
คุณอาจจะต้องการสร้างคู่มือการใช้งานของมอดูลนี้ ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของมอดูลนี้ โปรดเพิ่มหมวดหมู่ไปที่หน้าย่อย /doc หน้าย่อยของมอดูลนี้ |
local p = {}
local plain = require("Module:Plain text")._main
function p.main(frame)
local page = frame.args[1]
local pipe = frame.args[2]
local content = mw.title.new(page):getContent()
-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua.
-- Therefore, we have to parse the page manuallly
local sections = content:gmatch("\n== *([^=]+) *==")
local count = 0
local sect
-- copy array to table so it can be iterated in reverse
local secttable = {}
for sect in sections do
secttable[#secttable + 1] = sect
end
local declutter
if #secttable < 3 then
declutter = "|class="
else
declutter = ""
end
local output = string.format("{{วิกิพีเดีย:แดชบอร์ด/กลุ่ม%s|1='''[[%s|%s]]''' (%s การอภิปราย)'''<div style='font-size:85%%; padding-left:1.5em;'>''ใหม่สุด:''",
declutter, page, pipe, #secttable)
local count = 0
for i = #secttable, 1, -1 do
sect = secttable[i]
output = output .. string.format("\n* [[%s#%s|%s]]", page, mw.uri.anchorEncode(sect), plain(sect))
count = count + 1
if count == 3 then
output = output .. "\n</div>}}\n<div style=\"padding-left:3em;\">"
end
end
if count < 3 then
output = output .. "</div>}} {{end}}"
else
output = output .. "</div>\n{{end}}"
end
return frame:preprocess(output)
end
function p.village_pump(frame)
local page = frame.args[1]
local pipe = frame.args[2]
local content = mw.title.new(page):getContent()
-- Unfortunately, the bot that this is replacing uses "prop=sections", which isn't accessible to Lua.
-- Therefore, we have to parse the page manuallly
local sections = content:gmatch("%* *(.* *– *.+)")
local count = 0
local sect
-- copy array to table so it can be iterated in reverse
local secttable = {}
for sect in sections do
secttable[#secttable + 1] = sect
end
local declutter
if #secttable < 3 then
declutter = "|class="
else
declutter = ""
end
local output = string.format("{{วิกิพีเดีย:แดชบอร์ด/กลุ่ม%s|1='''[[%s|%s]]''' '''<div style='font-size:85%%; padding-left:1.5em;'>''ใหม่สุด:''",
declutter, page, pipe)
local count = 0
for i = #secttable, 1, -1 do
sect = secttable[i]
output = output .. string.format("\n* %s", sect)
count = count + 1
if count == 3 then
output = output .. "\n</div>}}\n<div style=\"padding-left:3em;\">"
end
end
if count < 3 then
output = output .. "</div>}} {{end}}"
else
output = output .. "</div>\n{{end}}"
end
return frame:preprocess(output)
end
return p