MediaWiki/Editing/Advanced: Difference between revisions

From Bibliotheca Anonoma
No edit summary
Line 31: Line 31:
return p
return p
</nowiki>}}
</nowiki>}}
{{Note|As you see from the infobox call below, it calls the "default" function. You can also have other functions in one module, perhaps for using a smaller infobox (e.g. with no image) when the situation calls for it.}}


{{#invoke: Infobox_Test | default  
{{#invoke: Infobox_Test | default  

Revision as of 20:03, 8 January 2017

Some advanced features are supported on this wiki.

Creating Infoboxes

Infoboxes on the Bibliotheca Anonoma Wiki are created using Capiunto, a Lua module is relatively easier to install and create infoboxes with than the opaque and puzzling template language. It will take a bit of reading to understand how to make one, but it's worth it.

Basic Usage Guide for Capiunto

Here's an example infobox:

Module:Infobox_Test
local p = {}
 
function p.default(frame)
	local capiunto = require 'capiunto'
	return capiunto.create( {
		top = tostring(mw.title.getCurrentTitle()),
		topStyle = 'background:#cfc;',
		bottom = frame.args["description"]; -- description
	} )
	:addImage(
		string.format('[[File:%s|200px]]', frame.args["img_url"]), -- featured image
		frame.args["caption"] -- caption
	)
	:addRow('URL', frame.args["url"])
	:addRow('Project Status', frame.args["project_status"])
	:addRow('Archiving Status', frame.args["archiving_status"])
	:addRow('Project Source', frame.args["project_source"])
end

return p
Note: As you see from the infobox call below, it calls the "default" function. You can also have other functions in one module, perhaps for using a smaller infobox (e.g. with no image) when the situation calls for it.
MediaWiki/Editing/Advanced
File:Test.png
This image is a test image that is found on Wikimedia Commons.
URL url
Project Status project status
Archiving Status archiving status
Project Source project source
This is a test of the Infobox system. The description would go here: though maybe it should go on the page instead and only semantic data here.

You can then use this infobox with the following method call, and the example appears on the right:

{{#invoke: Infobox_Test | default 
| description      = This is a test of the Infobox system. The description would go here: though maybe it should go on the page instead and only semantic data here.
| img_url          = test.png
| caption          = This '''image''' is a test image that is found on Wikimedia Commons. 
| url              = url
| project_status   = project status
| archiving_status = archiving status
| project_source   = project source
}}