|
|
|
# Wiki to HTML pages script
|
|
|
|
|
|
|
|
## Depencencies
|
|
|
|
* python3
|
|
|
|
* [pip]() 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 secrete 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
|
|
|
|
* all toguether `./run.sh`
|
|
|
|
|
|
|
|
* `python3 download_imgs.py`
|
|
|
|
* Downloads all images from wiki to `images/` directory
|
|
|
|
* and stores each image's metadata to `images.json`
|
|
|
|
* `python3 images2html.py`
|
|
|
|
* cycles through the items in `images.json`
|
|
|
|
* querying the File: wiki for image
|
|
|
|
* if it contains essential metadata: Title, Page, Total Pages
|
|
|
|
* retrieves its text content
|
|
|
|
* generates a HTML page from it
|
|
|
|
* saves page onto `static_html/` directory
|
|
|
|
|
|
|
|
## TODO: Work on making an overview!
|