MediaWiki/Editing/Advanced: Difference between revisions

From Bibliotheca Anonoma
No edit summary
Line 1: Line 1:
Some advanced features are supported on this wiki.
Some advanced features are supported on this wiki.


== Creating Infoboxes ==
== Cargo (Semantic Infoboxes) ==
 
The infoboxes on the Bibliotheca Anonoma are augmented with Cargo, a Semantic Web extension (designed to replace Semantic MediaWiki). This gives the infobox elements the power to be indexed in a semantic metadata database. That way, queries and reports can be made to sort out the data for easier searching.
 
A full [[mediawikiwiki:Extension:Cargo/Other documentation|Cargo Cheatsheet can be found here.]]
 
=== Basic Components of a Cargo Subject ===
 
A single Cargo subject is made up of a three basic elements:
 
# '''Infobox''' - Defines an infobox that holds all the metadata on the right side of an article.
# '''Template''' - Defines the table schema.
# '''Table''' - Indexes the data for queries.
# '''Form''' - Helps users create a new page with fields for metadata.
# '''Page''' - Use the form to create a new page.
 
=== 1. Creating Infoboxes ===


Infoboxes on the Bibliotheca Anonoma Wiki are created using [[mediawikiwiki:Extension:Capiunto|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.
Infoboxes are created using [[mediawikiwiki:Extension:Capiunto|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.


[[mediawikiwiki:Extension:Capiunto/Infobox/Basic_usage|Basic Usage Guide for Capiunto]]
[[mediawikiwiki:Extension:Capiunto/Infobox/Basic_usage|Basic Usage Guide for Capiunto]]
Line 58: Line 74:
</nowiki>}}
</nowiki>}}


Finally, when documenting the Lua module, you must use the provided subpage under /doc, unlike our documentation standard for templates. This is because the lua code does not provide any wikitext processing.
{{Note|When documenting the Lua module, you must use the provided subpage under /doc, unlike our documentation standard for templates. This is because the lua code does not provide any wikitext processing.}}


== Cargo (Semantic Infoboxes) ==
Now, you need to integrate the infobox into the Cargo template.


The infoboxes on the Bibliotheca Anonoma are augmented with Cargo, a Semantic Web extension (designed to replace Semantic MediaWiki). This gives the infobox elements the power to be indexed in a semantic metadata database. That way, queries and reports can be made to sort out the data for easier searching.
=== 2. Create a Cargo Template ===


A full [[mediawikiwiki:Extension:Cargo/Other documentation|Cargo Cheatsheet can be found here.]]
The Cargo Template defines the table's schema: what kind of columns it has, and how it looks to the user.
 
=== Basic Components of a Cargo Subject ===
 
A single Cargo subject is made up of a three basic elements:


# '''Template''' - Defines the table schema.
Use the infobox you made in the previous step to show the data in this cargo template.
# '''Table''' - Indexes the data for queries.
# '''Form''' - Helps users create a new page with fields for metadata.
# '''Page''' - Use the form to create a new page.
 
=== 1. Create a Cargo Template ===
 
The Cargo Template defines the table's schema: what kind of columns it has, and how it looks to the user.


=== 2. Create a Cargo Table ===
=== 3. Create a Cargo Table ===


# Open the Cargo Template you need to create a template for.
# Open the Cargo Template you need to create a template for.
Line 87: Line 92:
The cargo table must be recreated each time the schema is modified in the template.
The cargo table must be recreated each time the schema is modified in the template.


=== 3. Create a Cargo Form ===
=== 4. Create a Cargo Form ===


# Go to [[Special:Forms]].
# Go to [[Special:Forms]].
Line 93: Line 98:
# Name the Form with the same base name as the Template. (e.g. for <code>Template:Book</code>, type in <code>Book</code>.)
# Name the Form with the same base name as the Template. (e.g. for <code>Template:Book</code>, type in <code>Book</code>.)


=== 4. Create a Cargo Page ===
=== 5. Create a Cargo Page ===


# Go to the page [[Form:Cargo Title]], replacing "Table Title" with the actual title of the cargo subject.
# Go to the page [[Form:Cargo Title]], replacing "Table Title" with the actual title of the cargo subject.

Revision as of 22:21, 14 January 2017

Some advanced features are supported on this wiki.

Cargo (Semantic Infoboxes)

The infoboxes on the Bibliotheca Anonoma are augmented with Cargo, a Semantic Web extension (designed to replace Semantic MediaWiki). This gives the infobox elements the power to be indexed in a semantic metadata database. That way, queries and reports can be made to sort out the data for easier searching.

A full Cargo Cheatsheet can be found here.

Basic Components of a Cargo Subject

A single Cargo subject is made up of a three basic elements:

  1. Infobox - Defines an infobox that holds all the metadata on the right side of an article.
  2. Template - Defines the table schema.
  3. Table - Indexes the data for queries.
  4. Form - Helps users create a new page with fields for metadata.
  5. Page - Use the form to create a new page.

1. Creating Infoboxes

Infoboxes 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
}}
Note: When documenting the Lua module, you must use the provided subpage under /doc, unlike our documentation standard for templates. This is because the lua code does not provide any wikitext processing.

Now, you need to integrate the infobox into the Cargo template.

2. Create a Cargo Template

The Cargo Template defines the table's schema: what kind of columns it has, and how it looks to the user.

Use the infobox you made in the previous step to show the data in this cargo template.

3. Create a Cargo Table

  1. Open the Cargo Template you need to create a template for.
  2. Click More at the top right next to the search bar.
  3. Click Create Cargo Table.

The cargo table must be recreated each time the schema is modified in the template.

4. Create a Cargo Form

  1. Go to Special:Forms.
  2. Choose the template to create the form for.
  3. Name the Form with the same base name as the Template. (e.g. for Template:Book, type in Book.)

5. Create a Cargo Page

  1. Go to the page Form:Cargo Title, replacing "Table Title" with the actual title of the cargo subject.
  2. Enter the title of the page you want to create.
  3. Fill out the form. In the "Free Text" box, you can create a normal wikipage.

Creating Templates

Note: Template documentation is set up the same way as in the Arch Wiki: inside <includeonly></includeonly> tags. This is simpler, if less clean than the Wikipedia template documentation, which puts it in a subpage.

When creating a template meant for users to utilize, you should place a {{Template}} header into it.

Note: Templates meant for internal template use only do not need this header.

This template should be added at the very beginning of all template pages between 'noinclude' tags:

<noinclude>
{{Template}}
</noinclude>

Documentation of the template, usage instructions, and output example should also be added between the 'noinclude' tags (as in this template).

The actual template code must be written between 'includeonly' tags:

<includeonly>...</includeonly>