Home About The Codist RSS Feed

The Fiche Framework - Part II
Oct 25, 2006 20:17 perm link Readers: 497

In the second part of my description of Fiche, I want to focus on the benefits of AFL, the markup language for the framework.

The syntax of AFL is much simpler and more concise that HTML or XML, and in practice has been very pleasant to work with.

The basic element is the tag (not a good word but I haven't found a better term yet):

tag[]
tag()[]

The two forms are similar but the first has no parameters (or attributes if you like); the second can have multiple comma-delimited key-value pairs plus a single key which is assumed to be an id. Tags come in two flavors, output tags (that generate content) and command tags (the are executed). All tags can have children (I make no attempt at enforcing illegal combinations). Data references (in the usual dot notation) are allowed anywhere text can be placed including the parameters. The parameter to a command tag is assumed to be a data reference. Data may be followed by an optional : and a decorator (a single valued function). That's the whole syntax.

Examples:

div(exceptionreport,style=display:none;)[]

if(requestinfo.session.authorLoggedIn)[
  a(class=button,href={requestinfo.baseURL}{site.path}/edit)[Add Article]
]

div(post)[
  {post.display}
  p(tags)[Technorati Tags: {post.tags:technotags} ]
]

li[a(class=button,onclick=return addcomment({post.threadId},this))[Add Comment]]

Currently the tags map mostly to actual HTML tags but in the next version I will support more complex tags that could, for example, generate the entire navigation for a site. Decorators are already user definable (and quite handy). As you can see, it is quite readable; however with syntax hiliting in TextMate, it's even better (I do have to update the syntax color a bit, it's a little out of date)

Of course for those of you reading this, its somewhat like reading about the surface of Mars; it's interesting, but you can't go there yet. At this point there is no reason to release the framework as it is still very young (though quite functional). As it becomes closer to being completed, and anyone really cares, I will release it as open source. I am not in framework business (reading this blog lately you would think so); once this thing is fairly well done I can start on the real work.

Fiche in a nutshell is a web framework combined with a lightweight CMS backend, all built on standard java technologies, using a simplified web command language named AFL.

My Tags:

Name:


Optional URL:


Comment:


Save Cancel

Copyright © 2007 By Andrew Wulf