Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 

















Module:For related page







Bahasa Indonesia

Slovenščina
Türkmençe
اردو
Tiếng Vit

 

Edit links
 









Module
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Permanently protected module

From Wikipedia, the free encyclopedia
 


local mFor = require('Module:For')
local mArguments = require('Module:Arguments')
local p = {}

function p.forFoo (frame)
 local args = mArguments.getArgs(frame, 
  {parentOnly = true}
 )
 local target
 if args[1] then
  target = args[1]
 else
  local title = mw.title.getCurrentTitle().text
  local titles = {
   mw.ustring.lower(mw.ustring.sub(title, 1, 1)) .. mw.ustring.sub(title, 2),
   title
  }
  local forms = frame.args
  for k, v in ipairs(forms) do
   for i, j in pairs(titles) do
    local lookup = string.format(v, j)
    if mw.title.new(lookup, 0).exists then
     target = lookup
     break
    end
   end
   if target then break end
  end
  target = target or string.format(forms[1], title)
 end

 return mFor._For({frame.args.what, target})
end
return p

Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:For_related_page&oldid=885097948"

Category: 
Hatnote modules
Hidden category: 
Wikipedia semi-protected modules
 



This page was last edited on 25 February 2019, at 23:17 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki