Nils
5 years ago
3 changed files with 53 additions and 2 deletions
@ -0,0 +1,42 @@ |
|||
#! /usr/bin/env python3 |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
""" |
|||
This file is called by generate.bash and will put out part of our website. |
|||
It pulls the info directly from the projects metada dict. Therefore we need this to be a python |
|||
script. |
|||
|
|||
The projects themselves are oblivious to any html website format and style. We can change the website |
|||
at any time as long as the data structures stay the same. |
|||
|
|||
Output is to stdout, we rely on bash piping in generate.bash to write a file. |
|||
|
|||
We expect a directory "temp" on our level with each project as lowercase name: |
|||
temp/fluajho |
|||
temp/patroneo |
|||
etc. |
|||
|
|||
The image file is a static file. At this point in time manually copied into the static/ dir |
|||
|
|||
""" |
|||
|
|||
import sys |
|||
|
|||
projects = sys.argv[1:] #exclude our own filename |
|||
assert projects |
|||
|
|||
oneliners = "" |
|||
for project in projects: |
|||
config = __import__(f"temp.{project}.engine.config", fromlist=["METADATA"]) |
|||
META = config.METADATA |
|||
assert META["shortName"] == project, (META["shortName"], project) |
|||
oneliners = oneliners + f"\n<li><a href=\"/{META['shortName']}/\">{META['name']}</a>: {META['tagline']}</li>" |
|||
|
|||
|
|||
with open("directcontent/index", "r") as f: |
|||
template = f.read() |
|||
template = template.replace("PYREPLACE_ONELINERS", oneliners) |
|||
|
|||
|
|||
print (template) #stdout. our job is done |
|||
|
Loading…
Reference in new issue