Help:Tools and tricks to write with Mediawiki
Contents
Of course you are advised to use the tool bar just above the window in Edit mode, and to dig into the various user's manuals. But some codes are not easy to find or to remember. They will be found here. Consult also the Mediawiki help page about formatting.
Text formatting
- To align a text at the center:
<center>your text</center>
- To align a text to the right:
{{right|Michel Chauvet}}
The following syntax doesn't work :
<right>your text</right>
- To indent a text both to the left and to the right (for a quote) : <blockquote>text</blockquote>
- If you want to force a line break, simply type <br>. This is the case when you want the authors' names in the taxobox to be down the scientific name.
- To put a text in small capitals :
{{smallcaps|Text}} will give Text
- To write a text which shall not be interpreted with the wiki syntax:
<nowiki> your text </nowiki>
- To include a text in Edit mode, that you don't want to see in the Read version :
<!-- Note : This text is a comment that will not appear -->
You can change the color and the size. 3 is big, 2 is medium, and 1 is small.
<font color=red size=3>text</font> will give text
<font color=green size=2>text</font> will give text
<font color=blue size=1>text</font> will give text
I ignore why 1 is not the size of ordinary text.
Another syntax says size=60%. I don't know how it works.
Page formatting
A long list can be put in several columns. See an example with three columns:
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3"> *apple *carpet *geography *mountain *nowhere *postage *ragged *toast </div>
gives :
- apple
- carpet
- geography
- mountain
- nowhere
- postage
- ragged
- toast
Categories
- To insert a page into categories:
[[Category:First category name]]
[[Category:Second category name]]
- If you want your page to be put in an alphabetical place other than the initials of its title:
[[Category:Category name|Sort key]]
For example: [[Category:Pulse|Bean, bush]] (If the page name is Bush bean.)
- If your page is an introductory page, you may want it to come at the beginning of the list. Then type: [[Category:Category name|*]]
Templates
- To insert a template:
No parameter:
{{TemplateName}}
One parameter:
{{TemplateName|ParameterValue}}
Several parameters: {{TemplateName |parameter1name= |parameter2name= }}
In that case, parameters can be written in any order, but it is less confusing when you put them in the right order and at different lines.
Pages with templates
Complex templates are difficult to use. To make the work easier, we chosed to associate a page template with an example page (called "New..."), which already contains the link to the template with the names of parameters to be documented, and additional common features not included in the template. You can then simply copy and paste the example page in order to create a new page.
- To create a genus page, paste the following page: New genus seed plant
- To create a family page, paste the following page: New family seed plant
- To create a species page, paste the following page New species seed plant and delete any necessary text (after :).
Additional example pages for other cases will be created in time.
Links
The format for an internal link to the same linguistic version is :
[[Page title|Link label]].
But if you want to create a link to another linguistic version (e.g. French), you must write:
[[:fr:Page title|Link label]]
If you forget the first :, the link will only appear in the left bar, under other languages. This is particularly relevant for published texts, which will appear only in the French version if their language is French, and in the English version otherwise.
A link to a particular section of a page is written in such a way:
[[page name#section name|displayed text]]
Table of contents
A table of contents (TOC) is created automatically as soon as a page contains at least four sections. It is placed just before the title of the first section.
If you wish to have no table of contents, only type __NOTOC__ anywhere (preferably at the beginning).
If you wish to display the table of contents in all the cases, type __FORCETOC__.
If you wish to display the table of contents at a precise place (e.g. before the beginning of the introductory text), you must type __TOC__ et the precise place where you want to have the TOC displayed.
NB. __ represents two underscores.
To display a simple bar with all the alphabet letters: {{CompactTOC}}.
To display a double bar with all the alphabet letters plus a more detailed scrolling menu (allowing to manage lists of several thousands of items) : {{LargeCategoryTOC}}.
Other elements
Elements of syntax that you may wish to copy in a word processor for daily use
- vertical bar: |
If you want to sign your texts (in particular on discussion pages), three consecutive tildes (Michel Chauvet) will insert your name with a link to your user page. Four (Michel Chauvet 17:22, 9 July 2012 (CEST)) will insert that link and the save time and date. Five (17:22, 9 July 2012 (CEST)) insert just the time and date.
Tricks
If you have long lists to format, it is very boring to do it manually.
When copying a list form a website, it often comes with various formats and hyperlinks. Bold and italics are easily removed in bulk, and will anyway not be recognized by Mediawiki. But with Microsoft Word, hyperlinks remain, and have to be removed one by one. The best solution is to use the option "special pasting", and chose "non-formatted text".
If you now want to obtain in the wiki something like:
you have to type: *''[[Zea mays]]''
You can do it automatically in Word. If names are separated by a paragraph end mark, you select all the list, and you ask Word to replace the paragraph end mark by ]]''paragraph end mark''*[[.
Now the silly result (at least with my version of Word) is that the normal apostrophes are systematically replaced by left and right simple quotation marks. I have been unable to desactivate this change. But I found a solution:
Save the file under Textedit (or any word processor which offers this facility), and use "find and replace". With Textedit, you can insert from a table the right characters.
Of course, this trick is useful only if you have a list of more than ten items!
Macros can probably be developed, but I don't know how.
List truncation
Example: I want a simple list of species names without author names.
The first step is to eliminate double spaces, by asking Word to replace all double spaces by only one, and repeating the action until 0 replacement is reached. Also check that all species names are composed of only two words (presence of a hyphen in composed epithets, hybrid mark attached to the epithet...).
You then select the list and ask Word to format it in a table (columns separated by a space, lines separated by a paragraph mark). It is then easy to suppress all the columns apart from the first and second one.