Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

I fixed bug for Chinese content. #2

Merged
merged 2 commits into from
May 4, 2011
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix bug when process Chinese words.
  • Loading branch information
huacnlee committed Apr 22, 2011
commit 1bb1385eac7f033a4104bbb3e446e6b38849c9fb
7 changes: 5 additions & 2 deletions lib/htmldiff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def wrap_text(text, tagname, cssclass)
end

def explode(sequence)
sequence.is_a?(String) ? sequence.split(//) : sequence
sequence.is_a?(String) ? sequence.split("") : sequence
end

def end_of_tag?(char)
Expand Down Expand Up @@ -284,8 +284,11 @@ def convert_html_to_list_of_words(x, use_brackets = false)
words << current_word unless current_word.empty?
current_word = char
mode = :whitespace
else
elsif /[\w,\.!@#\$%\^&\*\(\)\[\]{}\-\+=:;\']+/i.match char
current_word << char
else
words << current_word unless current_word.empty?
current_word = char
end
when :whitespace
if start_of_tag? char
Expand Down