diff --git a/README.md b/README.md index 3fa6139..4ca764d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Wiki to HTML pages script +![](https://pzwiki.wdka.nl/mw-mediadesign/images/8/82/Workflow-wiki2html.svg) ## Depencencies * python3 -* [pip]() Python library installed +* [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` @@ -20,7 +21,7 @@ ## login.txt -`login.txt` is a secrete file (ignored by git) where you place you itch wiki username and password, in separate lines. +`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. ``` @@ -30,7 +31,13 @@ mypassword ## Run -* all toguether `./run.sh` + +`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 @@ -38,19 +45,13 @@ mypassword `python3 publication2html.py` * with ask API perform a query: - * default `[[File:+]][[Title::+]][[Date::+]]|?Title|?Date|?Part|sort=Date,Title,Part|order=asc,asc,asc` + * 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 -OR -`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! \ No newline at end of file +## TODO +* Fix issue with PANDOC conversion MW -> HTML \ No newline at end of file diff --git a/run.sh b/run.sh index 3c76d2c..bd4c610 100755 --- a/run.sh +++ b/run.sh @@ -1,3 +1,3 @@ #!/bin/sh python3 download_imgs.py -python3 images2html.py +python3 publication2html.py diff --git a/sandbox/ask_wiki.py b/sandbox/ask_wiki.py index bd69a8d..2457da3 100644 --- a/sandbox/ask_wiki.py +++ b/sandbox/ask_wiki.py @@ -3,6 +3,16 @@ import os from mwclient import Site from datetime import datetime from pprint import pprint +from argparse import ArgumentParser + +p = ArgumentParser() +#p.add_argument("--host", metavar='', default="hub.xpub.nl") +#p.add_argument("--path", metavar='', default="/itchwiki/", help="Wiki path. Should end with /") +p.add_argument("--ask", "-a", metavar='', default="[[File:+]][[Title::+]][[Date::+]]|?Title|?Date|?Part|sort=Date,Title,Part|order=asc,asc,asc", help="Ask query to be sent to the wiki API.") + +args = p.parse_args() +print args + site = Site(host='hub.xpub.nl/sandbox', path='/itchwiki/') @@ -13,8 +23,9 @@ with open(os.path.join(wd, 'login.txt'), 'r') as login: # read login user & pwd user, pwd = loginlines.split('\n') site.login(username=user, password=pwd) # login to wiki +# TODO: move query onto argument -query = ('[[File:+]][[Title::+]][[Date::+]]|?Title|?Date|?Part|sort=Date,Title,Part|order=asc,asc,asc') +query = args.ask print('Query:', query) # examples: