How about something like this for the single file format for directives?<br><br># Basic description text goes in the rdoc like normal<br># more desc here<br># more desc here<br><br>=begin example<br> <div mv:generate="
foo.bar"><br> <div mv:replace="cat"><br> A good example of various usage pattens would go here<br> </div><br> <div mv:replace="dog(hello)"><br> One could demonstrate several in one html snippet
<br> </div><br> </div><br>=end<br><br>=begin result<br> foo.bar: <br> <div><br> <div><%= cat %></div><br> <div><%= dog(hello) %></div><br> </div>
<br>=end result<br><br>class MyDirective < MasterView::DirectiveBase<br> def self.category # this would actually be the category the directive gets cataloged in (if provided)<br> 'Form Helpers'<br> end<br><br><br>
<br> def stag<br> end<br><br> ...<br>end<br><br><br><br>So the thinking is that we can build our directive docs right off the source files. We will pull the main class comments in as description text, then we can have an example and result. The example could also automatically be made available to the interactive test page, so it would show up as another example link which if you click would populate it with the example text.
<br><br>The self.category if exists could be used to categorize the directive so we can put them in categories. Our directive docs have some categories now so we could use this kind of concept to group things. The name would come from the class name or directive name if overridden.
<br><br>I haven't quite figured out how to do multiple examples since for the interactive link I only want one. I guess we could allow multiple but I just will take the first one for the interactive page.<br><br>Would this be easy enough to follow if people were starting from an existing directive or template?
<br><br>I think this would work out well if we can move towards reading everything out of our directive files that will keep things in sync everywhere with no duplication. And it allows others to upload files or download files to their system and if we have a simple admin page which can read the available directives on the system it can provide a live reference of every directive installed.
<br>