On Nov 11, 2016, at 11:48 AM, Joel Dueck <dueckofe...@gmail.com> wrote:

> I created a macro to help myself out as I consider adding a third and fourth 
> output format to a Pollen project.
> 
> I wrote about it at my Pollen-as-blog project here: 
> https://thenotepad.org/posts/splitting-pollen-tags-with-racket-macros.html
> Comments/criticism welcome.


I like these ideas, and it suggests to me that Pollen could have some better 
tools built in for managing poly projects.

After trying it this macro, my one thought was that using the `poly-branch-tag` 
macro requires naming the underlying tag functions in a certain way, which is 
potentially fragile (and requires escalating housekeeping).

Here's an alternate — not necessarily better or preferable — approach where the 
macro takes as input the targets and the source files containing the tags:

https://gist.github.com/mbutterick/caf88360fc0090305937ca54539054bc

Invoked like so:

(define-poly-tag-from-file root
  [html "pollen-local/tags-html.rkt"]
  [pdf "pollen-local/tags-pdf.rkt"])

In this case, the tag functions are all defined using the same names. So the 
macro fetches the `root` function out of "pollen-local/tags-html.rkt" and uses 
it for the 'html branch of the poly tag; then fetches `root` out of 
"pollen-local/tags-html.rkt" and uses it for the 'pdf branch, etc.


We could imagine a second macro that stacks on top of this one to generate 
other poly tags en masse:

(define-syntax-rule (my-poly-tags ID ...)
  (begin
    (define-poly-tag-from-file ID
      [html "pollen-local/tags-html.rkt"]
      [pdf "pollen-local/tags-pdf.rkt"]) ...))

(my-poly-tags p i emph b strong code)


For that matter we could also imagine a macro that generates the call to 
`define-poly-tag-from-file` using the list of current poly targets, and a 
certain naming convention for the source files.





-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pollenpub+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to