moderninterpreters / markup

MARKUP provides a reader-macro to read HTML tags inside of Common Lisp code
Apache License 2.0
68 stars 8 forks source link

Templates with multiple children? #12

Open atgreen opened 2 weeks ago

atgreen commented 2 weeks ago

Thank you for markup.

I have a situation where I want to use a template, but instead of having one place to @(progn children), I want to inject different content in two places in the template. How should I handle this?

tdrhq commented 2 weeks ago

Typically when need this I write code to break down the children. Be careful though, the children contain both strings and tags,so you might want to filter out the strings first. But here's an example of doing this: https://github.com/screenshotbot/screenshotbot-oss/blob/main/src/core/ui/simple-card-page.lisp#L25

Would love your thoughts on how this can be generalized in a better way.

tdrhq commented 2 weeks ago

(mquery in that code comes from here: https://github.com/screenshotbot/screenshotbot-oss/blob/main/src/util/mquery.lisp, it's like jquery but for markup and is very useful, but I've not extracted it into a library yet)

atgreen commented 2 weeks ago

Thanks for the quick reply. I see how you handle it... The good news is that it can be done! I will try that, and think about how it could be made easier.

On Wed, Jun 19, 2024, 10:20 a.m. Arnold Noronha @.***> wrote:

Typically when need this I write code to break down the children. Be careful though, the children contain both strings and tags,so you might want to filter out the strings first. But here's an example of doing this: https://github.com/screenshotbot/screenshotbot-oss/blob/main/src/core/ui/simple-card-page.lisp#L25

Would love your thoughts on how this can be generalized in a better way.

— Reply to this email directly, view it on GitHub https://github.com/moderninterpreters/markup/issues/12#issuecomment-2178839933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAV7CPXRKXXHEJXTGFTDKTZIGHS7AVCNFSM6AAAAABJR7EK5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZYHAZTSOJTGM . You are receiving this because you authored the thread.Message ID: @.***>