Browse Source

add one liners as overview to index

master
Nils 4 years ago
parent
commit
d5223e525f
  1. 7
      directcontent/index
  2. 6
      generate.bash
  3. 42
      index2dataindex.py

7
directcontent/index

@ -13,7 +13,12 @@
The programs have very different target groups. For example: while Laborejo itself is made for
advanced composers with classical background Patroneo is made specificially for beginners who
only know the very basics about music.
</p>
</p>
<p><h2 class="content-subhead">Overview</h2></p>
<ul> <!-- List of one liners from their config.py -->PYREPLACE_ONELINERS
</ul>
<p><h2 class="content-subhead">Help and Support</h2></p>
<p>Every program has a comprehensive user manual in multiple languages.</p>

6
generate.bash

@ -16,6 +16,8 @@ cd temp
#Instead of doing one project fully at a time, creating one giant nested loop.
#Administration first, the processing!
PROJECTS=(laborejo patroneo vico fluajho argodejo) #The order here is the order on the page. Each of these gets its own entry.
PROJECTS_AS_STRING=$( IFS=$' '; echo "${PROJECTS[*]}" )
#Gather and update data
for PROJECT in ${PROJECTS[*]} template
@ -86,8 +88,10 @@ do
TITLE=$(echo "$EACH" | sed 's/[^ ]\+/\L\u&/g')
echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/$EACH/'>$TITLE</a></li>" >> "temp/index_menu" #automatic newline
done
#Home-Content
cat "modules/10head" "temp/index_menu" "modules/20aftermenu" "directcontent/index" "modules/90foot" > "out/index.html"
./index2dataindex.py $PROJECTS_AS_STRING > temp/index
cat "modules/10head" "temp/index_menu" "modules/20aftermenu" "temp/index" "modules/90foot" > "out/index.html"
#Check if we have an HTML dir, then deploy
cd "$ROOTPATH" #reset for next step

42
index2dataindex.py

@ -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…
Cancel
Save