Update to Rails 2.3.9 and itextomml 1.3.27

This commit is contained in:
Jacques Distler 2010-09-05 15:24:15 -05:00
parent 113e0af736
commit ef30cc22df
200 changed files with 3065 additions and 1204 deletions

View file

@ -877,9 +877,9 @@ module ActionView
def value_before_type_cast(object, method_name)
unless object.nil?
object.respond_to?(method_name + "_before_type_cast") ?
object.send(method_name + "_before_type_cast") :
object.send(method_name)
object.respond_to?(method_name) ?
object.send(method_name) :
object.send(method_name + "_before_type_cast")
end
end

View file

@ -481,7 +481,7 @@ module ActionView
end
zone_options += options_for_select(convert_zones[zones], selected)
zone_options
zone_options.html_safe
end
private

View file

@ -440,7 +440,7 @@ module ActionView
private
def html_options_for_form(url_for_options, options, *parameters_for_url)
returning options.stringify_keys do |html_options|
options.stringify_keys.tap do |html_options|
html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart")
html_options["action"] = url_for(url_for_options, *parameters_for_url)
end

View file

@ -653,7 +653,7 @@ module ActionView
# <script> tag.
module GeneratorMethods
def to_s #:nodoc:
returning javascript = @lines * $/ do
(@lines * $/).tap do |javascript|
if ActionView::Base.debug_rjs
source = javascript.dup
javascript.replace "try {\n#{source}\n} catch (e) "
@ -981,8 +981,8 @@ module ActionView
end
def record(line)
returning line = "#{line.to_s.chomp.gsub(/\;\z/, '')};" do
self << line
"#{line.to_s.chomp.gsub(/\;\z/, '')};".tap do |_line|
self << _line
end
end

View file

@ -532,9 +532,14 @@ module ActionView
end
AUTO_LINK_RE = %r{
( https?:// | www\. )
(?: ([\w+.:-]+:)// | www\. )
[^\s<]+
}x unless const_defined?(:AUTO_LINK_RE)
}x
# regexps for determining context, used high-volume
AUTO_LINK_CRE = [/<[^>]+$/, /^[^>]*>/, /<a\b.*?>/i, /<\/a>/i]
AUTO_EMAIL_RE = /[\w.!#\$%+-]+@[\w-]+(?:\.[\w-]+)+/
BRACKETS = { ']' => '[', ')' => '(', '}' => '{' }
@ -543,26 +548,26 @@ module ActionView
def auto_link_urls(text, html_options = {})
link_attributes = html_options.stringify_keys
text.gsub(AUTO_LINK_RE) do
href = $&
punctuation = ''
left, right = $`, $'
# detect already linked URLs and URLs in the middle of a tag
if left =~ /<[^>]+$/ && right =~ /^[^>]*>/
scheme, href = $1, $&
punctuation = []
if auto_linked?($`, $')
# do not change string; URL is already linked
href
else
# don't include trailing punctuation character as part of the URL
if href.sub!(/[^\w\/-]$/, '') and punctuation = $& and opening = BRACKETS[punctuation]
if href.scan(opening).size > href.scan(punctuation).size
href << punctuation
punctuation = ''
while href.sub!(/[^\w\/-]$/, '')
punctuation.push $&
if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size
href << punctuation.pop
break
end
end
link_text = block_given?? yield(href) : href
href = 'http://' + href unless href =~ %r{^[a-z]+://}i
href = 'http://' + href unless scheme
content_tag(:a, h(link_text), link_attributes.merge('href' => href)) + punctuation
content_tag(:a, h(link_text), link_attributes.merge('href' => href)) + punctuation.reverse.join('')
end
end
end
@ -570,11 +575,10 @@ module ActionView
# Turns all email addresses into clickable links. If a block is given,
# each email is yielded and the result is used as the link text.
def auto_link_email_addresses(text, html_options = {})
body = text.dup
text.gsub(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
text = $1
text.gsub(AUTO_EMAIL_RE) do
text = $&
if body.match(/<a\b[^>]*>(.*)(#{Regexp.escape(text)})(.*)<\/a>/)
if auto_linked?($`, $')
text
else
display_text = (block_given?) ? yield(text) : text
@ -582,6 +586,12 @@ module ActionView
end
end
end
# Detects already linked context or position in the middle of a tag
def auto_linked?(left, right)
(left =~ AUTO_LINK_CRE[0] and right =~ AUTO_LINK_CRE[1]) or
(left.rindex(AUTO_LINK_CRE[2]) and $' !~ AUTO_LINK_CRE[3])
end
end
end
end

View file

@ -63,37 +63,37 @@
half_a_minute: "half a minute"
less_than_x_seconds:
one: "less than 1 second"
other: "less than {{count}} seconds"
other: "less than %{count} seconds"
x_seconds:
one: "1 second"
other: "{{count}} seconds"
other: "%{count} seconds"
less_than_x_minutes:
one: "less than a minute"
other: "less than {{count}} minutes"
other: "less than %{count} minutes"
x_minutes:
one: "1 minute"
other: "{{count}} minutes"
other: "%{count} minutes"
about_x_hours:
one: "about 1 hour"
other: "about {{count}} hours"
other: "about %{count} hours"
x_days:
one: "1 day"
other: "{{count}} days"
other: "%{count} days"
about_x_months:
one: "about 1 month"
other: "about {{count}} months"
other: "about %{count} months"
x_months:
one: "1 month"
other: "{{count}} months"
other: "%{count} months"
about_x_years:
one: "about 1 year"
other: "about {{count}} years"
other: "about %{count} years"
over_x_years:
one: "over 1 year"
other: "over {{count}} years"
other: "over %{count} years"
almost_x_years:
one: "almost 1 year"
other: "almost {{count}} years"
other: "almost %{count} years"
prompts:
year: "Year"
month: "Month"
@ -106,12 +106,12 @@
errors:
template:
header:
one: "1 error prohibited this {{model}} from being saved"
other: "{{count}} errors prohibited this {{model}} from being saved"
one: "1 error prohibited this %{model} from being saved"
other: "%{count} errors prohibited this %{model} from being saved"
# The variable :count is also available
body: "There were problems with the following fields:"
support:
select:
# default value for :prompt => true in FormOptionsHelper
prompt: "Please select"
prompt: "Please select"

View file

@ -45,8 +45,8 @@ module ActionView #:nodoc:
end
def self.new_and_loaded(path)
returning new(path) do |path|
path.load!
new(path).tap do |_path|
_path.load!
end
end