Wanted: simpler metas syntax #51

Closed
opened 9 years ago by innermatrix · 4 comments
innermatrix commented 9 years ago (Migrated from github.com)

The current metas syntax is, IMO, overly noisy and verbose. I'd like to see it simplified from

◊meta('key "value")
◊meta('key2 "value2")
◊meta('key3 "value3")

to something more like:

◊metas(
    key "value"
    key2 "value2"
    key3 "value3"
)
The current metas syntax is, IMO, overly noisy and verbose. I'd like to see it simplified from ``` ◊meta('key "value") ◊meta('key2 "value2") ◊meta('key3 "value3") ``` to something more like: ``` ◊metas( key "value" key2 "value2" key3 "value3" ) ```
mbutterick commented 9 years ago (Migrated from github.com)

The Pollen parser gathers tags of the form ◊meta('key "value"), but you can invent your own syntax for generating those tags, e.g. —

#lang pollen/markup

(define (metas . kvs)
   (define meta-tags (for/list ([(k v) (in-hash (apply hash kvs))])
                       `(meta ((,k ,v)))))
   `(span ,@meta-tags))

◊metas['key "value" 'key2 "value2" 'key3 "value3"]
The Pollen parser gathers tags of the form `◊meta('key "value")`, but you can invent your own syntax for generating those tags, e.g. — ``` racket #lang pollen/markup ◊(define (metas . kvs) (define meta-tags (for/list ([(k v) (in-hash (apply hash kvs))]) `(meta ((,k ,v))))) `(span ,@meta-tags)) ◊metas['key "value" 'key2 "value2" 'key3 "value3"] ```
innermatrix commented 9 years ago (Migrated from github.com)

Yeah, I know the parser currently picks up ◊meta('k "v"). And I know I can come up with my own; this is me requesting for a more convenient metas syntax to be added to pollen proper, because I think there is enough value in this that it shouldn't be reinvented by everyone who wants it.

(Once I get up to speed on Racket (ahhh, sweet memories of Scheme in intro CS classes), I'd be happy to contribute a patch to that effect, but for now all I have is a github issue.)

Yeah, I know the parser currently picks up `◊meta('k "v")`. And I know I can come up with my own; this is me requesting for a more convenient metas syntax to be added to pollen proper, because I think there is enough value in this that it shouldn't be reinvented by everyone who wants it. (Once I get up to speed on Racket (ahhh, sweet memories of Scheme in intro CS classes), I'd be happy to contribute a patch to that effect, but for now all I have is a github issue.)
mbutterick commented 9 years ago (Migrated from github.com)

I’ve just pushed a fix to allow multiple key/value pairs within a meta tag, so this:

◊meta['key: "value"]
◊meta['key2: "value2"]
◊meta['key3: "value3"]

Is equivalent to this:

◊meta['key: "value" 'key2: "value2" 'key3: "value3"]

This change is OK with me because it extends the existing syntax in a simple & intuitive way.

I’ve just pushed a fix to allow multiple key/value pairs within a `meta` tag, so this: ``` racket ◊meta['key: "value"] ◊meta['key2: "value2"] ◊meta['key3: "value3"] ``` Is equivalent to this: ``` racket ◊meta['key: "value" 'key2: "value2" 'key3: "value3"] ``` This change is OK with me because it extends the existing syntax in a simple & intuitive way.
innermatrix commented 9 years ago (Migrated from github.com)

Thanks!

Thanks!
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
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#51
Loading…
There is no content yet.