Difference between revisions of "Template:IsValidPageName"

From blackwiki
Jump to navigation Jump to search
imported>Mr. Stradivarius
(use Module:IsValidPageName per protected edit request by User:Mxn)
imported>Pppery
(Module being deleted)
 
Line 1: Line 1:
{{#ifeq:{{{1}}}|-||{{#invoke:isValidPageName|isValidPageName|{{{1}}}}}}}<noinclude>
+
{{#ifeq:{{{1}}}|-||{{#iferror:{{#invoke:Page|invalid|{{{1}}}}}||valid}}}}<noinclude>
 
{{documentation}}
 
{{documentation}}
 
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
 
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
 
</noinclude>
 
</noinclude>

Latest revision as of 21:37, 10 September 2020

Template documentation[view] [edit] [history] [purge]

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". As a convenience, the template treats "-" as an invalid page title.

Usage

{{#if:
   {{{1|}}} |
   {{#if:
     {{isValidPageName|{{{1}}}}} |
     [[{{{1}}}]] |
     {{{1}}}
   }}
 }}

Examples

  • {{isValidPageName|Main Page}} returns "valid"
  • {{isValidPageName|[[Main Page]]}} returns ""
  • {{isValidPageName|This page could not POSSIBLY exist, could it?}} returns "valid"
  • {{isValidPageName|-}} returns "" (even though "-" can exist)
  • {{isValidPageName}} returns ""

See also

ko:틀:IsValidPageName th:แม่แบบ:IsValidPageName