An assortment of scripts and programs that pulls in info from our repositories and puts out a website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines

  1. #! /usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. This file is called by generate.bash and will put out part of our website.
  5. It pulls the info directly from the projects metada dict. Therefore we need this to be a python
  6. script.
  7. The projects themselves are oblivious to any html website format and style. We can change the website
  8. at any time as long as the data structures stay the same.
  9. Output is to stdout, we rely on bash piping in generate.bash to write a file.
  10. We expect a directory "temp" on our level with each project as lowercase name:
  11. temp/fluajho
  12. temp/patroneo
  13. etc.
  14. The image file is a static file. At this point in time manually copied into the static/ dir
  15. """
  16. import sys
  17. import datetime
  18. today_str = str(
  19. projects = sys.argv[1:] #exclude our own filename
  20. assert projects
  21. oneliners = ""
  22. for project in projects:
  23. config = __import__(f"temp.{project}.engine.config", fromlist=["METADATA"])
  24. META = config.METADATA
  25. assert META["shortName"] == project, (META["shortName"], project)
  26. oneliners = oneliners + f"\n<li><a href=\"/{META['shortName']}/\">{META['name']}</a>: {META['tagline']}</li>"
  27. with open("directcontent/index", "r") as f:
  28. template =
  29. template = template.replace("PYREPLACE_ONELINERS", oneliners)
  30. template = template.replace("PYREPLACE_DATE", today_str)
  31. print (template) #stdout. our job is done