MediaWiki-Uploader Dokumentation: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(42 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
<span id="mediawiki-uploader"></span>
+
Download: '''git clone https://git.willux.de/EinYakAmNil/mediawiki-uploader.git'''
= 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 [[Spezial:BotPasswords|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"
+
  WIKI_URL=xxx
  BOTNAME = "xxx"
+
  BOTNAME=xxx
  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 17: Zeile 16:
  
 
<!----->
 
<!----->
 +
Ubuntu/Debian:
 +
 +
apt install python3 pandoc
 +
Arch:
 +
 +
pacman -S python3 pandoc
 
<span id="optional"></span>
 
<span id="optional"></span>
=== Optional ===
+
== Optional ==
  
 
* vim-table-mode
 
* vim-table-mode
Zeile 24: Zeile 29:
 
<!----->
 
<!----->
 
<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. These should be the first lines of the file.
  
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:
+
---
 +
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''' ''file.md''
+
  '''python3 xinux-wiki''' ''--config config_file'' ''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 54: Zeile 64:
 
** Subpoint 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
 +
#first point
 +
#second point
 +
##first subpoint
 +
##first subpoint
 
<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.
  
 
<span id="colours"></span>
 
<span id="colours"></span>
=== Colours ===
+
== Colours ==
 +
 
 +
Text can be coloured by enclosing it in a ''&lt;span style=“color:#HEXCODE”&gt;'' tag.
  
 
<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 81: Zeile 105:
 
|}
 
|}
  
<span id="template"></span>
+
<span id="troubleshooting"></span>
== Template ==
+
= Troubleshooting =
 
 
---
 
title: MediaWiki Template
 
bot: 1
 
createonly: 1
 
---
 

Aktuelle Version vom 12. Oktober 2022, 10:18 Uhr

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