coderefinery / sphinx-lesson

Sphinx extension for creating CodeRefinery lessons
https://coderefinery.github.io/sphinx-lesson/
MIT License
15 stars 20 forks source link

Automatic counters for challenges #56

Open robertodr opened 3 years ago

robertodr commented 3 years ago

This is my usage scenario:

  1. I am delivering the workshop.
  2. Learners have cloned the lesson repository to follow the exercises.
  3. Exercises are organized by day in a content/code/day-N folder.
  4. Each day-N folder has subfolders with one exercise each. The folder are prefixed with a number, for easier reference. The subfolder contains an incomplete scaffold and its solution. For example:
    content/code/day-2/
    └── 21_automata-cxx
    ├── external
    ├── solution
    └── src

Can there be automatic counters for the challenge boxes in the lesson? Such that it's easily discoverable into which folder to navigate when one is following along on the lesson webpage. I am not even sure this is possible in Sphinx, to be honest :sweat_smile:

bast commented 3 years ago

So the goal is that Sphinx infers the number from a path in a directive?

robertodr commented 3 years ago

I was more thinking LaTeX-like where \section keeps track of section numbering. So any .. challenge:: would render the box with a number on the side. You suggestion is more advanced and would help keep the .. challenge:: in sync with changes in the underlying folder structure.

rkdarst commented 3 years ago

My philosophy here was "in a long-term view, we can't rely on numbers since the lesson will be continually updated", and I expected that people would keep referring to the lessons, for example watching a old video of it or referring to it with notes. So, I didn't place too high a priority on auto-numbering, since while convenient in the short term it makes problems when you want to change things. My recommendation is to use manual numbers, and where appropriate insert new numbers without changing all the numbers when it is convenient.

So... that's where this weird system of "5-Git Clone" came from. Manual numbers, which can be adjusted or you could add "5B" for example. Even if all the numbers change, by someone can look up exercise "Git Clone" and find what is hopefully it. (While interesting, I have a feeling this isn't really a working solution to the problem and no one would do it this way).

Maybe another option is each series of exercises has some numbers like 3A, 3B, 3C, so you can at least find the right area if not re-doing it.

What do you think? What's the best general option to recommend?

bast commented 3 years ago

In my recent course I have used numbering and I think it can help to quickly locate the exercise.

For video recordings this can be a problem but maybe we can have both? An exercise can have a number and a name? The person in the live workshop appreciates the number because they need to find it and the breakout room closes again in 10 minutes. The person watching the video can pause it and locate the exercise by name and there the number is less important perhaps.