Update with loading field files
This commit is contained in:
parent
e11a484290
commit
467727392a
4 changed files with 36 additions and 82 deletions
|
@ -15,6 +15,7 @@ import itertools
|
||||||
import yaml
|
import yaml
|
||||||
import textwrap
|
import textwrap
|
||||||
import string
|
import string
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class MarkdownGenerator:
|
class MarkdownGenerator:
|
||||||
|
@ -39,6 +40,9 @@ class MarkdownGenerator:
|
||||||
|
|
||||||
for k,v in ti:
|
for k,v in ti:
|
||||||
|
|
||||||
|
if v == None:
|
||||||
|
v = ''
|
||||||
|
|
||||||
h = textwrap.wrap(k, h_len, break_long_words=False)
|
h = textwrap.wrap(k, h_len, break_long_words=False)
|
||||||
wrapper = textwrap.TextWrapper(d_len)
|
wrapper = textwrap.TextWrapper(d_len)
|
||||||
t = [wrapper.wrap(i) for i in v.split('\n') if i != '']
|
t = [wrapper.wrap(i) for i in v.split('\n') if i != '']
|
||||||
|
@ -147,18 +151,26 @@ def main():
|
||||||
# get arguments
|
# get arguments
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
# only run debug
|
# only run debug
|
||||||
if args.schema and args.meta:
|
if args.schema and args.meta and len(args.fields) > 0:
|
||||||
|
|
||||||
cb = CourseBuilder()
|
cb = CourseBuilder()
|
||||||
|
|
||||||
|
actual_fields = []
|
||||||
|
|
||||||
|
if os.path.isfile(args.fields[0]):
|
||||||
|
with open(args.fields[0]) as ff:
|
||||||
|
actual_fields = yaml.load(ff,Loader=yaml.Loader)['fields']
|
||||||
|
else:
|
||||||
|
actual_fields = args.fields
|
||||||
|
|
||||||
|
|
||||||
with open(args.schema) as f:
|
with open(args.schema) as f:
|
||||||
cb.set_schema(yaml.load(f,Loader=yaml.Loader))
|
cb.set_schema(yaml.load(f,Loader=yaml.Loader))
|
||||||
|
|
||||||
for m in args.meta:
|
for m in args.meta:
|
||||||
with open(m) as fm:
|
with open(m) as fm:
|
||||||
cb.process(yaml.load(fm,Loader=yaml.Loader),fields=args.fields,lang=args.lang,pagebreak=args.pagebreak)
|
cb.process(yaml.load(fm,Loader=yaml.Loader),fields=actual_fields,lang=args.lang,pagebreak=args.pagebreak)
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
table.pdf:
|
table.en.pdf:
|
||||||
@echo "creating english version ..."
|
@echo "creating English version ..."
|
||||||
python ../../coursebuilder -s schema.yaml -m mod.cg.yaml -l en -f name id | pandoc -o table.pdf
|
python ../../coursebuilder -s schema.yaml -m mod.cg.yaml -l en -f fields.yaml | pandoc --template pandoc-template/eisvogel.latex -o table.en.pdf
|
||||||
|
|
||||||
all: table.pdf
|
table.de.pdf:
|
||||||
|
@echo "creating German version ..."
|
||||||
|
python ../../coursebuilder -s schema.yaml -m mod.cg.yaml -l de -f fields.yaml | pandoc --template pandoc-template/eisvogel.latex -o table.de.pdf
|
||||||
|
|
||||||
|
all: table.en.pdf table.de.pdf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm table.pdf
|
rm table.en.pdf table.de.pdf
|
|
@ -1,5 +1,7 @@
|
||||||
name:
|
name:
|
||||||
value: Computer Graphics
|
de: Computergrafik
|
||||||
|
en: Computer Graphics
|
||||||
|
|
||||||
|
|
||||||
id:
|
id:
|
||||||
value: CG
|
value: CG
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#
|
#
|
||||||
name:
|
name:
|
||||||
type: str
|
type: str
|
||||||
translatable: false
|
|
||||||
label: {
|
label: {
|
||||||
de: "Modulname",
|
de: "Modulname",
|
||||||
en: "name of course"
|
en: "name of course"
|
||||||
|
@ -186,12 +185,12 @@ form-of-exam:
|
||||||
term:
|
term:
|
||||||
label: {
|
label: {
|
||||||
de: "Semester",
|
de: "Semester",
|
||||||
en: "Term"
|
en: "term"
|
||||||
}
|
}
|
||||||
type: int
|
type: int
|
||||||
template:
|
template:
|
||||||
de: "$value$. Semester"
|
de: " ${value}. Semester"
|
||||||
en: "$value$ semester"
|
en: " ${value}. semester"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Häufigkeit des Angebots
|
# Häufigkeit des Angebots
|
||||||
|
@ -199,7 +198,7 @@ term:
|
||||||
frequency:
|
frequency:
|
||||||
label: {
|
label: {
|
||||||
de: "Häufigkeit des Angebots",
|
de: "Häufigkeit des Angebots",
|
||||||
en: "Frequency of Offer"
|
en: "frequency of Offer"
|
||||||
}
|
}
|
||||||
type: "enum"
|
type: "enum"
|
||||||
values: {
|
values: {
|
||||||
|
@ -215,6 +214,9 @@ frequency:
|
||||||
|
|
||||||
duration:
|
duration:
|
||||||
type: int
|
type: int
|
||||||
|
label:
|
||||||
|
de: Dauer
|
||||||
|
en: duration
|
||||||
template:
|
template:
|
||||||
de: "$value Semester"
|
de: "$value Semester"
|
||||||
en: "$value term(s)"
|
en: "$value term(s)"
|
||||||
|
@ -240,71 +242,5 @@ remarks:
|
||||||
type: str
|
type: str
|
||||||
label: {
|
label: {
|
||||||
de: "Bemerkungen",
|
de: "Bemerkungen",
|
||||||
en: "Remarks"
|
en: "remarks"
|
||||||
}
|
}
|
||||||
|
|
||||||
# test:
|
|
||||||
# label: { de: "Name", en: "A Test" }
|
|
||||||
# type: enum
|
|
||||||
# values: {
|
|
||||||
# 'brand' : { de: "Marke", en: "Brand" },
|
|
||||||
# 'new' : { de: "Neu", en: "New" }
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
# # German
|
|
||||||
# de:
|
|
||||||
# name: Modulname
|
|
||||||
# id: Kürzel
|
|
||||||
# instructor: Modulverantwortlicher
|
|
||||||
# goal: Qualifikationsziele
|
|
||||||
# content: Modulinhalte
|
|
||||||
# form: Lehrformen
|
|
||||||
# prerequisites: Voraussetzungen für die Teilnahme
|
|
||||||
# media-of-instruction: Literatur/ multimediale Lehr- und Lernprogramme
|
|
||||||
# author-of-indenture: Lehrbriefautor
|
|
||||||
# used-in: Verwendbarkeit
|
|
||||||
# workload: Arbeitsaufwand/ Gesamtworkload
|
|
||||||
# credits: ECTS und Gewichtung der Note in der Gesamtnote
|
|
||||||
# form-of-exam: Leistungsnachweis
|
|
||||||
# term: Semester
|
|
||||||
# frequency: Häufigkeit des Angebots
|
|
||||||
# duration: Dauer
|
|
||||||
# kind: Art der Veranstaltung (Pflicht, Wahl, etc.)
|
|
||||||
# remarks: Bemerkungen
|
|
||||||
|
|
||||||
# # English
|
|
||||||
# en:
|
|
||||||
# name: Coursename
|
|
||||||
# id: Code
|
|
||||||
# instructor: Instructor
|
|
||||||
# goal: Goals of Qualification
|
|
||||||
# content: Content and Topics
|
|
||||||
# form: Form of Instruction
|
|
||||||
# prerequisites: Prerequisites
|
|
||||||
# media-of-instruction: Media of Instruction
|
|
||||||
# author-of-indenture: Author of Indenture
|
|
||||||
# used-in: Viable for Course
|
|
||||||
# workload: Workload
|
|
||||||
# credits: Credits and Weight of Mark
|
|
||||||
# form-of-exam: Form of Examination
|
|
||||||
# term: Term
|
|
||||||
# frequency: Frequency
|
|
||||||
# duration: Duration
|
|
||||||
# kind: Compulsory / Elective
|
|
||||||
# remarks: Remarks
|
|
||||||
|
|
||||||
# # validators for enum-fields
|
|
||||||
# enums:
|
|
||||||
# form:
|
|
||||||
# - lecture
|
|
||||||
# - seminar
|
|
||||||
# - project
|
|
||||||
# form-of-exam:
|
|
||||||
# - written
|
|
||||||
# - oral
|
|
||||||
# - alternative
|
|
||||||
# term:
|
|
||||||
# - summer
|
|
||||||
# - winter
|
|
||||||
# - both
|
|
Loading…
Add table
Add a link
Reference in a new issue