I think I've managed to come up with a really flexible
standard for fusedocs that's both easy to read and
easy to parse.

Here's an example:

||BEGIN FUSEDOC||

||ATTRIBUTES||
==> password : STRING : len(@) gte 8; len(@) lte 16 : password
==> confirmpassword : STRING : @ eq |password| : password re-entered

==> [Option1] : STRING :: An option.
==> [Option2] : STRING :: Another option.
==> [Option3] : STRING :: Yet another.

==> age : NUMBER : @ lte 120 : Person's age.
==> [registeredToVote] : BOOLEAN :: Is the person registered to vote?

||ASSERTIONS||
|(Option1)| or |(Option2)| or |(Option3)| : One of these must exist.
(|age| gte 18) IMP |(registeredToVote)| : If over age 18, the attribute
registeredToVote must be passed.

||END FUSEDOC||

Now, an explanation. Attribute definitions are divided into four parts,
which are delimited by colons.

1) The attribute's name
2) The attribute's type (STRING, NUMBER, etc.)
3) Assertions about the attribute. Other attributes are repesented by
surrounding them in pipes (|). The (@) symbol is shorthand for the
current attribute. Parenthesis inside pipes means "if this parameter
exists." |(aVar)| is equivalent to isDefined("|aVar|"). For more
about assertions see Hal's

4) Comments / a description of what the attribute means.

I've also added "||ASSERTIONS||" for assertions that aren't really
related to one specific attribute. This should help take care of
most of the "relationships" Lee was talking about.

I've written a basic parser for this that determines whether a
circuit has all the stuff it needs to do its job. It's not
production quality but I'll email it to you if you like.

Patrick

----------------------------------
Patrick McElhaney              <><
Intranet / Web Site Developer
American City Business Journals
704-973-1019    704-236-8351 (cell)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to