From b59d8bae0e3cf65d256170581b08fc012d22ada3 Mon Sep 17 00:00:00 2001 From: Castro0o Date: Thu, 2 Apr 2020 11:17:42 +0200 Subject: [PATCH] added var staticpath to templates to allow JS/CSS files to be reached with running on --local or archive --- README.md | 1 + dumpwiki.py | 8 ++++++-- static/archive.css | 8 ++++++++ templates/default.html | 4 ++-- templates/format.html | 8 ++++---- templates/title.html | 8 ++++---- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ac971df..d246797 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ there should be an HTML [jinja2 template](https://jinja.palletsprojects.com/en/2 If not the `templates/default.html` will be used to render the pages under that Category. +**CSS/JS files** are stored in `static/`. See `templates/default.html` to see how it links to `static/archive.css` --- diff --git a/dumpwiki.py b/dumpwiki.py index 2e83c53..a3dc706 100644 --- a/dumpwiki.py +++ b/dumpwiki.py @@ -19,7 +19,7 @@ p.add_argument("--one", default=False, action="store_true", help="Output one pag p.add_argument("--local", default=False, action="store_true", help="When creating a local archives. Add full URL to images") args = p.parse_args() - +print(args) # site and login site = Site(host=args.host, path=args.path) @@ -83,7 +83,11 @@ for cat in publish.members(): print(p) htmlsrc = site.parse(page=p.name)['text']['*'] htmlsrc = rewritelinks(htmlsrc) - html = template.render(page=p, body=htmlsrc) + if args.local is True: + html = template.render(page=p, body=htmlsrc, staticpath='..') + else: + html = template.render(page=p, body=htmlsrc, staticpath='0') + with open(os.path.join(args.output, filenameforpage(p)), 'w') as f: print(html, file=f) if args.one: diff --git a/static/archive.css b/static/archive.css index e69de29..6e681c2 100644 --- a/static/archive.css +++ b/static/archive.css @@ -0,0 +1,8 @@ +body { + background-color: #aaa4a0; +} + +a, a:visited{ + color:black; + text-decoration: underline; +} \ No newline at end of file diff --git a/templates/default.html b/templates/default.html index e6c9cbf..a542842 100644 --- a/templates/default.html +++ b/templates/default.html @@ -2,8 +2,8 @@ - - + + {{ page.name }} diff --git a/templates/format.html b/templates/format.html index cbc09cb..77df8b6 100644 --- a/templates/format.html +++ b/templates/format.html @@ -2,10 +2,10 @@ - - - - + + + + {{ page.name }} diff --git a/templates/title.html b/templates/title.html index cbc09cb..18af81f 100644 --- a/templates/title.html +++ b/templates/title.html @@ -2,10 +2,10 @@ - - - - + + + + {{ page.name }}