MediaWiki-Uploader Dokumentation

Aus xinux.net
Zur Navigation springen Zur Suche springen

Download: git clone https://git.willux.de/EinYakAmNil/mediawiki-uploader.git

Requires a bot with sufficient rights to edit and create pages. The bot credentials default into “$XDG_CONFIG_HOME/xinux-wiki.config”, but can be customised by adding the –config flag.

WIKI_URL=xxx
BOTNAME=xxx
BOTPW=xxx

Requirements

Essential

  • Python 3 (Tested with standard library of Python 3.10)
  • Pandoc (Markdown to MediaWiki conversion)

Ubuntu/Debian:

apt install python3 pandoc

Arch:

pacman -S python3 pandoc

Optional

  • vim-table-mode

Usage

Create a Markdown file with the contents for the desired wiki page. Only mandatory metadata is the title of the page to be created or edited. These should be the first lines of the file.

---
title: MediaWiki-Uploader Dokumentation
---

Additional metadata can be used to influence the bot behaviour, like not creating new pages or not editing existing pages. Headers, lists, text or any other type of block should be separated by a newline. To upload execute:

python3 xinux-wiki --config config_file file.md

Examples

Lists

Lists can be created with either -, + at the beginning of the line separated from the point by a space. The level of the list is determined by the indent.

Writing this:

+ Point 1
+ Point 2
    + Subpoint 1
    + Subpoint 2
+ Point 3
    + Subpoint 3

yields:

  • Point 1
  • Point 2
    • Subpoint 1
    • Subpoint 2
  • Point 3
    • Subpoint 3

Numbered lists can be done by not leaving a space between your text and #:

#first point
#second point
##first subpoint
##first subpoint
  1. first point
  2. second point
    1. first subpoint
    2. first subpoint

Code blocks

You can have areas of code by indenting the desired text with tab or enclosing it with <pre> tags.

Colours

Text can be coloured by enclosing it in a <span style=“color:#HEXCODE”> tag.

Tables

Tables in Markdown are much more intuitive than in MediaWiki format. If you are using Vim, then installing the vim-table-mode extension will help you generate tables which keep good formatting. Therefore writing this:

| **Header 1** | **Header 2** |
|--------------+--------------|
| column 1     | column2      |
| row 3        | value 6      |

Should yield this:

Header 1 Header 2
column 1 column2
row 3 value 6

Troubleshooting