Render a "doc" into an HTML file #109

Open
opened 4 years ago by casouri · 8 comments
casouri commented 4 years ago (Migrated from github.com)

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.

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 4 years ago (Migrated from github.com)

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.

Pollen’s template rendering is derived from the [`include-template`](https://docs.racket-lang.org/web-server/templates.html?q=include-template#%28form._%28%28lib._web-server%2Ftemplates..rkt%29._include-template%29%29) 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 4 years ago (Migrated from github.com)

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

Can I use the template file as input, and rebind `doc` to my generated stuff?
mbutterick commented 4 years ago (Migrated from github.com)

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.

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 4 years ago (Migrated from github.com)

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

I see, that's probably the easiest way. Thanks.
otherjoel commented 4 years ago (Migrated from github.com)

(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!)

(Shameless plug) My [Beeswax](https://docs.racket-lang.org/beeswax/index.html) 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 4 years ago (Migrated from github.com)

Perhaps also look into Colophon by @basus.

Perhaps also look into [Colophon](https://colophon.basus.me/) by @basus.
mbutterick commented 4 years ago (Migrated from github.com)

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.

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 4 years ago (Migrated from github.com)

(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.

> (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.
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#109
Loading…
There is no content yet.