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
 



















Contents

   



(Top)
 


1 Usage  














Module:Based on






العربية

Basa Bali
 / Bân-lâm-gú

Bikol Central
فارسی


ि
Bahasa Indonesia
Jawa
Kurdî
ि

Mirandés



Oʻzbekcha / ўзбекча

Português
Русский

Scots
Simple English
Slovenščina
Српски / srpski
Tagalog
Türkçe
Українська

 

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
 


This module implements {{Based on}}

Usage

To directly call this module (all arguments except work name optional):

{{#invoke:Based on|lua_main|Work name|Writer 1|Writer 2|...}}

To call it from a template, passing on the arguments from it:

{{#invoke:Based on|main}}

local p = {}

function p.lua_main(frame)
 local s = frame.args[1]
 
 if frame.args[3] then
  local args = {}
  
  for i, v in ipairs(frame.args) do
   if i >= 2 then
    args[#args+1] = v
   end
  end
  
  args['style'] = 'display: inline'
  args['list_style'] = 'display: inline'
  args['item1_style'] = 'display: inline'
  
  h = mw.html.create('div')
  h:wikitext(s)
  h:tag('br')  -- h:newline() is not working for some reason
  h:wikitext('by ')
  h:wikitext(frame:expandTemplate{ title = 'Unbulleted list', args = args })
  
  return h
 elseif frame.args[2] then
  s = s .. '<br />by ' .. frame.args[2]
  return s
 end
 
 return s
end

function p.main(frame)
 return p.lua_main(frame:getParent())
end

return p

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

Hidden category: 
Wikipedia template-protected modules
 



This page was last edited on 8 July 2018, at 02:54 (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