jlong / radius

A small, but powerful tag-based template language for Ruby modeled after the ones used in MovableType and TextPattern. It has tags similar to XML, but can be used to generate any form of plain text (HTML, e-mail, etc...).
MIT License
101 stars 21 forks source link

Ruby 1.9 support? #2

Closed aemadrid closed 13 years ago

aemadrid commented 15 years ago

It looks like will not run in Ruby 1.9.1. Although I can install it cleanly from gems and git repo most tests fail. I even tried running the simple example from the README on irb but it failed to render properly:

require 'radius' => true

context = Radius::Context.new do |c|

  • c.define_tag 'hello' do
  • 'Hello world' end c.define_tag 'repeat' do |tag|
  • number = (tag.attr['times'] || '1').to_i result = '' number.times { result << tag.expand } result end end => #<Radius::Context:0x92dc108 @definitions={"hello"=>#Proc:0x92dc040@(irb):4, "repeat"=>#Proc:0x92dbc1c@(irb):7}, @tag_binding_stack=[], @globals=#<Radius::DelegatingOpenStruct:0x92dc090 @object=nil, @hash={}>>

parser = Radius::Parser.new(context, :tag_prefix => 'r') => #<Radius::Parser:0x92d5a9c @context=#<Radius::Context:0x92dc108 @definitions={"hello"=>#Proc:0x92dc040@(irb):4, "repeat"=>#Proc:0x92dbc1c@(irb):7}, @tag_binding_stack=[], @globals=#<Radius::DelegatingOpenStruct:0x92dc090 @object=nil, @hash={}>>, @tag_prefix="r">


puts parser.parse(%{A small example:\n* !\n/r:repeat}) [#<Radius::ParseTag:0x982b2d0 @block=#Proc:0x982b2a8@/opt/ruby1.9/lib/ruby/gems/1.9.1/gems/radius-0.5.1/lib/radius.rb:413>, #<Radius::ParseContainerTag:0x982b1cc @contents=[#<Radius::ParseTag:0x982b050 @block=#Proc:0x982b028@/opt/ruby1.9/lib/ruby/gems/1.9.1/gems/radius-0.5.1/lib/radius.rb:413>], @attributes={"times"=>"3"}, @name="repeat", @block=#Proc:0x982afec@/opt/ruby1.9/lib/ruby/gems/1.9.1/gems/radius-0.5.1/lib/radius.rb:437>, #<Radius::ParseTag:0x982aec0 @block=#Proc:0x982ae98@/opt/ruby1.9/lib/ruby/gems/1.9.1/gems/radius-0.5.1/lib/radius.rb:422>] => nil


Any plans to support ruby 1.9? Any ideas on where it is breaking?

Thanks in advance,

Adrian Madrid

rkh commented 14 years ago

Also: Tests don't pass on 1.9.2.

davide-malagoli commented 13 years ago

It is possible to use these fixes?

https://github.com/aemadrid/radius19/

aemadrid commented 13 years ago

I believe we already merged my changes. It used to work on 1.9.1 but something changed in 1.9.2 that broke something else. Haven't had time to check for the new problems though.

davide-malagoli commented 13 years ago

I really don't know, I'm using your source on a modified version of Radiant CMS and it works, for now, but maybe it needs more testing... If I find something, I'll let you know...

saturnflyer commented 13 years ago

All tests pass for me on 1.9.2 and ruby head

rkh commented 13 years ago

@saturnflyer: Is this due to some fixes since the last stable release or is this a "works for me, won't fix"?

saturnflyer commented 13 years ago

All tests pass for the latest code. If it's 1.9.1 then I'd say "won't fix" but otherwise (1.9.2) it should be fine. I'll review the test suite again, but can you submit a pull request with a failing test if this is still a problem?

rkh commented 13 years ago

Yes, I will check if current master works with the Sinatra/Tilt test suits and investigate if it is still failing.

rkh commented 13 years ago

Tests pass. Keep up the great work!

saturnflyer commented 13 years ago

Thanks for checking!