Mediawiki cheatsheet: Difference between revisions

From Fabulous Loop de Loop
Jump to navigation Jump to search
 
(31 intermediate revisions by the same user not shown)
Line 55: Line 55:
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.
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==
==Making categories==
The working method (for now) is to include annotations in the following way:
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.


STEP 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.
Add the name of the category to the following text (where ''Name'' is the name of the category):


'''From the search box'''
<pre>[[Category:Name]]</pre>


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.
For example, if you want to name a category "Tasks" this is how to add it:


'''Using the URL'''
e.g. <pre>[[Category:Tasks]]</pre>


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:
Usually this is added at the bottom of a page (in edit mode), but it can be placed anywhere and still work.


http://www.example.net/index.php/ARTICLE    or
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.
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.
==Transclusion==
[https://www.mediawiki.org/wiki/Transclusion Mediawiki documentation on transcluding pages]


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.
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, prefaced by a colon, enclosed in a pair of curly braces:


STEP 2. Add text to the page, with the title of the annotation styled as Heading 2 (wrapped in two "equals" symbols) e.g.:
<pre>{{:source page name}}</pre>


<pre>
e.g:  <pre>{{:User:Simon/A note to the reader}}</pre>
==Macy Conferences 1948-1953==</pre>


'''N.B: The title of the annotation must correspond exactly to the title of the page.'''
Content within User namespaces can also be transcluded even without a colon


STEP 3. Add the page you created to the Category:Annotation, by putting this at the bottom of the page:
e.g. <pre>{{User:Simon/A note to the reader}}</pre>


==Lists==
===Main body numbered lists===
All numbered lists in the body text are styled by targeting the <code>ol</code> HTML tag generated by MediaWiki when you use MediaWiki syntax to make automatically-numbering lists:
e.g:
<pre>
<pre>
[[Category:Annotation]]</pre>
# the first item in the list
# the second item in the list
# the third item in the list
</pre>
 
This is rendered in the browser as
 
1. the first item in the list<br>
2. the second item in the list<br>
3. the third item in the list<br>


This will ensure that all annotations are listed in an index when a reader visits the Category:Annotation page.
An exclusion to this is in lists that appear in "A Parallel Text" (see section [[Mediawiki cheatsheet#A Parallel Text| A Parallel Text]] on this cheatsheet)


STEP 4. Transclude page in [[The Annotation]]:
===Main body alphabetical lists===
Lists which are ordered by alphabetical markers are not generated by MediaWiki. These should be typed into the main body of the text, then indented by giving the list the class "indent" inside HTML paragraph tags, e.g.


<pre>
<pre>
{{:Test_Annotation}}</pre>
<p class="indent">
a. item a<br>
b. item b<br>
c. item c
</p>
</pre>


STEP 5. On target page (where the annotation should appear), add link to where the page appears, transcluded in [[The Annotation]]. This is done by adding a mix of HTML and MediaWiki syntax.
===References list===
In-text references, which appear at the bottom of each page (made from adding <ref> tags) have the class "references" in the CSS. In MediaWiki:Common.css this is listed as <code>ol.references</code>


<pre>
These are styled to remain typographically distinct from the main body text (smaller size and bigger line-height).


<------HTML----------><-----------MEDIAWIKI------------><HTML>
==Making & linking Parallel Texts==
          1                  2              3          4
The working method (for now) is to add Parallel Texts in the following way:
          |                  |              |          |
<p class="annotation">[[The_Annotation#Test_Annotation]]</p></pre>


This includes:
'''STEP 1.''' Create a page for the new Parallel Text<br>
'''STEP 2.''' Add content to the page<br>
'''STEP 3.''' Add the page you created to the <code>Category: Parallel Text</code><br>
'''STEP 4.''' On the targeted Floop page, add a link to the page you created, and create an <code>id</code> for it<br>
'''STEP 5.''' Back on the new Parallel Text page, add a link to the Floop page, giving the id you created in STEP 4


# Opened p tag with the class "annotation". The class determines how this text will appear on the target page where Test Annotation appears.
-----
# Within double square braces, the name of the page where all the annotations are transcluded (The Annotation)
A breakdown of the steps outlined above:
# The ID of the link to Test_Annotation, indicated by a hash (#), then the name of the annotation (Test_Annotation).
# Closed p tag


STEP 6. 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 <code>[[W._Grey_Walter_–_The_Body_in_Pieces]]</code>, the ID is preceded by a hash (#), for example <code>#Test_Annotation</code>, and the display text is the name of the chapter <code>W. Grey Walter – The Body in Pieces</code>. 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.
'''STEP 1.''' Create a page for the new Parallel Text. 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.  


<pre>
'''From the search box'''
<p class="annotation-return">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</pre>


The above syntax (a mixture of HTML and MediaWiki) breaks down as so:
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.


<pre>
'''Using the URL'''
<---------HTML--------------><-------------------------------------MEDIAWIKI-------------------------------------------><HTML>
            1                              2                          3                          4                      5
            |                              |                          |                          |                      |
<p class="annotation-return">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</p></pre>


# Opened p tag with the class "annotation-return". This class determines how the text will appear on the Test_Annotation page, which is transcluded in the page [[The Annotation]]
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:
# The name of the target page for the link
# The ID of the annotation on the target page
# Display text on the [[Test Annotation]] page (will also appear transcluded in [[The Annotation]]
# Closed p tag


==Making categories==
http://www.example.net/index.php/ARTICLE    or
https://www.mediawiki.org/wiki/Help:Categories
http://www.example.net/wiki/ARTICLE


Categories are useful ways to produce tables of content based on automatically produced indices. To do this, use the Category namespace.
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 page of that name exists yet.


Add the name of the category to the following text (where ''Name'' is the name of the category):
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.


<pre>[[Category:Name]]</pre>
'''STEP 2.''' Add content to the page.


For example, if you want to name a category "Tasks" this is how to add it:
'''STEP 3.''' Add the page you created to the <code>Category: Parallel Text</code>, by putting this at the bottom of the page:


e.g. <pre>[[Category:Tasks]]</pre>
<pre>
[[Category:Parallel Text]]</pre>


Usually this is added at the bottom of a page (in edit mode), but it can be placed anywhere and still work.
This will ensure that all annotations are automatically listed in an index when a reader visits the <code>Category: Parallel Text</code> page. Copy the name of the page, save it, and open the targeted Floop page.


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.
'''STEP 4.''' On the targeted Floop page, add a link to the page you created, and create an id for it, named after the title of the new Parallel Text page. This is done by adding a mix of HTML and MediaWiki syntax:


==Transclusion==
<pre>
[https://www.mediawiki.org/wiki/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.
<-------HTML------------------------------><----MEDIAWIKI----><HTML>
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:
          1                  2                  3            4
          |                  |                  |            |
<p class="floop-link" id="Test_Annotation">[[Test Annotation]]</p></pre>


<pre>{{source page name}}</pre>
This includes:


e.g:  <pre>{{User:Simon/A note to the reader}}</pre>
# Opened p tag given the class "floop-link". The class determines how this text will appear on the target page where Test Annotation appears.
# Within double square braces, the name of the new page you created
# A unique id for the link (this will be used to create links between the Parallel Text and Floop)
# Closed p tag


==Lists==
'''STEP 5.''' Back on the new Parallel Text page, add a link to the Floop page, specifying the id you created in STEP 4. In this example, the target page is <code>[[W._Grey_Walter_–_The_Body_in_Pieces]]</code>, the ID is preceded by a hash (#), for example <code>#Test_Annotation</code>, and the display text is the name of the chapter <code>W. Grey Walter – The Body in Pieces</code>. 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.
===Main body numbered lists===
All numbered lists in the body text are styled by targeting the <code>ol</code> HTML tag generated by MediaWiki when you use MediaWiki syntax to make automatically-numbering lists:


e.g:
<pre>
<pre>
# the first item in the list
<p class="pt-link">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</pre>
# the second item in the list
# the third item in the list
</pre>


This is rendered in the browser as
The above syntax (a mixture of HTML and MediaWiki) breaks down as so:


1. the first item in the list<br>
<pre>
2. the second item in the list<br>
<---------HTML----><-------------------------------------MEDIAWIKI-------------------------------------------><HTML>
3. the third item in the list<br>
            1                              2                          3                         4            5
            |                              |                          |                          |            |
<p class="pt-link">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</p></pre>


===References list===
# Opened p tag, given the class "pt-link". This class determines how the text will appear on the Test_Annotation page
In-text references, which appear at the bottom of each page (made from adding <ref> tags) have the class "references" in the CSS. In MediaWiki:Common.css this is listed as <code>ol.references</code>
# The name of the target page for the link
 
# The ID of the annotation on the target page
These are styled to remain typographically distinct from the main body text (smaller size and bigger line-height).
# Display text on the [[Test Annotation]] page
# Closed p tag

Latest revision as of 08:25, 29 March 2022

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 the pipe symbol (|), 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.

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, prefaced by a colon, enclosed in a pair of curly braces:

{{:source page name}}

e.g:

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

Content within User namespaces can also be transcluded even without a colon

e.g.

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

Lists

Main body numbered lists

All numbered lists in the body text are styled by targeting the ol HTML tag generated by MediaWiki when you use MediaWiki syntax to make automatically-numbering lists:

e.g:

# the first item in the list
# the second item in the list
# the third item in the list

This is rendered in the browser as

1. the first item in the list
2. the second item in the list
3. the third item in the list

An exclusion to this is in lists that appear in "A Parallel Text" (see section A Parallel Text on this cheatsheet)

Main body alphabetical lists

Lists which are ordered by alphabetical markers are not generated by MediaWiki. These should be typed into the main body of the text, then indented by giving the list the class "indent" inside HTML paragraph tags, e.g.

<p class="indent">
a. item a<br>
b. item b<br>
c. item c
</p>

References list

In-text references, which appear at the bottom of each page (made from adding <ref> tags) have the class "references" in the CSS. In MediaWiki:Common.css this is listed as ol.references

These are styled to remain typographically distinct from the main body text (smaller size and bigger line-height).

Making & linking Parallel Texts

The working method (for now) is to add Parallel Texts in the following way:

STEP 1. Create a page for the new Parallel Text
STEP 2. Add content to the page
STEP 3. Add the page you created to the Category: Parallel Text
STEP 4. On the targeted Floop page, add a link to the page you created, and create an id for it
STEP 5. Back on the new Parallel Text page, add a link to the Floop page, giving the id you created in STEP 4


A breakdown of the steps outlined above:

STEP 1. Create a page for the new Parallel Text. 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 page 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.

STEP 2. Add content to the page.

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

[[Category:Parallel Text]]

This will ensure that all annotations are automatically listed in an index when a reader visits the Category: Parallel Text page. Copy the name of the page, save it, and open the targeted Floop page.

STEP 4. On the targeted Floop page, add a link to the page you created, and create an id for it, named after the title of the new Parallel Text page. This is done by adding a mix of HTML and MediaWiki syntax:


<-------HTML------------------------------><----MEDIAWIKI----><HTML>
          1                   2                   3            4
          |                   |                   |            |
<p class="floop-link" id="Test_Annotation">[[Test Annotation]]</p>

This includes:

  1. Opened p tag given the class "floop-link". The class determines how this text will appear on the target page where Test Annotation appears.
  2. Within double square braces, the name of the new page you created
  3. A unique id for the link (this will be used to create links between the Parallel Text and Floop)
  4. Closed p tag

STEP 5. Back on the new Parallel Text page, add a link to the Floop page, specifying the id you created in STEP 4. In this example, the target page is W._Grey_Walter_–_The_Body_in_Pieces, the ID is preceded by a hash (#), for example #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="pt-link">[[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>
             1                              2                           3                          4            5
             |                              |                           |                          |            |
<p class="pt-link">[[W._Grey_Walter_–_The_Body_in_Pieces#Test_Annotation|W. Grey Walter – The Body in Pieces]]</p>
  1. Opened p tag, given the class "pt-link". This class determines how the text will appear on the Test_Annotation page
  2. The name of the target page for the link
  3. The ID of the annotation on the target page
  4. Display text on the Test Annotation page
  5. Closed p tag