From a5a5f9f876e1c7b367003a196066f36da92967d6 Mon Sep 17 00:00:00 2001
From: Tue Herlau <tuhe@dtu.dk>
Date: Wed, 15 Mar 2023 19:17:19 +0100
Subject: [PATCH] tmp updates

---
 setup.py                                           |  2 +-
 src/coursebox.egg-info/PKG-INFO                    |  2 +-
 src/coursebox/core/info.py                         |  6 ++++++
 .../material/homepage_lectures_exercises.py        | 14 ++++++++------
 src/coursebox/setup_coursebox.py                   |  4 +++-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/setup.py b/setup.py
index 650818d..3679b0e 100644
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
 # beamer-slider
 setuptools.setup(
     name="coursebox",
-    version="0.1.15",
+    version="0.1.16",
     author="Tue Herlau",
     author_email="tuhe@dtu.dk",
     description="A course management system currently used at DTU",
diff --git a/src/coursebox.egg-info/PKG-INFO b/src/coursebox.egg-info/PKG-INFO
index 12bfe3c..5da7428 100644
--- a/src/coursebox.egg-info/PKG-INFO
+++ b/src/coursebox.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: coursebox
-Version: 0.1.15
+Version: 0.1.16
 Summary: A course management system currently used at DTU
 Home-page: https://lab.compute.dtu.dk/tuhe/coursebox
 Author: Tue Herlau
diff --git a/src/coursebox/core/info.py b/src/coursebox/core/info.py
index ae7d4b3..6ef112e 100644
--- a/src/coursebox/core/info.py
+++ b/src/coursebox/core/info.py
@@ -378,6 +378,12 @@ def class_information():
             ri['latex_long'] = f"{nd.strftime('%A')} {nd.day}{ab} {nd.strftime('%B')}, {nd.year}"
             ri['latex_short'] = f"{nd.strftime('%B')} {nd.day}{ab}, {nd.year}"
             d['reports_info'][k] = ri
+
+
+    ppi = core_conf.get('post_process_info', None)
+    if ppi is not None:
+        d = ppi(paths, d)
+
     return d
 
 def fix_instructor_comma(dd, instructors):
diff --git a/src/coursebox/material/homepage_lectures_exercises.py b/src/coursebox/material/homepage_lectures_exercises.py
index 3eeeeeb..75da37e 100644
--- a/src/coursebox/material/homepage_lectures_exercises.py
+++ b/src/coursebox/material/homepage_lectures_exercises.py
@@ -306,7 +306,7 @@ def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compil
     # Perform sync here.
 
     for rel in source:
-        if rel.endswith("_partial.tex"):
+        if "_partial." in rel:
             continue
 
         if rel not in target or target[rel]['hash'] != source[rel]['hash']:
@@ -335,11 +335,13 @@ def fix_shared(paths, output_dir, pdf2png=False,dosvg=True,verbose=False, compil
 
 def jinjafy_shared_templates_dir(paths, info):
     tpd = paths['shared'] + "/templates"
-    for f in glob.glob(tpd + "/*.tex"):
-        print(f)
-        ex = "_partial.tex"
-        if f.endswith(ex):
-            jinjafy_template(info, file_in=f, file_out=f"{tpd}/{os.path.basename(f)[:-len(ex)]}.tex")
+    for f in glob.glob(tpd + "/*.*"):
+        # ex = "_partial."
+        if "_partial." in f:
+            ff = os.path.basename(f)
+            ff = ff[:ff.rfind("_partial.")]
+            
+            jinjafy_template(info, file_in=f, file_out=f"{tpd}/{ff}.{f.split('.')[-1]}")
 
 
 def get_filters():
diff --git a/src/coursebox/setup_coursebox.py b/src/coursebox/setup_coursebox.py
index aca8307..f3d7907 100644
--- a/src/coursebox/setup_coursebox.py
+++ b/src/coursebox/setup_coursebox.py
@@ -5,7 +5,7 @@ def setup_coursebox(working_dir, course_number="02450", semester='spring', year=
     slides_includelabels=False,
     continuing_education_mode = False,
     slides_shownotes=False,
-    continuing_education_month = "March", **kwargs):
+    continuing_education_month = "March", post_process_info=None, **kwargs):
 
     info_paths.core_conf['working_dir'] = working_dir
     info_paths.core_conf['course_number'] = course_number
@@ -16,5 +16,7 @@ def setup_coursebox(working_dir, course_number="02450", semester='spring', year=
     info_paths.core_conf['continuing_education_mode'] = continuing_education_mode
     info_paths.core_conf['continuing_education_month'] = continuing_education_month
     info_paths.core_conf['slides_shownotes'] = slides_shownotes
+    info_paths.core_conf['post_process_info'] = post_process_info
+
     for a, val in kwargs.items():
         info_paths.core_conf[a] = val
-- 
GitLab