Commit Graph

154 Commits

Author SHA1 Message Date
José Valim
a9b72fbc9e Optimize the most common resolver case. 2011-05-09 11:17:24 +02:00
José Valim
4f03e404b2 No need for replace. 2011-05-09 10:42:54 +02:00
Burke Libbey
06671c37de Added activesupport requires for Array.wrap in previously modified files 2011-05-07 18:30:50 -05:00
Burke Libbey
4c4d5c7e6c Remove redundant check for is_a?(String) 2011-05-06 15:28:31 -05:00
Burke Libbey
156039c4cf Added a test for MissingTemplate change, and changed to use Array.wrap() as
requested by josevalim.
2011-05-06 14:02:31 -05:00
Burke Libbey
30d49d001e Made ActionView::MissingTemplate#initialize optionally accept a single string
prefix to be converted to an array as in ActionView::PathSet#find_all.
2011-05-06 12:42:27 -05:00
José Valim
e30ca001ef Yo dawg, I heard you like streaming. So I put a fiber, inside a block, inside a body, so you can stream. 2011-04-16 10:28:47 +02:00
José Valim
2dd43c3f80 Buffer should be an option passed down to template rendering. 2011-04-16 02:10:36 +02:00
Xavier Noria
404ae77c40 removes a remaining reference to .rjs in template resolver's RDoc 2011-04-13 13:24:32 +02:00
Xavier Noria
5850f16935 removes the RJS template handler 2011-04-13 13:23:18 +02:00
Akira Matsuda
bd3cdeea35 s/ERb/ERB/g
The author of ERB sais, his eRuby implementation was originally named "ERb/ERbLight" and then renamed to "ERB" when started bundled as a Ruby standard lib.
http://www2a.biglobe.ne.jp/~seki/ruby/erb.html
2011-04-03 12:47:51 +09:00
Xavier Noria
b2d94322e6 fixes a couple of regexps, the suite showed warnings about them
A couple of things worth mentioning here:

 - "{" is a metacharacter, should be escaped
   if it is meant to match a "{". The code
   worked, though, because the regexp engine
   is tolerant to this, but issued warnings.

 - gsub accepts a string as first argument.
   That's the best idiom to use when your
   pattern has no metacharacters, since gsub
   interprets the string as an exact substring
   to look for, rather than a regexp. The
   benefit is that your pattern is crystal
   clear and needs no backslashes.
2011-03-27 20:45:23 +02:00
José Valim
1413c9b1d5 Improved resolver docs a bit 2011-03-19 16:06:50 -07:00
Chris Kowalik
d76fadbd7d [action_view] docs for FileSystemResolver 2011-03-20 07:01:47 +08:00
Chris Kowalik
de1fe5e8a7 [action_view] added custom patterns to template resolver 2011-03-20 07:01:46 +08:00
Mike Gehard
58de03f077 Add additional text to NotImplementedErrors [#6328 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-12 13:43:23 -02:00
R.T. Lechow
87e9e3f9af Action Pack typos. 2011-03-05 11:56:35 +01:00
Aaron Patterson
c9182597ca reduce string append funcalls 2011-02-08 16:18:37 -08:00
José Valim
b93c590297 Ensure render is case sensitive even on systems with case-insensitive filesystems.
This fixes CVE-2011-0449
2011-02-08 14:04:19 -08:00
Aaron Patterson
54de7048a5 Merge branch 'template_error' into merge
* template_error:
  Ensure original exception message is present in both Template::Error#message and Template::Error#inspect.
  ActiveSupport::Deprecation.silence no longer needed.
2011-01-18 10:52:37 -08:00
wycats
7c568fda6b A bunch of cleanup on the inherited template patch 2010-12-26 23:44:51 -08:00
Piotr Sarnacki
e89fff2f6b Bring back config.action_view.cache_template_loading [#5847 state:resolved] 2010-12-16 22:24:48 +01:00
José Valim
d3f7e565d1 Ensure resolvers backward compatibility. 2010-12-09 14:06:44 +01:00
José Valim
ba63c0a9b5 Deprecate handler_class_for_extension as template handlers can be any Ruby object, not necessarily a class. 2010-12-01 11:22:48 +01:00
Michael Koziarski
9ecaa80300 Make safe_append= live on AV::OutputBuffer not AS::SafeBuffer
Conflicts:

	actionpack/lib/action_view/template/handlers/erb.rb
2010-11-08 10:10:30 +13:00
Jan Maurits Faber
f04ec6a227 Added support for Erubis <%== tag
<%== x %> is syntactic sugar for <%= raw(x) %>

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#5918 status:committed]
2010-11-08 09:55:55 +13:00
John Firebaugh
403b06e98e Ensure original exception message is present in both Template::Error#message and Template::Error#inspect.
Previously, #inspect would produce #<ActionView::Template::Error: ActionView::Template::Error>, which is not very useful.
2010-10-29 15:27:19 -07:00
John Firebaugh
7bbad753e2 ActiveSupport::Deprecation.silence no longer needed. 2010-10-29 15:27:19 -07:00
José Valim
01ab6f961b Remove :cache => true on lookup templates initialization. 2010-10-14 09:47:49 +02:00
José Valim
aa508c9baf SReorganize autoloads slightly and move two files to lib/action_view root. 2010-10-14 09:32:53 +02:00
José Valim
5ec27189b8 Do not allow templates coming from Fallback resolvers to store a virtual path. 2010-10-10 23:12:23 +02:00
José Valim
682368d4ba Use identifiers for template equality. 2010-10-10 23:12:22 +02:00
José Valim
38d78f99d5 Resolvers now consider timestamps.
Before this patch, every request in development caused the template
to be compiled, regardless if it was updated in the filesystem or not.
This patch now checks the timestamp and only compiles it again if
any change was done.

While this probably won't show any difference for current setups,
but it will be useful for asset template handlers (like SASS), as
compiling their templates is slower than ERb, Haml, etc.
2010-10-10 09:26:53 +02:00
José Valim
c7408a0e40 Deprecate old template handler API. Remove old handlers. 2010-10-10 01:14:50 +02:00
José Valim
b2600bfc18 Remove locals dependency from template.
This means that templates does not need to store its source anymore, allowing us to reduce the ammount of memory taken by our Rails processes. Naively speaking, if your app/views contains 2MB of files, each of your processes (after being hit by a bunch of requests) will take 2MB less of memory after this commit.

This is extremely important for the upcoming features. Since Rails will also render CSS and JS files, their source won't be stored as well allowing us to decrease the ammount of memory taken.
2010-10-07 21:31:31 +02:00
José Valim
243513f4d1 Get rid of ruby warnings in Resolvers. Move a few methods up to the abstract class. 2010-10-07 16:46:12 +02:00
John Firebaugh
6644675831 Template::Error is also used if rendering fails. 2010-10-04 11:12:57 -07:00
Emilio Tagua
357f59447d Initialize @path. 2010-09-28 18:20:54 -03:00
Emilio Tagua
04c4f47fed Initialize @sub_templates 2010-09-28 15:33:48 -03:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d.
2010-09-02 21:11:03 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
José Valim
ba52748d05 Remove deprecated support to <% form_for %> and several ActionController::Base methods. 2010-08-29 21:08:14 -03:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
José Valim
69abbe8934 Avoid using Pathname on Resolver and AS::Dependencies. 2010-06-24 01:06:37 +02:00
Rizwan Reza
ab7830d66c Final touches and fixes. 2010-06-21 00:56:31 +04:30
wycats
a6b3942843 Optimize LookupContext 2010-06-04 20:11:06 -07:00
wycats
0078df6b54 Update template to allow handlers to more cleanly handle encodings (ht: nex3) 2010-05-30 11:37:35 +02:00
wycats
02c36cf5cb Make sure encoding changes don't break 1.8 2010-05-17 19:39:38 +04:00
wycats
64d109e353 Significantly improved internal encoding heuristics and support.
* Default Encoding.default_internal to UTF-8
* Eliminated the use of file-wide magic comments to coerce code evaluated inside the file
* Read templates as BINARY, use default_external or template-wide magic comments
  inside the Template to set the initial encoding
  * This means that template handlers in Ruby 1.9 will receive Strings encoded
    in default_internal (UTF-8 by default)
* Create a better Exception for encoding issues, and use it when the template
  source has bytes that are not compatible with the specified encoding
* Allow template handlers to opt-into handling BINARY. If they do so, they
  need to do some of their own manual encoding work
* Added a "Configuration Gotchas" section to the intro Rails Guide instructing
  users to use UTF-8 for everything
* Use config.encoding= in Ruby 1.8, and raise if a value that is an invalid
  $KCODE value is used

Also:
* Fixed a few tests that were assert() rather than assert_equal() and
  were caught by Minitest requiring a String for the message
* Fixed a test where an assert_select was misformed, also caught by
  Minitest being more restrictive
* Fixed a test where a Rack response was returning a String rather
  than an Enumerable
2010-05-16 22:44:43 +04:00
wycats
af0d1a8815 Initial work to improve the state of encodings for templates 2010-05-16 22:43:35 +04:00