Die alte MediaWiki Extension DumpHTML wird leider seit Jahren nicht mehr weiterentwickelt und wurde eingestellt.
Eine gute Alternative ist https://github.com/SolidCharity/exportMediaWiki2HTML. Damit lässt sich jede Wiki Seite in eine HTML Seite exportieren.
Das Python Skript bietet folgende Funktionen:
- links between the pages
- links to anchors
- links to non-existing pages
- directly embedded images
- thumbnails
- supports authentication for dumping a protected wiki
- export all (currently up to 500) pages, or export a single page
(getestet unter Debain 11 mit einem MediaWiki 1.38.4)
Installation
apt install -y git python3-venv git clone https://github.com/SolidCharity/exportMediaWiki2HTML.git cd exportMediaWiki2HTML python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
Export
einzelne Seite exportieren
$ python3 exportMediaWiki2Html.py --url http://wiki.bachmann.lan --page 54 {'pageid': 54, 'ns': 0, 'title': 'IP Adressen'} Downloading http://wiki.bachmann.lan/images/1/16/arrow-top1.png Downloading http://wiki.bachmann.lan/images/4/47/date-icon.gif --- Ergebnis --- $ tree export export ├── img │ ├── arrow-top1.png │ └── date-icon.gif ├── IP_Adressen.html └── page_not_existing.html 1 directory, 4 files
alle Seiten exportieren
$ python3 exportMediaWiki2Html.py --url http://wiki.bachmann.lan {'pageid': 2139, 'ns': 0, 'title': 'ADB Befehle'} Downloading http://wiki.bachmann.lan/images/e/e1/icon-info-box.png {'pageid': 3526, 'ns': 0, 'title': 'AUR'} Downloading http://wiki.bachmann.lan/images/1/1b/manjaro-install-google-chrome.png {'pageid': 411, 'ns': 0, 'title': 'AVM FRITZ!Box'} Downloading http://wiki.bachmann.lan/images/b/b4/avmfritzbox6360cable.jpg {'pageid': 1565, 'ns': 0, 'title': 'AVM Fritz!Box 6360 Cable Bridge Modus freischalten'} Downloading http://wiki.bachmann.lan/images/a/ab/avm-6360-bridge-modus-01.jpg Downloading http://wiki.bachmann.lan/images/7/71/avm-6360-bridge-modus-02.jpg Downloading http://wiki.bachmann.lan/images/1/1d/avm-6360-bridge-modus-03.jpg Downloading http://wiki.bachmann.lan/images/4/43/icon-error-box.png {'pageid': 2835, 'ns': 0, 'title': 'AWStats'} --- SNIP --- --- Ergebnis --- $ tree export export ├── 413_Request_Entity_Too_Large.html ├── A_B_C_D_statt_Pfeiltasten_in_lokalem_Terminal_mit_VIM.html ├── About_this_Mac_Logo_ndern.html ├── ADB_Befehle.html ├── Adobe_Acrobat_Pro_8_unter_Windws_10_x64_installieren.html ├── Alpine_Linux.html ├── Alpine_Linux_installieren.html ├── Alpine_Linux_Package_Management_apk_.html ├── Android.html ├── Antergos_LightDM_Themes.html ├── Apache_File_Listing_mit_eigenem_Theme.html ├── Apache.html ├── Apache_mit_SSL.html ├── Apache_Passwortschutz_mit_htaccess.html ├── Apple.html ├── AUR.html ├── Auslieferungszustand_wiederherstellen.html ├── AVM_Fritz_Box_6360_Cable_Bridge_Modus_freischalten.html ├── AVM_FRITZ_Box.html ├── AWStats.html --- SNIP --- 1 directory, 1706 files
Die pageid einer Wiki Seite kann über die API, oder bei der aufgerufenen Seite links auf Seiteninformationen ermittelt werden.
Für die HTML Ausgabe kommt es darauf an wie Bilder in die Artikel eingebettet wurden.
z.B. Bilder mit <gallery>
z.B. Bilder mit File:
Verzeichnisindex erstellen
Mit tree erstelle ich mir noch eine index.html aller einzelnen HTML Dateien. (im export Verzeichnis ausführen)
tree -H '.' -T "wiki.bachmann.lan" -L 1 --noreport --charset utf-8 -o index.html
Damit lässt es sich besser navigieren.