On 26/07/06, Caylan Van Larson <[EMAIL PROTECTED]> wrote:
>
> What's the possibility of having a markaby filter, or markaby in the
> layouts?
I've been experimenting around today trying to get markaby working as
a filter. I've run into a number of problems though so I'm putting it
out to the mailing list to see if someone can improve it.
Firstly it seems Ruby syntax can only handle simple radius tags
without parameters. So a simple tag like
h2{r:date}
works but a tag like
r:link(:url=>"http://localhost/")
does not, although
r:link do
test("link")
end
does work. Also it doesn't seem to like the {} block delimeters so
r:random {
r:option {text("random1")}
r:oprion {text("random2")}
}
won't parse but
r:random do
r:option do;text("random1");end
r:option do;text("random2");end
end
works.
Anyway here's the code for the filter I was using. I had to redefine
parse_object and change the order of filtering and parsing by radius,
hopefully that doesn't cause problems with other filters.
require 'markaby'
class Behavior::Base
def parse_object(object)
text = object.content
text = object.filter.filter(text) if object.respond_to? :filter_id
text = parse(text)
text
end
end
class MarkabyFilter < TextFilter::Base
register 'Markaby'
def filter(text)
Markaby::Template.new(text).render+
end
end
Farrel
_______________________________________________
Radiant mailing list
[email protected]
http://lists.radiantcms.org/mailman/listinfo/radiant