A simple Emacs major mode for editing Wikibook's MediaWiki. This is optimised for https://de.wikibooks.org/wiki/Mathe_f%C3%BCr_Nicht-Freaks
Download mediawiki-mode.el
and put it somewhere you recognise. Then insert the
following into your .emacs
-file:
(load-file "Path to mediawiki-mode.el")
This adds .mw
as file ending for MediaWiki files. If you have Yasnipped
installed and furthermore want to install the Mathe für Nicht-Freaks
MediaWiki templates, add the following line after the load-file
call:
(mediawiki-mode-snippet-initialize)
MediaWiki-Mode defines the following commands:
- Insert math tags: C-c C-m. If you highlighted a region, this inserts the math-tags around the region. Otherwise this inserts the math-tags around the point. This does nothing if the point is inside a maths environment.
- Remove math tags: C-c C-r C-m. This removes the math-tags if the point is inside a maths environment.
- Insert section heading: C-c C-s. This prompts for a section level, and a heading. Then it inserts the section at the point of the point.
- Insert pair of tags: C-c m or C-c
C-<return>. This prompts for a tag to insert. This inserts an
opening and closing tag around the currently highlighted region. If the no
region is highlighted, it inserts an opening and closing tag around the
point. For example, if you want to insert an nowiki-tag this inserts
<nowiki></nowiki>
. - Insert an internal link: C-c ). This prompts for a destination and a link name. Then it inserts the link at the point's position.
- Insert an external link: C-c [. This prompts for a destination and a link name. Then it inserts the link at the point's position.
- Continue or begin an (un-)ordered list: M-RET. If the point is inside an (un-)ordered list, this inserts a new line together with the notation to continue the list in the new line. If there is no list to continue, this beins an unordered list.
- Copy to paste on wikibooks: C-c C-u. This copies the content of the entire buffer, such that you can paste it on wikibooks.
The following commands allow a change of font:
- Set font to bold: C-c C-f C-b.
- Set font to italic or emphasise text: C-c C-f C-i or C-c C-f C-e.
All font changing commands can either be applied to the region, if active, or the point. In the former case, they insert the markup for the font change around the highlighted region. In the latter, they insert it around the point.
The Mathe für Nicht-Freaks project uses a number of MediaWiki templates to
structure their articles. You can insert them using C-c C-e or by
using their key and pressing TAB. The key is the name of the
snippet prefixed with mfnf-
. The following templates are shipped with
MediaWiki-Mode:
Name | Template |
---|---|
alternativer-beweis | :Mathe für Nicht-Freaks: Vorlage:Alternativer Beweis |
anker | Anker |
aufgabe | :Mathe für Nicht-Freaks: Vorlage:Aufgabe |
beispiel | :Mathe für Nicht-Freaks: Vorlage:Beispiel |
beweis | :Mathe für Nicht-Freaks: Vorlage:Beweis |
beweisschritt | :Mathe für Nicht-Freaks: Vorlage:Beweisschritt |
definition | :Mathe für Nicht-Freaks: Vorlage:Definition |
fallunterscheidung | :Mathe für Nicht-Freaks: Vorlage:Fallunterscheidung |
formel | Formel |
frage | :Mathe für Nicht-Freaks: Vorlage:Frage |
gruppenaufgabe | :Mathe für Nicht-Freaks: Vorlage:Gruppenaufgabe |
hauptartikel | :Mathe für Nicht-Freaks: Vorlage:Hauptartikel |
hinweis | :Mathe für Nicht-Freaks: Vorlage:Hinweis |
klapptext | :Mathe für Nicht-Freaks: Vorlage:Klapptext |
lösung | :Mathe für Nicht-Freaks: Vorlage:Lösung |
lösungsweg | :Mathe für Nicht-Freaks: Vorlage:Lösungsweg |
satz | :Mathe für Nicht-Freaks: Vorlage:Satz |
todo | todo |
vollständige-induktion | :Mathe für Nicht-Freaks: Vorlage:Vollständige Induktion |
warnung | :Mathe für Nicht-Freaks: Vorlage:Warnung |
MediaWiki-Mode has the following variables for customisation:
mediawiki-tag-list
: This is a list of strings containing all tags which will be completed when inserting tags. In addition to these all tags the tag insertion history (since opening emacs) will be completed.