pupate

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

pupate / examples / scripting / 1
Neale Pickett  ·  2024-08-19

mkpuzzle.sh

 1#! /bin/sh
 2
 3answer=bloop
 4encoded=$(echo -n $answer | base64 | tee encoded.b64)
 5now=$(date -Is)
 6
 7cat <<EOF
 8---
 9title: Introduction to dynamic puzzles
10authors:
11  - neale
12answers:
13  - $answer
14attachments:
15  - encoded.b64
16debug:
17  log:
18    - "time: $now"
19---
20Here's how you can make a dynamic puzzle!
21
22You can do anything you want in the code,
23just make sure you output the same format as \`puzzle.md\`.
24
25For compatibility with Windows,
26puzzles must be named \`mkpuzzle.*\`.
27The extension is used to tell Windows how to run the program.
28It is an error to have more than one \`mkpuzzle.*\` file.
29
30Attachments can be generated:
31be sure to write them in the current directory when \`mkpuzzle\` is run.
32
33Decode the following base64-encoded text to obtain the answer:
34
35    $encoded
36EOF