ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to create a more human-readable syntax for displaying workbook activities?
       [not found] <673664275.579293.1650326319146.ref@mail.yahoo.com>
@ 2022-04-18 23:58 ` Joel via ntg-context
  0 siblings, 0 replies; only message in thread
From: Joel via ntg-context @ 2022-04-18 23:58 UTC (permalink / raw)
  To: ntg-context; +Cc: Joel


[-- Attachment #1.1: Type: text/plain, Size: 1705 bytes --]

I am creating a student workbook. There are ~30 chapters, each containing ~20 activities, called "Activity A", "Activity B", and so on.

The `workbook.tex` itself uses a recurse function, so it prints chapter 1-30. The reason I use this, is if I need to do a fast test of the code, I can compile a specific range of chapters, not the whole workbook.

\define\activityA{}
\define\activityB{}

\dostepwiserecurse{1}{30}{1}{

    \chapter{\recurselevel}
        \activityA
        \activityB
}

\activityA prints the workbook activity "Activity A".
\activityB prints the workbook activity "Activity B".

The problem comes in that some activities have varied versions. Just as an example, "Activity C might be a crossword puzzle in some chapters, but a word search in other chapters. My poor solution has been to use registercyclist:

\define\altCa{print a crossword}
\define[3]\altCb{print a word search}
\registercyclelist{activityClist}{\altCa, \altCb{}{}{}, \altCb{}{}{}}
\define\activityC{%
    \usecyclelist{activityClist}
}

This code works okay, but becomes broken if I try to change the page range in `dostepwiserecurse` when testing my code. The other problem is the syntax is super messy. Within this single line, tones of data is crammed in:

\registercyclelist{activityClist}{\altCa, \altCb{}{}{}, \altCb{}{}{}}
...not only is it not easy to read which chapter gets which activity, I also have to fill in the {}{}{} with data, making it more difficult to read.

How can I create a much cleaner, human-readable syntax for storing this? Is there some simpler way to tell ConTeXt Chapter 1 gets one variant, Chapter 2, 3, and 4 get another, etc.?


[-- Attachment #1.2: Type: text/html, Size: 2166 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-18 23:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <673664275.579293.1650326319146.ref@mail.yahoo.com>
2022-04-18 23:58 ` How to create a more human-readable syntax for displaying workbook activities? Joel via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).