Mediawiki cheatsheet: Difference between revisions

From Fabulous Loop de Loop
Jump to navigation Jump to search
Line 106: Line 106:
<pre>
<pre>
<---------HTML--------------><-------------------------------------MEDIAWIKI-------------------------------------------><HTML>
<---------HTML--------------><-------------------------------------MEDIAWIKI-------------------------------------------><HTML>
   open p tag with the class              target                  id of annotation          display text on         close p tag
   open p tag with the class              target                  id of annotation          display text on           close  
     "annotation-return"                  page                    on target page          annotation page
     "annotation-return"                  page                    on target page          annotation page           p tag
             |                              |                          |                          |
             |                              |                          |                          |                      |
<p class="annotation-return">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</p></pre>
<p class="annotation-return">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</p></pre>



Revision as of 15:22, 16 September 2020

Images

MediaWiki documentation on images

Images can be included and styled in many different ways. The example below is for an image that has the following settings:

[[File:isbn_barcode.jpeg|150px|thumb|ISBN barcode]]

Image settings

The settings above, separated by vertical bars (|), specify how the image will be displayed in read mode.

             1             2     3        4
[[File:isbn_barcode.jpeg|150px|thumb|ISBN barcode]]

1. The first part of the link is necessary to display the uploaded image, in this case the file named isbn_barcode.jpeg.

2. 150px = the size the image will appear at on the page. Not necessary, but if not specified the image will appear at full size.

3. thumb = a thumbnail image. Also not necessary, but images will appear frameless by default unless otherwise specified. Other options include "framed" for a picture frame, and "frameless" for one without a frame.

4. ISBN barcode = a caption for the image. Not necessary, but handy for the reader.

Image links

Add link= and the name of the page to link to as an option:

[[File:Wiki.png|50px|link=MediaWiki]]

To unlink an image, remove page names after link=

[[File:Wiki.png|50px|link=]]

Adding footnotes

MediaWiki documentation on the cite extension, which allows you to add footnotes

To allow footnotes to be cited on a page correctly, with automatically generated links that jump to them, use a bit of HTML, and the ref and references tags.

N.B: The full text you want to have displayed in the footnote should appear within the body of your text, enclosed in opening and closing tags like so:

Blah blah blah <ref>Text for the footnote here</ref> blah blah blah blah

Finally, add the

<references />

tag at the bottom of the section you are editing.

Blah blah blah <ref>Text for the footnote here</ref> blah blah blah blah. Yada yada yada <ref>My second footnote</ref> yada yada yada

<references />

This will appear like so:

Blah blah blah [1] blah blah blah blah. Yada yada yada [2] yada yada yada

  1. Text for the footnote here
  2. My second footnote

All references will be automatically numbered in sequential order as they appear on the page. The ref tags tell MediaWiki where footnotes should appear in the text, and the references tag tells it where to put the list of footnotes.

Adding annotations

The working method (for now) is to include annotations in the following way:

1. Create a page for annotation. There are several ways to start a new page, these can vary based on the type of page started, as well as the wiki and namespace. For annotations, we will need to create standalone pages, and then link them, so the best ways are to use either the search box (recommended) or the wiki's URL.

From the search box

If you search for a page that doesn't exist (using the search box and "Go" button on the left of the page) then you will be provided with a link to create the new page.

Using the URL

You can use the wiki's URL for creating a new page. The URL to an article of the wiki is usually something like this:

http://www.example.net/index.php/ARTICLE or http://www.example.net/wiki/ARTICLE

If you replace ARTICLE with the name of the page you wish to create, you will be taken to a blank page which indicates that no article of that name exists yet.

Clicking the "Edit" page tab at the top of the page will take you to the edit page for that article, where you can create the new page by typing your text, and clicking submit.

2. Add text to the page, with the title of the annotation styled as an h2 header, e.g.:

==Macy Conferences 1948-1953==

N.B: The title of the annotation must correspond exactly to the title of the page.

3. Add the page you created to the Category:Annotation, by putting this at the bottom of the page:

[[Category:Annotation]]

This will ensure that all annotations are listed in an index when a reader visits the Category:Annotation page.

3. Transclude page in The Annotation:

{{:Test Annotation}}

4. On target page (where the annotation should appear), add link to page, enclosed in

tags with the class "annotation":

<p class="annotation">[[Test Annotation]]</p>

5. On the page for the relevant e.g. Test_Annotation, add an anchor (id) to annotation that appears on target page. In this example, the target page is W._Grey_Walter_–_The_Body_in_Pieces, the id is #Test_Annotation, and the display text is the name of the chapter W. Grey Walter – The Body in Pieces. The target page name and ID are followed by a pipe symbol (|), and then the text to be displayed on the page for the relevant annotation.

<p class="annotation-return">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]

The above syntax (a mixture of HTML and MediaWiki) breaks down as so:

<---------HTML--------------><-------------------------------------MEDIAWIKI-------------------------------------------><HTML>
  open p tag with the class              target                  id of annotation           display text on            close 
     "annotation-return"                  page                     on target page           annotation page            p tag
             |                              |                           |                          |                      |
<p class="annotation-return">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</p>

Making categories

https://www.mediawiki.org/wiki/Help:Categories

Categories are useful ways to produce tables of content based on automatically produced indices. To do this, use the Category namespace.

Add the name of the category to the following text (where Name is the name of the category):

[[Category:Name]]

For example, if you want to name a category "Tasks" this is how to add it:

e.g.

[[Category:Tasks]]

Usually this is added at the bottom of a page (in edit mode), but it can be placed anywhere and still work.

The first time this is added to a page, the link will appear in red (in read mode) at the bottom of a page, meaning that the page for this new category has not been made yet. Click the link, and create the page, where you can add a description of the category. After this, the link will appear in blue, and you can start adding other pages to the same category.

Transclusion

Mediawiki documentation on transcluding pages

If you want to have the same content included in more than one place on the wiki, transclusion is useful. This way you only have to edit the source page, and it will appear updated on any target page where it is transcluded. You can transclude a source page within target pages by adding the name of the page you want to transclude, enclosed in a pair of curly braces:

{{source page name}}

e.g:

{{User:Simon/A note to the reader}}