play-with-go / preguide

preguide is a guide/manual specification and validation tool, principally used as part of https://play-with-go.dev
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

cmd/preguide: support decorators #210

Open myitcv opened 2 years ago

myitcv commented 2 years ago

Placeholder for decorator support.

We currently vary the output of a step in the declaration of a step itself:

https://github.com/play-with-go/preguide/blob/78bc6774e5a4479793471a9fff76f1c9e0c9af26/cmd/preguide/testdata/renderers.txt#L88-L98

This is wrong. Applying ellipsis, or rendering a specific range of lines, is a purely presentational thing.

We should therefore be doing this in "decorators" that modify the result of the step function. Something like:

{{ step "step0" | lineRange [[2,2]] }}