پودمان:Module wikitext

    از ویکی تراث
    نسخهٔ تاریخ ‏۴ اوت ۲۰۲۳، ساعت ۱۷:۲۱ توسط Admin (بحث | مشارکت‌ها) (۱ نسخه واردشده: الگو و پوددمانهای اصلاح شده)
    (تفاوت) → نسخهٔ قدیمی‌تر | نمایش نسخهٔ فعلی (تفاوت) | نسخهٔ جدیدتر ← (تفاوت)

    Usage

    This is an auxiliary module used to allow module pages to display wikitext. Use it by setting this module's text value to whatever content you want to display. The _addText helper method may be useful. For example, to tag a module with {{delete}}, put require('Module:Module wikitext')._addText('{{delete|reason}}') at the top of it.


    local p = {}
    
    p.text = ''
    
    function p.main()
    	return p.text
    end
    
    function p._addText(text, preprocessFrame)
    	if preprocessFrame ~= false then
    		text = (preprocessFrame or mw.getCurrentFrame()):preprocess(text)
    	end
    	p.text = p.text .. text
    end
    
    return p