diff --git a/voussoir.net/photography/generate_site.py b/voussoir.net/photography/generate_site.py index 0dcd03e..62f686c 100644 --- a/voussoir.net/photography/generate_site.py +++ b/voussoir.net/photography/generate_site.py @@ -1,5 +1,6 @@ -import PIL.Image import jinja2 +import PIL.Image +import sys from voussoirkit import dotdict from voussoirkit import imagetools @@ -9,6 +10,7 @@ from voussoirkit import spinal PHOTOGRAPHY_ROOTDIR = pathclass.Path(__file__).parent DOMAIN_ROOTDIR = PHOTOGRAPHY_ROOTDIR.parent CSS_CONTENT = PHOTOGRAPHY_ROOTDIR.with_child('dark.css').read('r', encoding='utf-8') +DOMAIN_WEBROOT = ('file:///' + DOMAIN_ROOTDIR.absolute_path) if '--test' in sys.argv else 'https://voussoir.net' class Photo: def __init__(self, filepath): @@ -23,17 +25,17 @@ class Photo: thumb = self.thumbnail.relative_to(DOMAIN_ROOTDIR, simple=True).replace('\\', '/') return f'''
- +
''' def render_atom(self): - href = f'https://voussoir.net/photography{self.anchor}' - imgsrc = 'https://voussoir.net/' + self.thumbnail.relative_to(DOMAIN_ROOTDIR, simple=True) + href = f'{DOMAIN_WEBROOT}/photography{self.anchor}' + imgsrc = f'{DOMAIN_WEBROOT}/' + self.thumbnail.relative_to(DOMAIN_ROOTDIR, simple=True) return f''' {self.article_id} {self.article_id} - + {self.published.isoformat()} '.replace('\\', '/') photos.append(line) photos = '\n'.join(photos) @@ -98,7 +100,7 @@ class Album: return f''' {self.article_id} {self.article_id} - + {self.published.isoformat()} voussoir.net/photography - + voussoir.net/photography {% for item in items %}