From 2cfa36b9d9aafd4bf7c1accaca91c42d6aa3e359 Mon Sep 17 00:00:00 2001 From: Castro0o Date: Thu, 16 Apr 2020 16:21:31 +0200 Subject: [PATCH 1/2] dumpwiki.py copy ./static to ../archive/static and points to it on templates --- dumpwiki.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dumpwiki.py b/dumpwiki.py index 7a37930..9fed667 100644 --- a/dumpwiki.py +++ b/dumpwiki.py @@ -1,6 +1,7 @@ import os, json, sys from mwclient import Site from jinja2 import Template +from shutil import copy import html5lib from functions import Colors import argparse @@ -29,6 +30,16 @@ print(args) site = Site(host=args.host, path=args.path) wd = os.path.dirname(os.path.abspath(__file__)) # working directory wd_name = os.path.split(wd)[-1] # name of dir running script + +# copy static/ to ../archive/static +repo_static_path = './static' +archive_static_path = os.path.join(args.output, repo_static_path) +os.makedirs(archive_static_path, exist_ok=True) # create static/ dir in archive +for static_file in os.listdir(path='./static'): + copy(src=os.path.join(repo_static_path, static_file), + dst=os.path.join(archive_static_path, static_file)) + + with open('login.txt', 'r') as login: # read login user & pwd loginlines = login.read() user, pwd = loginlines.split('\n') @@ -116,8 +127,7 @@ def dumppage(p, template, rewrite_images=True): htmlsrc = rewritelinks(htmlsrc) if rewrite_images: htmlsrc = rewriteimgs(htmlsrc) - # TODO: ANdre structure of archive: from ./archive/0 to: ./archive ./0 - html = template.render(page=p, body=htmlsrc, staticpath=f'../{wd_name}') + html = template.render(page=p, body=htmlsrc, staticpath='.') with open(os.path.join(args.output, filenameforpage(p)), 'w') as f: f.write(html) # print(html, file=f) @@ -132,7 +142,7 @@ for cat in publish.members(): template = Template(templatefile.read()) except FileNotFoundError: with open('templates/default.html') as templatefile: - template = Template(templatefile.read()) + template = Template(templatefile.read()) for p in cat.members(): print(p) dumppage(p, template, rewrite_images=not args.skipimages) @@ -141,7 +151,7 @@ for cat in publish.members(): else: print("Dumping page {}".format(cat.page_title)) with open('templates/default.html') as templatefile: - template = Template(templatefile.read()) + template = Template(templatefile.read()) dumppage(cat, template, rewrite_images=not args.skipimages) From 5d797dc1ac0e17d8fc560298e72a980fcbec91bc Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 16 Apr 2020 18:39:37 +0200 Subject: [PATCH 2/2] about page --- static/about.css | 23 +++++++++++++++++------ templates/about.html | 1 + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/static/about.css b/static/about.css index 5aa3c22..f52b1d4 100644 --- a/static/about.css +++ b/static/about.css @@ -1,26 +1,33 @@ body { background-color: #F4EBE8; - + font-family: Roboto Mono; } .projtextcont{ - display: block; +display: block; /*align-items: center; justify-content: center*/ + color:#371F10; margin-left:200px; - font-family: Roboto Mono; + } .projtext{ - width: 50%; - height: 50%; + width: 85%; display: block; } h1{ display: block; + width:50%; +} + +h2{ + display: block; + width:70%; + text-align: justify; } .pagelink{ @@ -59,4 +66,8 @@ h1{ font-size: 13px; background-color: white; visibility: hidden; -}s \ No newline at end of file +} + +.pagelink:hover .pagename{ + visibility: visible; +} \ No newline at end of file diff --git a/templates/about.html b/templates/about.html index 1d22e9d..50f692c 100644 --- a/templates/about.html +++ b/templates/about.html @@ -2,6 +2,7 @@ +