<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/nagoro/wrap/stringscanner.rb</filename>
    </added>
    <added>
      <filename>spec/nagoro/pipe/include.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -118,7 +118,7 @@ end
 desc &quot;run rspec&quot;
 task :spec do
   engine = ENV['NAGORO_ENGINE']
-  %w[libxml rexml].each do |env|
+  %w[libxml rexml stringscanner].each do |env|
     puts
     puts &quot;Run specs for: #{env}&quot;.center(75)
     ENV['NAGORO_ENGINE'] = env</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -8,14 +8,11 @@ require 'benchmark'
 engine = ENV['NAGORO_ENGINE']
 
 Benchmark::bmbm(20) do |b|
-  b.report(&quot;REXML: &quot;) do
-    ENV['NAGORO_ENGINE'] = 'rexml'
-    system(&quot;ruby #{__FILE__} run&quot;)
-  end
-
-  b.report(&quot;libxml: &quot;) do
-    ENV['NAGORO_ENGINE'] = 'libxml'
-    system(&quot;ruby #{__FILE__} run&quot;)
+  %w[rexml libxml stringscanner].each do |engine|
+    b.report(&quot;#{engine}: &quot;) do
+      ENV['NAGORO_ENGINE'] = engine
+      system(&quot;ruby #{__FILE__} run&quot;)
+    end
   end
 end
 
@@ -23,9 +20,8 @@ ENV['NAGORO_ENGINE'] = engine
 
 __END__
 require 'nagoro'
-nagoro = Nagoro::Template[:Element, :Morph, :Include, :Instruction]
-string = '&lt;html&gt;&lt;div times=&quot;100&quot;&gt;&lt;?r a = 1 ?&gt;#{a}&lt;/div&gt;&lt;/html&gt;'
+string = '&lt;html&gt;&lt;div times=&quot;100&quot;&gt;&lt;?r a = 1 ?&gt;&lt;?ro a ?&gt;&lt;/div&gt;&lt;/html&gt;'
 n = 1_000
 n.times do
-  nagoro.render(string)
+  Nagoro.render(string)
 end</diff>
      <filename>bench.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,19 +26,14 @@ optp = OptionParser.new{|opt|
     puts opt
     exit
   end
-  opt.on('-r', '--rexml PATH', 'Path to REXML') do |r|
-    if File.file?(File.join(r, 'rexml/rexml.rb'))
-      options[:rexml] = r
-    else
-      puts &quot;REXML not found at: #{r}&quot;
-      exit 1
-    end
+  opt.on('-I', '--include PATH', 'Additional path for $LOAD_PATH') do |r|
+    options[:include] = r
   end
 }
 optp.parse!
 puts optp if ARGV.empty?
 
-if rexml = options[:rexml]
+if rexml = options[:include]
   $LOAD_PATH.unshift(rexml)
 end
 
@@ -69,13 +64,9 @@ end
 require 'nagoro'
 require 'rexml/document'
 
-pipes = [ :Element, :Morph, :Include, :Instruction ]
-template = ::Nagoro::Template[pipes]
-
 ARGV.each do |arg|
   if File.file?(arg)
-    nagoro = template.render_file(arg)
-    xhtml = nagoro.result(binding)
+    xhtml = Nagoro.render(arg, :binding =&gt; binding)
     doc = REXML::Document.new(xhtml)
 
     if options[:pretty_available]</diff>
      <filename>bin/nagoro</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,7 @@ require 'nagoro/pipe/compile'
 module Nagoro
   class &lt;&lt; self
     def load_libxml
-      require &quot;nagoro/wrap/libxml_reader&quot;
+      require &quot;nagoro/wrap/libxml&quot;
       :libxml
     end
 
@@ -41,6 +41,11 @@ module Nagoro
       require 'nagoro/wrap/rexml'
       :rexml
     end
+
+    def load_stringscanner
+      require 'nagoro/wrap/stringscanner'
+      :stringscanner
+    end
   end
 end
 </diff>
      <filename>lib/nagoro.rb</filename>
    </modified>
    <modified>
      <diff>@@ -90,9 +90,9 @@ module Nagoro
       end
 
       def preprocess
-        if @template.include?('#{')
-          @template.gsub!(/#\{((?![^\\]\})*|[^}]*)*\}/, '&lt;?ro \1 ?&gt;')
-        end
+        # if @template.include?('#{')
+        #   @template.gsub!(/#\{((?![^\\]\})*|[^}]*)*\}/, '&lt;?ro \1 ?&gt;')
+        # end
       end
 
       def reset</diff>
      <filename>lib/nagoro/pipe/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,6 @@ module Nagoro
       end
 
       def result
-        p @body
         &quot;_out_ = []; _out_ &lt;&lt; %Q`#{@body.join}`; _out_.join&quot;
       end
 </diff>
      <filename>lib/nagoro/pipe/compile.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ module Nagoro
     class Include &lt; Base
       def tag_start(tag, attrs)
         if tag == 'include'
-          filename = attrs.fetch('href', attrs.fetch('src'))
+          filename = attrs['href'] || attrs.fetch('src')
           append contents(filename)
         else
           super
@@ -24,6 +24,7 @@ module Nagoro
       def contents(file)
         open(file){|o| o.read.strip }
       rescue Errno::ENOENT, Errno::EISDIR =&gt; ex
+        warn ex.message
         &quot;&lt;!-- #{ex} --&gt;&quot;
       end
 </diff>
      <filename>lib/nagoro/pipe/include.rb</filename>
    </modified>
    <modified>
      <diff>@@ -41,7 +41,7 @@ module Nagoro
       DEFAULT = &quot;&lt;?%s %s ?&gt;&quot;
 
       def instruction(name, instruction)
-        instruction.strip!
+        instruction.to_s.strip!
 
         if custom = INSTRUCTIONS[name]
           @body &lt;&lt; custom % instruction</diff>
      <filename>lib/nagoro/pipe/instruction.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,10 +14,10 @@ describe 'Nagoro::Pipe::Compile' do
     render('&lt;?r a = 1 ?&gt;&lt;?ro a &gt; 1 ?&gt;').should == 'false'
     render('&lt;?r a = 1 ?&gt;&lt;?ro a &lt; 1 ?&gt;').should == 'false'
   end
-
-  it 'should compile with compatiblity to Ezamar' do
-    render('&lt;?r a = 1 ?&gt;#{a}').should == '1'
-    render('&lt;?r a = 1 ?&gt;#{a &gt; 1}').should == 'false'
-    render('&lt;?r a = 1 ?&gt;#{a &lt; 1}').should == 'false'
-  end
+# 
+#   it 'should compile with compatiblity to Ezamar' do
+#     render('&lt;?r a = 1 ?&gt;#{a}').should == '1'
+#     render('&lt;?r a = 1 ?&gt;#{a &gt; 1}').should == 'false'
+#     render('&lt;?r a = 1 ?&gt;#{a &lt; 1}').should == 'false'
+#   end
 end</diff>
      <filename>spec/nagoro/pipe/compile.rb</filename>
    </modified>
    <modified>
      <diff>@@ -27,17 +27,17 @@ describe 'Nagoro::Pipe::Instruction' do
 
   it 'should morph for' do
     compile('&lt;p for=&quot;i in 1..10&quot;&gt;#{i}&lt;/p&gt;').
-      should == '&lt;?r for i in 1..10 ?&gt;&lt;p&gt;&lt;?ro i ?&gt;&lt;/p&gt;&lt;?r end ?&gt;'
+      should == '&lt;?r for i in 1..10 ?&gt;&lt;p&gt;#{i}&lt;/p&gt;&lt;?r end ?&gt;'
   end
 
   it 'should morph each' do
     compile('&lt;p each=&quot;1..10&quot;&gt;#{_e}&lt;/p&gt;').
-      should == '&lt;?r 1..10.each do |_e| ?&gt;&lt;p&gt;&lt;?ro _e ?&gt;&lt;/p&gt;&lt;?r end ?&gt;'
+      should == '&lt;?r 1..10.each do |_e| ?&gt;&lt;p&gt;#{_e}&lt;/p&gt;&lt;?r end ?&gt;'
   end
 
   it 'should morph times' do
     compile('&lt;p times=&quot;3&quot;&gt;#{_t}&lt;/p&gt;').
-      should == '&lt;?r 3.times do |_t| ?&gt;&lt;p&gt;&lt;?ro _t ?&gt;&lt;/p&gt;&lt;?r end ?&gt;'
+      should == '&lt;?r 3.times do |_t| ?&gt;&lt;p&gt;#{_t}&lt;/p&gt;&lt;?r end ?&gt;'
   end
 
   it 'should morph filter' do</diff>
      <filename>spec/nagoro/pipe/morph.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>51887e0f71d0c367c4e29b0255333eec06691b1b</id>
    </parent>
  </parents>
  <author>
    <name>Michael Fellinger</name>
    <email>m.fellinger@gmail.com</email>
  </author>
  <url>http://github.com/manveru/nagoro/commit/8d89b885ae38075baed92b54775a5f9a7edbff6a</url>
  <id>8d89b885ae38075baed92b54775a5f9a7edbff6a</id>
  <committed-date>2007-12-25T04:28:00-08:00</committed-date>
  <authored-date>2007-12-25T04:28:00-08:00</authored-date>
  <message>Adding StringScanner wrapper, fastest and most flexible so far, but might need more patches.

darcs-hash:20071225122823-cbc08-e57296c7e263f0a7788715835a4d9752eae30fd3.gz</message>
  <tree>9cb232bfac73e6da57b022a3fa72068f6933e530</tree>
  <committer>
    <name>Michael Fellinger</name>
    <email>m.fellinger@gmail.com</email>
  </committer>
</commit>
