# Wiki to HTML pages script
![](https://pzwiki.wdka.nl/mw-mediadesign/images/8/82/Workflow-wiki2html.svg)
## Depencencies
* python3
* [pip](https://pip.pypa.io/en/stable/installing/) Python library installed
* Install:
* `curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py`
* `python3 get-pip.py`
* [mwclient](https://mwclient.readthedocs.io/en/latest/index.html) Python library
* Install:
* `pip3 install mwclient`
* [jinja2](https://jinja.palletsprojects.com/en/2.11.x/) Python library
* Install:
* `pip3 install jinja2`
* [pandoc](https://pandoc.org/)
* Install:
* Debian/Ubuntu: `sudo apt install pandoc`
* Mac: `brew install pandoc`
## login.txt
`login.txt` is a local and individual file, ignored by git, where you place you itch wiki username and password, in separate lines.
It is used to let mwclient access the wiki, since it is close for reading and writing.
```
myusername
mypassword
```
## Run
`cd special-issue-11-wiki2html/`
Run scripts together with `./run.sh`
1 script at a time:
`python3 download_imgs.py`
* Downloads all images from wiki to `images/` directory
* and stores each image's metadata to `images.json`
`python3 publication2html.py`
* with ask API perform a query:
* default query is: `[[File:+]][[Title::+]][[Date::+]]|?Title|?Date|?Part|sort=Date,Title,Part|order=asc,asc,asc`
* custom query `python3 publication2html.py --ask '[[File:+]][[Title::+]][[Date::+]]|?Date|order=desc'`
* The results, with the same Title, are stored
* into 1 single HTML
* sorted by Part
## TODO
* Fix issue with PANDOC conversion MW -> HTML