MediaWiki Collections Intro

From UBC Wiki

Intro

  • UBC Wiki, Vista Integration(wiki books is a no go there), Namespaces, gardening

Exercise

  • Create pages (or use already created).
  • Importance of Categories, Titles

What is MediaWiki Collections

Collections is a MediaWiki extension that allows you to collect MediaWiki pages for export to various formats including DocBook XML , PDF , ODF Text Document

On the UBC Wiki the only output format currently available is PDF articles are exported to a PDF Server for rendering. The PDF writer extension connects to the mwlib library. The PDF server is hosted off the primary UBC Wiki server to reduce load.

About mwlib

mwlib is a Python library for parsing MediaWiki articles. It is currently aimed at developers, who have a need to somehow handle MediaWiki articles.

Project page: http://code.pediapress.com/wiki/wiki/mwlib

Google Group: http://groups.google.com/group/mwlib

Probably one of the more difficult extensions to get working consists of several languages and libraries:

  • Python >= 2.4
  • PHP Curl
  • Python Setup tools from http://www.reportlab.org/
  • Python Imaging Libary (PIL) which required some tk libraries so I yum tk-devel
  • Perl 5
  • ploticus ( we do not have this installed pnly required for graphing).
  • docutils
  • re2c
  • mwlib
  • Latex
  • dvips
  • ocaml
  • blahtexml
  • texvc
  • pdftk for table of contents (sort of required will work without)

Using Collections

To use the Collections extension you must be logged in to the UBC Wiki.

The following Namespaces can be collected NS_MAIN, NS_CATEGORY, NS_DOCUMENTATION, NS_COURSE

Things to avoid

  • Embeds (YouTube, Google Maps etc) will not render (obviously)
  • prints "as is", therefore avoid! Use ":" and "::" etc. to indent lines for example
  • Source code (either within "pre" or "source" tags that follow a picture will be printed over the picture. Probable reason. The renderer will reduce a picture and try to wrap text around it. Source code cannot be wrapped or not as well. Workaround: Move the image either 20 lines above or after the code.
  • Some templates will not render. Try to use simple layouts if attempting to transfer to book format.

Adding pages to a collection quickly

Bulk add pages to a Collection

You can add multiple pages to a collection by accessing the Category page . Example going to the Category Idioms http://wiki.ubc.ca/Category:Idioms you can add all these pages to the Collection.

Add pages using the NavPopups

Once you have one page in your Collection all links to pages within the Collection will initiate a Nav Popup for quick addition/removal of pages.

Inclusion/exclusion of content

Exclude Templates from Print

If you would like to exclude templates from print add them to the Category:Exclude_in_print

Exclude certain specific content

By using Template:Hide_in_print certain specific content, such as a few words or an image, can be excluded from printing.

Example:

This content will be printed.{{Hide in print|This content will not be printed.}}This content will be printed. 

Include certain specific content only in print versions

The Template:Only_in_print can be used to insert content that shall only be visible in offline versions.

Example:

 print this and display it in the browser {{Only in print|this is only in PDFs or printed books visible, not with the browser}} 
 this is visible in the browser and in print as well.

Alternative solution: use the class="hidden" within a div or span tag.

Substitute templates

You can create a print version of a template under the name "TEMPLATENAME/Print" with TEMPLATENAME being the name of the original template.

Saving your collections

The $wgEnableWriteAPI is enabled so users can save their books as pages in MW under their User namespace ie: User:UserName/Books/Bookname

Users are also able to save their pages under the community namespace ie: UBC_Wiki:Books/Bookname