Module:Freeze

local p = {}

function p.main(frame)
	return p._main(frame, frame:getParent().args)
end

function p._main(frame, args)
	local curTitle = mw.title.getCurrentTitle()
	local page = mw.text.trim(args[1] or '')
	local text = args[2] or ''

	if page == '' or string.sub(page, 1, 1) == '#' then
		page = curTitle.subjectPageTitle.prefixedText .. page
	end

	if text == '' then
		text = page .. ' (as of now)'
	end

	local title = mw.title.new(page)
	if mw.title.equals(title, curTitle) then
		local pageId = frame:callParserFunction('PAGEID', title.prefixedText)
		local revTimestamp = frame:callParserFunction('REVISIONTIMESTAMP', title.prefixedText)

		pageId = pageId ~= '0' and pageId or ''
		if mw.isSubsting() then
			return string.format('{{freeze/same page link|1=%s|2=%s|3=%s|4=%s}}',
				title.fullText, pageId, revTimestamp, text)
		else
			local samePageLink = require('Module:Freeze/same page link')._main
			return samePageLink{title.fullText, pageId, revTimestamp, text}
		end
	else
		local revId = frame:callParserFunction('REVISIONID', title.prefixedText)
		if revId == '' then
			return string.format('<strong class="error">Unable to get latest revision ID for "%s".</strong>', title.prefixedText)
		end
		if mw.isSubsting() then
			return string.format('{{oldid|1=%s|2=%s|3=%s}}<!-- Template:Freeze -->', title.fullText, revId, text)
		else
			return frame:expandTemplate{title='oldid', args={title.fullText, revId, text}}
		end
	end
end

return p

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.