<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Rakefile</filename>
    </added>
    <added>
      <filename>lib/prawnto/action_controller.rb</filename>
    </added>
    <added>
      <filename>lib/prawnto/template_handler.rb</filename>
    </added>
    <added>
      <filename>tasks/prawnto_tasks.rake</filename>
    </added>
    <added>
      <filename>test/action_controller_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,5 @@
 Copyright (c) 2008 cracklabs.com
- 
+
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 &quot;Software&quot;), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@ without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
- 
+
 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.
- 
+
 THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</diff>
      <filename>MIT-LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,12 @@
-prawnto
-----------------
+Prawnto
+=======
 
 a rails (2.1) plugin, providing templating abilities
 for generating pdf files leveraging the new kick-ass prawn library
 
 full documentation/demos at: http://cracklabs.com/prawnto
+
+
+
+
+Copyright (c) 2008 cracklabs.com, released under the MIT license</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 require 'prawnto'
 
 Mime::Type.register &quot;application/pdf&quot;, :pdf
-ActionView::Template.register_template_handler :prawn, Prawnto::Prawn
+ActionView::Template.register_template_handler :prawn, Prawnto::TemplateHandler
 </diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,72 +1,12 @@
 require 'prawn'
+require 'prawnto/action_controller'
+require 'prawnto/template_handler'
 
 
-module Prawnto
-
-  class Prawn &lt; ActionView::TemplateHandler
-    include ActionView::TemplateHandlers::Compilable
-
-    # snips out source code from dummy method below (used by compile method)
-    def self.template_setup_source
-      @@template_setup_source ||= 
-        begin
-          method = 'template_setup_source_container'
-          regex_s = '\s*def\s' + method + '\s*\n(.*\n)\s*end\s*\#+\s*' + method
-          source_regex = Regexp.new regex_s, Regexp::MULTILINE
-          source_regex.match(File.read(__FILE__))[1]
-        end
-    end
-
-    def self.line_offset
-      @@line_offset ||= (self.template_setup_source.count(&quot;\n&quot;) + 1)
-    end
-
-    # incorporates template into a string to be compiled (using a proc)
-    def compile(template)
-      setup_source = Prawn::template_setup_source
-
-      # what does following line do exactly?  not sure but copied it from builder implementation  -- no longer needed since only line with &quot;controller&quot; is flaky anyhow
-#      setup_source.gsub!(&quot;controller&quot;,&quot;controller.response&quot;) if @view.send!(:controller).respond_to?(:response)
-      
-      setup_source + 
-      &quot;pdf = Prawn::Document.new(@prawn_document_options)\n&quot; + 
-      template.source +
-      &quot;\npdf.render\n&quot;
-    end
-
-
-    # this is a dummy method to let me see code with editor's syntax goodness.
-    # it is erased immediately afterwards
-    # this method is never called, but instead the code is stripped out and pasted
-    # as code to be run by the caller of compile method
-    def template_setup_source_container
-      @prawn_document_options ||= {}
-
-      #TODO: check if this really makes sense-- kept around from railspdf, but maybe not needed?
-      ___pragma = 'no-cache'  # underscores are an attempt to avoid name clashes with user's local view variables
-      ___cache_control = 'no-cache, must-revalidate'
-      ___pragma = ___cache_control = '' if request.env['HTTP_USER_AGENT'] =~ /msie/i #keep ie happy (from railspdf-- no personal knowledge of these issues)
-      headers['Pragma'] ||= ___pragma
-      headers['Cache-Control'] ||= ___cache_control
-      
-      # controller.content_type ||= Mime::PDF
-      # for some reason above line is not working on subsequent requests for different pdfs, but the following does-- i have no clue?
-      headers['Content-Type'] ||= 'application/pdf'
-
-      attachment = @prawn_document_options.delete(:attachment)
-      filename = @prawn_document_options.delete(:filename)
-      attachment = attachment ? 'attachment' : 'inline'
-      filename = filename ? &quot;filename=#{filename}&quot; : nil
-      disposition = [attachment,filename].compact.join(';')
-
-      headers[&quot;Content-Disposition&quot;] ||= disposition if disposition.length &gt; 0
-      
-      #specify filename in controller otherwise will be inline
-      #TODO: verify attachment/inline behavior
-      #TODO: come up with solution for default naming (probably should just use railspdf way)
-
-    end  ### template_setup_source_container  &lt;--- keep comment there so i can use it to snip out this code easier
-    remove_method :template_setup_source_container
-    
-  end
+# for now applying to all Controllers
+# however, could reduce footprint by letting user mixin (i.e. include) only into controllers that need it
+# but would does it really matter performance wise to include in a controller that doesn't need it?  doubtful.
+class ActionController::Base
+  include Prawnto::ActionController
 end
+</diff>
      <filename>lib/prawnto.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/prawnto_test.rb</filename>
    </removed>
    <removed>
      <filename>test/test_helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>45b01cf9efa7b55651f20faf9a005e8b5c24f693</id>
    </parent>
  </parents>
  <author>
    <name>thorny_sun</name>
    <email>thorny_sun@cracklabs.com</email>
  </author>
  <url>http://github.com/thorny-sun/prawnto/commit/521ceb0987cdd95a60a50535a1bb775226c381a5</url>
  <id>521ceb0987cdd95a60a50535a1bb775226c381a5</id>
  <committed-date>2008-08-22T11:01:00-07:00</committed-date>
  <authored-date>2008-08-22T11:01:00-07:00</authored-date>
  <message>overhaul and some testing

- broke out prawn and prawnto options
- removed @prawn_document_options and instead using functions to dictate
options
- allowed option of dsl templates with locals
- some testing as well</message>
  <tree>7fc7062154bdd0408ca44a995aa91707b4ac9f35</tree>
  <committer>
    <name>thorny_sun</name>
    <email>thorny_sun@cracklabs.com</email>
  </committer>
</commit>
