pupate

Puzzle transpiler
git clone https://git.woozle.org/neale/pupate.git

pupate / variants / sctr / category
Neale Pickett  ·  2025-05-08

training.json

 1{
 2  "title": {{.Title | json}},
 3  "version": {{(or (getenv "VERSION") "$VERSION-unset") | json}},
 4  "blueprint": {{.Blueprint | json}},
 5  "description": {{(or .Description .Content) | json}},
 6  "authors": [
 7{{- range $i, $name := .Authors}}
 8  {{- if $i}},{{end}}
 9    {{$name | json}}
10{{- end}}
11    ],
12{{- if gt (len .Prerequisites) 0}}
13  "prereq": {{index .Prerequisites 0 | json}},
14{{- end}}
15  "modules": [
16{{- range $i, $puzzle := .Puzzles}}
17  {{- if $i}},{{end}}
18    {
19      "title": {{.Title | json}},
20      "step": {{sum $i 1}},
21  {{- if $i}}
22      "prereq": {{$i}},
23  {{- end}}
24  {{- if gt (len .Attachments) 0}}
25      "required_files": [
26    {{- range $i, $name := .Attachments}}
27        {{- if $i}},{{end}}
28        {{$puzzle.RelPath $name | json}}
29    {{- end}}
30      ],
31  {{- end}}
32      "path": {{$puzzle.RelPath "puzzle.md" | json}},
33      "knowledge_check": {
34        "question": {{.Question | json}},
35        "answers": [
36  {{- range $i, $answer := .Answers}}
37          {{- if $i}},{{end}}
38          {{$answer | json}}
39  {{- end}}
40        ]
41      }
42    }
43{{- end}}
44  ]
45}