I know this is subjective & personal, but I actually prefer the more explicit (and somewhat more verbose) syntax of naming each attribute specifically:
◊essay[#:title "Title" #:url "http://url.com"]{The Blurb to this essay} I can’t comment on possible changes to Pollen to accommodate syntax style preferences. But looking at your specific example here did make me wonder if backing up a bit might be helpful. Is your ◊essay tag likely to be used often throughout your site, or just once in an index/listing of essays? Are these essays also Pollen files or are they external web pages that you are linking to? Here’s where I’m going with this. Suppose your answers to the question above are "yes, using often throughout" and "yes" respectively. In that case, one route would be to make the tag look more like this: ◊essay["my essay"] ...and that’s it. The tag function would then, for example, convert "my-essay" to "my-essay.html.pm" and pull the title, url and blurb out of the metas for that file: (define (essay mykey) (define mykey-recode (string-append (string-replace mykey " " "-") ".html.pm")) (define mykey-sym (string->symbol mykey-recode)) (define essay-metas (get-metas (string->path mykey-recode))) `(a [[href ,(select-from-metas 'url essay-metas)] [title ,(select-from-metas 'title essay-metas)]] (i ,(select-from-metas 'blurb essay-metas)))) At the top of my-essay.html.pm, you’d fill in the metas like so: ◊(define-meta title "This Essay’s Title") ◊(define-meta url "http://url.com") ◊(define-meta blurb "The blurb for this essay") Thus begins the essay: Lorem ipsum dolor sit amet… That way I have less typing, my tag syntax is much simpler, and I can change that info once (in the essay itself) and have it update everywhere. Again, I know I made a lot of assumptions there. On Wednesday, September 28, 2016 at 4:46:32 PM UTC-5, Shrutarshi Basu wrote: > > Sure. For example, let's say we would like to have a list of essays for an > archive page. Each entry in this list would have a title, a URL, and a > short blurb. Right now, in Pollen, I am writing each such entry as: > > ◊essay["Title" "http://url-to-this-essay.html"]{The blurb for this essay} > > This is suboptimal because I am writing the title and the URL as strings > and packing them into the Racket arguments component. Ideally, I would like > to be able to write something like: > > ◊essay[Title](http://url-to-this-essay.html){The blurb for this essay} > > I suppose a more verbose way to express the same would be to have them be > nested tags: > > ◊essay{ > > ◊title{Title} > ◊url{http://url-to-this-essay.html} > ◊blurb{The blurb for this essay} > } > > but that feels like more structure/typing than should be necessary for > very structured data. > > Thanks, > Basu > > > On Wed, Sep 28, 2016 at 5:37 PM, Joel Dueck <[email protected] > <javascript:>> wrote: > >> Can you give an example of how you are doing it now, and an example of >> roughly what you'd like to be able to do? >> >> On Wednesday, September 28, 2016 at 3:26:30 PM UTC-5, Shrutarshi Basu >> wrote: >> >>> Hi, >>> I know from the Pollen Command Syntax article[1] that Pollen commands >>> can have Racket arguments and a text body argument. Would it be possible to >>> extend this to allow for multi-part commands? For example, a common pattern >>> I've seen coming up in my Pollen documents is a tag whose arguments are >>> title-link-description. Currently I'm stuffing the link and title as two >>> strings in the Racket arguments. I would love to be able to specify these >>> three things directly, but that doesn't seem possible in the current DSL. >>> >>> Thanks, >>> Basu >>> >>> [1]:http://docs.racket-lang.org/pollen/pollen-command-syntax.html >>> >>> -- >>> Shrutarshi Basu >>> Basus.me >>> The ByteBaker <http://bytebaker.com> -- computer science is not about >>> computers >>> @basus <http://twitter.com/basus> >>> >> -- >> 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 [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Shrutarshi Basu > Basus.me > The ByteBaker <http://bytebaker.com> -- computer science is not about > computers > @basus <http://twitter.com/basus> > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
