private Method

Format.__do_break(line, next_line)

There's no documentation for this item.

Source Code

# File action_mailer/vendor/text-format-0.6.3/text/format.rb, line 825
def __do_break(line, next_line) #:nodoc:
  no_brk = false
  words = []
  words = line.split(/\s+/) unless line.nil?
  last_word = words[-1]

  @nobreak_regex.each { |k, v| no_brk = ((last_word =~ /#{k}/) and (next_line =~ /#{v}/)) }

  if no_brk && words.size > 1
    i = words.size
    while i > 0
      no_brk = false
      @nobreak_regex.each { |k, v| no_brk = ((words[i + 1] =~ /#{k}/) && (words[i] =~ /#{v}/)) }
      i -= 1
      break if not no_brk
    end
    if i > 0
      l = brk_re(i).match(line)
      line.sub!(brk_re(i), l[1])
      next_line = "#{l[2]} #{next_line}"
      line.sub!(/\s+$/, '')
    end
  end
  [line, next_line]
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.