Compare commits

..

2 commits

Author SHA1 Message Date
Hartmut Seichter
467727392a Update with loading field files 2023-11-08 21:23:24 +01:00
Hartmut Seichter
e11a484290 further update 2023-11-08 21:23:18 +01:00
8 changed files with 1159 additions and 87 deletions

6
.gitignore vendored
View file

@ -158,3 +158,9 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
## Other
*.pdf

View file

@ -15,6 +15,7 @@ import itertools
import yaml
import textwrap
import string
import os
class MarkdownGenerator:
@ -39,6 +40,9 @@ class MarkdownGenerator:
for k,v in ti:
if v == None:
v = ''
h = textwrap.wrap(k, h_len, break_long_words=False)
wrapper = textwrap.TextWrapper(d_len)
t = [wrapper.wrap(i) for i in v.split('\n') if i != '']
@ -147,18 +151,26 @@ def main():
# get arguments
args = parser.parse_args()
# only run debug
if args.schema and args.meta:
if args.schema and args.meta and len(args.fields) > 0:
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:
cb.set_schema(yaml.load(f,Loader=yaml.Loader))
for m in args.meta:
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:
parser.print_help()

View file

@ -1,5 +0,0 @@
+-----------------------------------+---------------------------------------------------------------------------------------------+
|Modulname |Computer Graphics |
+===================================+=============================================================================================+
|Kürzel |CG |
+-----------------------------------+---------------------------------------------------------------------------------------------+

View file

@ -1,8 +1,12 @@
table.pdf:
@echo "creating english version ..."
python ../../coursebuilder -s schema.yaml -m mod.cg.yaml -l en -f name id | pandoc -o table.pdf
table.en.pdf:
@echo "creating English version ..."
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:
rm table.pdf
rm table.en.pdf table.de.pdf

18
test/simple/fields.yaml Normal file
View file

@ -0,0 +1,18 @@
fields:
- name
- id
- goal
- content
- form-of-instruction
- prerequisites
- media-of-instruction
- author-of-indenture
- used-in
- workload
- credits
- form-of-exam
- term
- frequency
- duration
- kind
- remarks

View file

@ -1,5 +1,7 @@
name:
value: Computer Graphics
de: Computergrafik
en: Computer Graphics
id:
value: CG

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,6 @@
#
name:
type: str
translatable: false
label: {
de: "Modulname",
en: "name of course"
@ -186,12 +185,12 @@ form-of-exam:
term:
label: {
de: "Semester",
en: "Term"
en: "term"
}
type: int
template:
de: "$value$. Semester"
en: "$value$ semester"
de: " ${value}. Semester"
en: " ${value}. semester"
#
# Häufigkeit des Angebots
@ -199,7 +198,7 @@ term:
frequency:
label: {
de: "Häufigkeit des Angebots",
en: "Frequency of Offer"
en: "frequency of Offer"
}
type: "enum"
values: {
@ -215,6 +214,9 @@ frequency:
duration:
type: int
label:
de: Dauer
en: duration
template:
de: "$value Semester"
en: "$value term(s)"
@ -240,71 +242,5 @@ remarks:
type: str
label: {
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