Update to Rails 2.3.9 and itextomml 1.3.27
This commit is contained in:
parent
113e0af736
commit
ef30cc22df
200 changed files with 3065 additions and 1204 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ module ActionView
|
|||
end
|
||||
|
||||
zone_options += options_for_select(convert_zones[zones], selected)
|
||||
zone_options
|
||||
zone_options.html_safe
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue