Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WiktionaryThe Free Dictionary
Search

Module:title/redirectTarget

From Wiktionary, the free dictionary

This module lacks adocumentation subpage. Pleasecreate it.
Useful links:root pageroot page’s subpageslinkstransclusionstestcasessandbox
localpcall=pcalllocalat_limitlocalfunctionis_redirect(title)returntitle.isRedirectend--[==[Returns the title object of the redirect target if title page is a redirect.Checking {title.redirectTarget} will transclude the title page, which may be undesirable when checking large numbers of titles. To avoid this, this function will attempt to check the {title.isRedirect} key first, only checking {title.redirectTarget} if it is confirmed that the title is a redirect. However, doing so will increment the expensive function count, which has a limit of 500. Once the limit has been reached, this function reverts to checking {title.redirectTarget} directly instead.The {force_transclusion} flag may be set to force the use of transclusion ({title.redirectTarget}) in all instances, which can be used to avoid incrementing the expensive function count; this is sometimes useful when making a large number of checks, as hitting the expensive function limit can be disruptive to other modules or templates.]==]returnfunction(title,force_transclusion)ifnot(force_transclusionorat_limit)thenlocalsuccess,result=pcall(is_redirect,title)ifnotsuccessthenat_limit=trueelseifnotresultthenreturnfalseendendlocalredirect=title.redirectTargetifnotredirectthenreturnfalseend-- If the original title had a fragment, carry it over to the redirect.localfragment=title.fragmentiffragmentandfragment~=""thenredirect.fragment=fragmentendreturnredirectend
Retrieved from "https://en.wiktionary.org/w/index.php?title=Module:title/redirectTarget&oldid=84899972"
Categories:

[8]ページ先頭

©2009-2025 Movatter.jp