mbutterick / pollen-users

please use https://forums.matthewbutterick.com/c/typesetting/ instead
https://forums.matthewbutterick.com/c/typesetting/
52 stars 0 forks source link

How to use pagetrees with multiple output targets? #82

Closed clarityflowers closed 3 years ago

clarityflowers commented 3 years ago

So, pagetrees as they are set up ask you to list your pages as the final output name:

#lang pollen

chapter-1.html
chapter-2.html

But, I have multiple output targets (in my case, html and gemtext), so I don't know if it's going to be .html or .gmi until render time. I've spend a few hours hacking at this trying to get something working, but I'm really wondering if there's something obvious I'm missing.

mbutterick commented 3 years ago

The pagetree can contain functions that generate its content, like any other Pollen file. (Indeed, it doesn’t even need to be written in #lang pollen, if you find #lang racket easier for the purpose.

You could set up the pagetree so that all the extensions are change to html or gmi based on the current-poly-target.

Or going the other direction — you could make two pagetrees, one for html and one for gmi, that are derived from a common set of source names.

This set of source names could either be manually updated, or automatically generated.

clarityflowers commented 3 years ago

I see, that's where basically where I ended up, but I wanted to make sure there wasn't something simpler. Thank you!