mbutterick / pollen-users

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

Render a "doc" into an HTML file #109

Open casouri opened 3 years ago

casouri commented 3 years ago

My blog has category indexes for my posts, such as indexes for "Emacs", "Tech", "Web", etc. These index pages repeat and their contents are automatically generated, so it doesn't make much sense to create individual, mostly identical files for each.

Since the contents are programmatically generated, I can easily create a doc, but AFAIK there isn't a pubilc API that renders it with a template. The closest I can find is render-to-file, but it only takes a source path. Is there any way to do what I want without hacking Pollen? If there isn't, where should I look start? Thanks.

mbutterick commented 3 years ago

Pollen’s template rendering is derived from the include-template function in Racket, which itself demands files as input. In other words, this limitation is outside Pollen, and thus “hacking Pollen” won’t change it.

casouri commented 3 years ago

Can I use the template file as input, and rebind doc to my generated stuff?

mbutterick commented 3 years ago

No, but you can put your doc in a temp file and render that.

On Jul 3, 2021, at 8:40 AM, Yuan Fu @.***> wrote:

 Can I use the template file as input, and rebind doc to my generated stuff?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

casouri commented 3 years ago

I see, that's probably the easiest way. Thanks.

otherjoel commented 3 years ago

(Shameless plug) My Beeswax library should help you accomplish this without relying on a temp file. (Caveat emptor, still under development on a very spare-time basis!)

mbutterick commented 3 years ago

Perhaps also look into Colophon by @basus.

mbutterick commented 3 years ago

FWIW I’m not a blogger. I’ve never used Pollen to make blogs. Thus I have never made bloggy features a priority. Especially because there are already a zillion blog engines to choose from. So if someone is choosing to make a blog with Pollen, I conclude that they must have their reasons for doing things the hard way. I salute their struggle, because it results in wisdom.

casouri commented 3 years ago

(Shameless plug) My Beeswax library should help you accomplish this without relying on a temp file. (Caveat emptor, still under development on a very spare-time basis!)

This is exactly what I asked for! Thanks.

Although blog engines come with facilities pre-built, those facilities impose some limitations and force one to do things their way. With Pollen I have to implement most of the things myself, but I also get the freedom to do everything in my way.