モジュール:IsValidPageName

提供:日本TW架空国家WIKI
<templatestyles></templatestyles> <templatestyles></templatestyles> <templatestyles></templatestyles>

このモジュールは{{IsValidPageName}}を実装しています。引数として渡されたページ名が空白、または技術的に使えるページ名の場合、"valid"を返します(ページが実際に存在する必要はありません)。

使い方

下記のように使用してください。

{{#invoke:IsValidPageName|isValidPageName|''テスト''}}


-- このモジュールは [[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