Neidio i'r cynnwys

Modiwl:IsValidPageName

Oddi ar Wicipedia
Dyma ddiwygiad cyfredol y dudalen Modiwl:IsValidPageName a ddiwygiwyd gan Llywelyn2000 (sgwrs | cyfraniadau) am 09:47, 10 Ionawr 2016. Mae'r URL yn y Bar Lleoliad uwchben yn ddolen barhaol i'r fersiwn hwn o'r dudalen hon.
(gwahan) ← Fersiwn hŷn | Fersiwn diweddaraf (gwahan) | Fersiwn diweddarach → (gwahan)

Usage

[golygu cod]

This template returns "valid" if the given page title is valid, or the empty string otherwise. The page does not need to exist in order for the template to return "valid".

{{#invoke:IsValidPageName|isValidPageName|a potential page name}}



-- This module implements [[Template:isValidPageName]].

local export = {}

function export.isValidPageName(frame)
	local success, res = pcall(mw.title.new, frame.args[1])
	if success and res then
		return "valid"
	else
		return ""
	end
end

return export