Full tex template adapted for python.
2 files modified
1 files renamed
| | |
| | | p= Problem(n) |
| | | pprint.pprint(p.problem) |
| | | |
| | | print(t.head(exam_title="Naslov izpita", date="27.10.2018", faculty_name="Fakulteta test", sid_prefill="11x0xxxx")) |
| | | print(t.start_paper()) |
| | | print(t.put_problem_into_template(p.problem)) |
| | | print(t.tail()) |
| | |
| | | |
| | | self.template_filenames = { |
| | | "head": os.path.join(path, "headtemplate.tpl"), |
| | | "paper": os.path.join(path, "newpolatemplate.tpl"), |
| | | "paper": os.path.join(path, "newpaperwithNAMEtemplate.tpl"), |
| | | "paper_sid": os.path.join(path, "newpaperwithSIDtemplate.tpl"), |
| | | "problem": os.path.join(path, "problemtemplate.tpl"), |
| | | "problem_intro": os.path.join(path, "problemintrotemplate.tpl"), |
| | |
| | | } |
| | | ) |
| | | return retstr |
| | | |
| | | def head( |
| | | self, |
| | | faculty_id=0, |
| | | faculty_name="", |
| | | exam_id=0, |
| | | exam_title="Exam", |
| | | date="", |
| | | last_line="", |
| | | sid_prefill="11x0xxxx", |
| | | start_number=0, |
| | | ): |
| | | return Template(self.template["head"]).substitute({ |
| | | "faculty_id": faculty_id, |
| | | "exam_id": exam_id, |
| | | "faculty_name": faculty_name, |
| | | "exam_title": exam_title, |
| | | "date": date, |
| | | "last_line": last_line, |
| | | "sid_prefill": sid_prefill, |
| | | "start_number": start_number |
| | | }) |
| | | |
| | | def tail(self): |
| | | return ("""\end{document}""") |
| | | |
| | | |
| | | def start_paper(self, student_id=None, student_name=None): |
| | | if student_id is not None: |
| | | return Template(self.template["paper"]).substitute(student_id, student_name) |
| | | else: |
| | | return Template(self.template["paper_sid"]).substitute() |