MediaWiki-Uploader Dokumentation: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
<span id="mediawiki-uploader"></span>
 
= MediaWiki-Uploader =
 
 
 
Requires a bot with sufficient rights to edit and create pages. The bot credentials have to be written into the upload script.
 
Requires a bot with sufficient rights to edit and create pages. The bot credentials have to be written into the upload script.
  
Zeile 8: Zeile 5:
 
  BOTPW = "xxx"
 
  BOTPW = "xxx"
 
<span id="requirements"></span>
 
<span id="requirements"></span>
== Requirements ==
+
= Requirements =
  
 
<span id="essential"></span>
 
<span id="essential"></span>
=== Essential ===
+
== Essential ==
  
 
* Python 3 (Tested with standard library of Python 3.10)
 
* Python 3 (Tested with standard library of Python 3.10)
Zeile 18: Zeile 15:
 
<!----->
 
<!----->
 
<span id="optional"></span>
 
<span id="optional"></span>
=== Optional ===
+
== Optional ==
  
 
* vim-table-mode
 
* vim-table-mode
Zeile 24: Zeile 21:
 
<!----->
 
<!----->
 
<span id="usage"></span>
 
<span id="usage"></span>
== Usage ==
+
= 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. 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:
 
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. 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:
Zeile 30: Zeile 27:
 
  '''python3 xinux-wiki''' ''file.md''
 
  '''python3 xinux-wiki''' ''file.md''
 
<span id="examples"></span>
 
<span id="examples"></span>
== Examples ==
+
= Examples =
  
 
<span id="lists"></span>
 
<span id="lists"></span>
=== Lists ===
+
== 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.
 
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.
Zeile 55: Zeile 52:
  
 
<span id="code-blocks"></span>
 
<span id="code-blocks"></span>
=== Code blocks ===
+
== Code blocks ==
  
 
You can have areas of code by indenting the desired text with tab or enclosing it with ''&lt;pre&gt;'' tags.
 
You can have areas of code by indenting the desired text with tab or enclosing it with ''&lt;pre&gt;'' tags.
  
 
<span id="colours"></span>
 
<span id="colours"></span>
=== Colours ===
+
== Colours ==
  
 
<span id="tables"></span>
 
<span id="tables"></span>
=== Tables ===
+
== Tables ==
  
 
Tables in Markdown are much more intuitive than in MediaWiki format. If you are using Vim, then installing the [https://github.com/dhruvasagar/vim-table-mode vim-table-mode] extension will help you generate tables which keep good formatting. Therefore writing this:
 
Tables in Markdown are much more intuitive than in MediaWiki format. If you are using Vim, then installing the [https://github.com/dhruvasagar/vim-table-mode vim-table-mode] extension will help you generate tables which keep good formatting. Therefore writing this:
Zeile 84: Zeile 81:
  
 
<span id="template"></span>
 
<span id="template"></span>
== Template ==
+
= Template =
  
 
  ---
 
  ---

Version vom 14. September 2022, 10:07 Uhr

Requires a bot with sufficient rights to edit and create pages. The bot credentials have to be written into the upload script.

WIKI_URL = "xxx"
BOTNAME = "xxx"
BOTPW = "xxx"

Requirements

Essential

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

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. 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 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

Code blocks

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

Colours

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

Template

---
title: MediaWiki Template
bot: 1
createonly: 1
---

Troubleshooting