I have been working on a blogging system for Freeway, and one of the
outcomes of that little side project has been a need to make new
styles in Freeway that will always get published in either the page
or the document style sheet. This is surprisingly hard to do without
resorting to tricks like putting a non-layered HTML box in the
pasteboard and adding samples of the styles within it.
At the same time, I also need to be able to make little snippets of
layout code that will get picked up by the blog engine and used as
templates. In Rails, these elements are known as “partials”, and are
named with a leading underscore to signify their intent. They don’t
have any head or body tag, they just have one element, like a single
row of a table or a form layout or similar.
So I have started another fine Action, just in time for the new year,
to make these tasks a little simpler. It’s called TemplateHelper, and
it is an Item Action.
Apply it to an element on your page, and by default, it will delete
that element from the page AFTER all associated styles have been
published to the page or style sheet. This will let you mock up
styles in place, and then use the generated HTML for the page layout
without the mock elements showing.
Apply it to an element and select Make Partial, and it will also
create a new file alongside the current page with a filename made up
of an underscore + the item name or whatever you enter for a name in
the Actions palette + .html. This file will contain the content that
the Action extracted from the element you applied it to. Partial
names are tracked within the current folder and duplicates are
alerted to you during the publish cycle. You can also remove the
entire style tag from the element you applied it to, or just the
positioning and or dimensions.
It works best when applied to a layer element, but will also handle
being applied to a non-layered element. If you apply it to a single
cell of a user-drawn table, then the entire row of the table will be
extracted and made into a partial.
I’ll be releasing the framework for the blog fairly soon, and that
will be a good demo for this Action. In the meantime, you may find it
interesting and/or useful.
Please let me know if you think of something it’s missing.
actionsdev mailing list
Update your subscriptions at: