Saturday, July 18, 2009

Tagging content with Curl macros

Curl was thought of as a web content language before getting some attention as an RIA platform, but Curl macros are of interest for markup because Curl files are Curl data and macros are expanded based on the package reading that file. So in different contexts, the same markup can be used to obtain different results with no conversion.
Here is an example from an outline of mine on microformats:

{topic "microformats",

{wp "http://en.wikipedia.org/wiki/Microformats", Lang.en},

{home "http://microformats.org/"},

{intro "http://www.digital-web.com/articles/microformats_primer/"},

{blog "http://garrettdimon.com/", BlogType.personal },

{cf "http://microformatique.com/optimus/"}
}

The commas are an option that I chose for the {topic} macro, but the Curl macro format is very open and the punctuation is wholly arbitrary on my part.
Curl also offers a more extensive {define-syntax} option which is even more suited to treating Curl as data than the friendly {define-macro} with its many template or pattern options.
In the elements {wp} and {blog} the final attributes are themselves optional and in some contexts might be ignored altogether. Here they are simply my enums Lang and BlogType.

No comments: