ผลต่างระหว่างรุ่นของ "มอดูล:Expand wikitext"
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
หน้าใหม่: local p = {} local yesno = require("Module:Yesno") function p.main(frame) local pframe = frame:getParent() local code = frame.args[1] if mw.text.trim(mw.text.killMark... |
to use {{{unstrip}}} and simpler version |
||
บรรทัด 8: | บรรทัด 8: | ||
end |
end |
||
return pframe:preprocess(code) |
return pframe:preprocess(code) |
||
end |
|||
-- just in case we need to use {{{unstrip}}} in wikitext |
|||
-- also this make the code simpler and faster |
|||
function p.preprocess(frame) |
|||
return frame:preprocess(frame.args[1]) |
|||
end |
|||
function p.preprocessUnstrip(frame) |
|||
return frame:preprocess(mw.text.unstripNoWiki(frame.args[1])) |
|||
end |
end |
||
รุ่นแก้ไขเมื่อ 11:12, 23 กันยายน 2564
มอดูลนี้ได้รับการจัดอันดับว่าพร้อมใช้งานทั่วไป มีความสมบูรณ์แล้วและคิดว่าจะปราศจากข้อผิดพลาดและพร้อมสำหรับการใช้งานตามความเหมาะสม พร้อมจะกล่าวถึงในหน้าช่วยเหลือและแหล่งข้อมูลวิกิพีเดียอื่น ๆ ว่าเป็นตัวเลือกสำหรับผู้ใช้ใหม่ในการเรียนรู้ เพื่อลดภาระของเซิร์ฟเวอร์และเอาต์พุตที่ไม่ดี ควรปรับปรุงโดยการทดสอบที่กระบะทราย แทนที่จะแก้ไขแบบลองผิดลองถูกซ้ำ ๆ |
การใช้งาน
{{#invoke:Expand wikitext|function_name}}
ตัวอย่าง
{{#invoke:expand wikitext|main|<nowiki>{{1x|x}}-</nowiki>}}
→ {{1x|x}}-{{#invoke:expand wikitext|main|<nowiki>{{1x|x}} -</nowiki>}}
→ x -{{#invoke:expand wikitext|main|<nowiki><u>u</u><ref>text</ref></nowiki>}}
→ <u>u</u><ref>text</ref>{{#invoke:Expand wikitext|preprocessDecodeUnstrip|<nowiki>{{1x|x}}-</nowiki>}}
→ ข้อผิดพลาดสคริปต์: ฟังก์ชัน "preprocessDecodeUnstrip" ไม่มีอยู่{{#invoke:Expand wikitext|preprocessDecodeUnstrip|<nowiki>{{1x|x}} -</nowiki>}}
→ ข้อผิดพลาดสคริปต์: ฟังก์ชัน "preprocessDecodeUnstrip" ไม่มีอยู่{{#invoke:Expand wikitext|preprocessDecodeUnstrip|<nowiki><u>underline</u><ref>text</ref></nowiki>}}
→ ข้อผิดพลาดสคริปต์: ฟังก์ชัน "preprocessDecodeUnstrip" ไม่มีอยู่
คู่มือการใช้งานที่ปรากฏด้านบนนี้ดึงมาจาก มอดูล:Expand wikitext/doc (แก้ | ประวัติ) ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของมอดูลนี้ หน้าย่อยของมอดูลนี้ |
local p = {}
local yesno = require("Module:Yesno")
function p.main(frame)
local pframe = frame:getParent()
local code = frame.args[1]
if mw.text.trim(mw.text.killMarkers(code)) == "" or yesno(frame.args.unstrip) then
code = mw.text.unstripNoWiki(code);
end
return pframe:preprocess(code)
end
-- just in case we need to use {{{unstrip}}} in wikitext
-- also this make the code simpler and faster
function p.preprocess(frame)
return frame:preprocess(frame.args[1])
end
function p.preprocessUnstrip(frame)
return frame:preprocess(mw.text.unstripNoWiki(frame.args[1]))
end
return p