Have you guys considered Jim Weirich's Builder? Although a bit more
wordy than Markaby in terms of code, it allows curly braces and you can
output unescaped text (i.e. Radius tags, if necessary) using the
<< operator. Unlike Markaby, however, it would have to be eval'd
in the filter method. Here's an example of how you might do it.
require 'builder'
class BuilderFilter < TextFilter::Base
register 'Builder::XmlMarkup'
def filter(text)
x = Builder::XmlMarkup.new :indent => 2
eval(text)
x.target!
end
end
Documentation for this filter would obviously have to include what the
local variable name is for the XmlMarkup object since Builder 2.0
requires a target for all of its markup calls.
Cheers,
Sean Cribbs
seancribbs.com
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="" class="moz-txt-link-rfc2396E" href="http://localhost/">"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
|
_______________________________________________
Radiant mailing list
[email protected]
http://lists.radiantcms.org/mailman/listinfo/radiant