Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

reorganizing code in dryopteris.rb, sanitize.rb and whitelist.rb.

  • Loading branch information...
commit 9023e925a06a78cc91242e9624b6646a20a07021 1 parent b91ca7a
Mike Dalessio flavorjones authored
7 lib/dryopteris.rb
View
@@ -1,7 +1,12 @@
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
+require 'rubygems'
+gem 'nokogiri', '>=1.2.4'
+require 'nokogiri'
+
+require "dryopteris/whitelist"
require "dryopteris/sanitize"
module Dryopteris
VERSION = '0.1'
-end
+end
16 lib/dryopteris/sanitize.rb
View
@@ -1,10 +1,5 @@
-require 'rubygems'
-gem 'nokogiri', '>=1.0.5'
-require 'nokogiri'
require 'cgi'
-require "dryopteris/whitelist"
-
module Dryopteris
class << self
@@ -177,15 +172,4 @@ def sanitize_css(style)
end # self
- module HashedWhiteList
- # turn each of the whitelist arrays into a hash for faster lookup
- WhiteList.constants.each do |constant|
- next unless WhiteList.module_eval("#{constant}").is_a?(Array)
- module_eval <<-CODE
- #{constant} = {}
- WhiteList::#{constant}.each { |c| #{constant}[c] = true ; #{constant}[c.downcase] = true }
- CODE
- end
- end
-
end
11 lib/dryopteris/whitelist.rb
View
@@ -145,4 +145,15 @@ module WhiteList
input
]
end
+
+ module HashedWhiteList
+ # turn each of the whitelist arrays into a hash for faster lookup
+ WhiteList.constants.each do |constant|
+ next unless WhiteList.module_eval("#{constant}").is_a?(Array)
+ module_eval <<-CODE
+ #{constant} = {}
+ WhiteList::#{constant}.each { |c| #{constant}[c] = true ; #{constant}[c.downcase] = true }
+ CODE
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.