Render a "doc" into an HTML file
Openopened 2 years ago by casouri · 8 comments
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
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.
Pollen’s template rendering is derived from the
include-templatefunction in Racket, which itself demands files as input. In other words, this limitation is outside Pollen, and thus “hacking Pollen” won’t change it.
Can I use the template file as input, and rebind
docto my generated stuff?
No, but you can put your doc in a temp file and render that.
I see, that's probably the easiest way. Thanks.
(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!)
Perhaps also look into Colophon by @basus.
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.
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.