Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Try to be more subtle for the new line convertions
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Feb 19, 2011
1 parent f504a0e commit 3293800
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
TPL = Sequel.mysql2(cfg['templeet'])
TPL.run('set names latin1')
ROR = Sequel.mysql2(cfg['rails'])
RED = Redis.new
RED = Redis.new(:host => `hostname`)

$sanitizer = HTML::WhiteListSanitizer.new
$sanitizer.allowed_tags.merge %w(q u s table tr td th video)
Expand Down
4 changes: 3 additions & 1 deletion lib/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def nl2br(txt)
return '' if txt.nil?
txt = txt.force_encoding('utf-8')
begin
txt.gsub(/\n/, "<br/>\n").gsub(/(<\/?)acronym/, '\1abbr')
tmp = txt.gsub(/(<\/?)acronym/, '\1abbr')
return tmp if tmp =~ /<br\s*\/>/
tmp.gsub(/\n/, "<br/>\n")
rescue ArgumentError
txt = txt.force_encoding("iso-8859-15").encode("utf-8")
retry
Expand Down

0 comments on commit 3293800

Please sign in to comment.