diff --git a/vendor/gems/acts_as_versioned-0.2.3/CHANGELOG b/vendor/gems/acts_as_versioned-0.2.3/CHANGELOG deleted file mode 100644 index 5cbe1aa..0000000 --- a/vendor/gems/acts_as_versioned-0.2.3/CHANGELOG +++ /dev/null @@ -1,39 +0,0 @@ -*0.2.3* - -* (12 Nov 2005) fixed bug with old behavior of #blank? [Michael Schuerig] -* (12 Nov 2005) updated tests to use ActiveRecord Schema - -*0.2.2* - -* (3 Nov 2005) added documentation note to #acts_as_versioned [Martin Jul] - -*0.2.1* - -* (6 Oct 2005) renamed dirty? to changed? to keep it uniform. it was aliased to keep it backwards compatible. - -*0.2* - -* (6 Oct 2005) added find_versions and find_version class methods. - -* (6 Oct 2005) removed transaction from create_versioned_table(). - this way you can specify your own transaction around a group of operations. - -* (30 Sep 2005) fixed bug where find_versions() would order by 'version' twice. (found by Joe Clark) - -* (26 Sep 2005) added :sequence_name option to acts_as_versioned to set the sequence name on the versioned model - -*0.1.3* (18 Sep 2005) - -* First RubyForge release - -*0.1.2* - -* check if module is already included when acts_as_versioned is called - -*0.1.1* - -* Adding tests and rdocs - -*0.1* - -* Initial transfer from Rails ticket: http://dev.rubyonrails.com/ticket/1974 \ No newline at end of file diff --git a/vendor/gems/acts_as_versioned-0.2.3/init.rb b/vendor/gems/acts_as_versioned-0.2.3/init.rb deleted file mode 100644 index d8a8e33..0000000 --- a/vendor/gems/acts_as_versioned-0.2.3/init.rb +++ /dev/null @@ -1,3 +0,0 @@ - - require File.join(File.dirname(__FILE__), 'lib', 'acts_as_versioned') - diff --git a/vendor/gems/acts_as_versioned-0.2.3/lib/acts_as_versioned.rb b/vendor/gems/acts_as_versioned-0.2.3/lib/acts_as_versioned.rb deleted file mode 100644 index eb5a70c..0000000 --- a/vendor/gems/acts_as_versioned-0.2.3/lib/acts_as_versioned.rb +++ /dev/null @@ -1,401 +0,0 @@ -# Copyright (c) 2005 Rick Olson -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -module ActiveRecord #:nodoc: - module Acts #:nodoc: - # Specify this act if you want to save a copy of the row in a versioned table. This assumes there is a - # versioned table ready and that your model has a version field. This works with optimisic locking if the lock_version - # column is present as well. - # - # The class for the versioned model is derived the first time it is seen. Therefore, if you change your database schema you have to restart - # your container for the changes to be reflected. In development mode this usually means restarting WEBrick. - # - # class Page < ActiveRecord::Base - # # assumes pages_versions table - # acts_as_versioned - # end - # - # Example: - # - # page = Page.create(:title => 'hello world!') - # page.version # => 1 - # - # page.title = 'hello world' - # page.save - # page.version # => 2 - # page.versions.size # => 2 - # - # page.revert_to(1) # using version number - # page.title # => 'hello world!' - # - # page.revert_to(page.versions.last) # using versioned instance - # page.title # => 'hello world' - # - # See ActiveRecord::Acts::Versioned::ClassMethods#acts_as_versioned for configuration options - module Versioned - def self.included(base) # :nodoc: - base.extend ClassMethods - end - - module ClassMethods - # == Configuration options - # - # * class_name - versioned model class name (default: PageVersion in the above example) - # * table_name - versioned model table name (default: page_versions in the above example) - # * foreign_key - foreign key used to relate the versioned model to the original model (default: page_id in the above example) - # * inheritance_column - name of the column to save the model's inheritance_column value for STI. (default: versioned_type) - # * version_column - name of the column in the model that keeps the version number (default: version) - # * sequence_name - name of the custom sequence to be used by the versioned model. - # * limit - number of revisions to keep, defaults to unlimited - # * if - symbol of method to check before saving a new version. If this method returns false, a new version is not saved. - # For finer control, pass either a Proc or modify Model#version_condition_met? - # - # acts_as_versioned :if => Proc.new { |auction| !auction.expired? } - # - # or... - # - # class Auction - # def version_condition_met? # totally bypasses the :if option - # !expired? - # end - # end - # - # * if_changed - Simple way of specifying attributes that are required to be changed before saving a model. This takes - # either a symbol or array of symbols. - # - # == Database Schema - # - # The model that you're versioning needs to have a 'version' attribute. The model is versioned - # into a table called #{model}_versions where the model name is singlular. The _versions table should - # contain all the fields you want versioned, the same version column, and a #{model}_id foreign key field. - # - # A lock_version field is also accepted if your model uses Optimistic Locking. If your table uses Single Table inheritance, - # then that field is reflected in the versioned model as 'versioned_type' by default. - # - # Acts_as_versioned comes prepared with the ActiveRecord::Acts::Versioned::ActMethods::ClassMethods#create_versioned_table - # method, perfect for a migration. It will also create the version column if the main model does not already have it. - # - # class AddVersions < ActiveRecord::Migration - # def self.up - # # create_versioned_table takes the same options hash - # # that create_table does - # Post.create_versioned_table - # end - # - # def self.down - # Post.drop_versioned_table - # end - # end - def acts_as_versioned(options = {}) - # don't allow multiple calls - return if self.included_modules.include?(ActiveRecord::Acts::Versioned::ActMethods) - - class_eval do - include ActiveRecord::Acts::Versioned::ActMethods - cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name, :versioned_inheritance_column, - :version_column, :max_version_limit, :track_changed_attributes, :version_condition, :version_sequence_name - attr_accessor :changed_attributes - end - - self.versioned_class_name = options[:class_name] || "#{self.to_s.demodulize}Version" - self.versioned_foreign_key = options[:foreign_key] || self.to_s.foreign_key - self.versioned_table_name = options[:table_name] || "#{table_name_prefix}#{Inflector.underscore(Inflector.demodulize(class_name_of_active_record_descendant(self)))}_versions#{table_name_suffix}" - self.versioned_inheritance_column = options[:inheritance_column] || "versioned_#{inheritance_column}" - self.version_column = options[:version_column] || 'version' - self.version_sequence_name = options[:sequence_name] - self.max_version_limit = options[:limit].to_i - self.version_condition = options[:if] || true - - class_eval do - has_many :versions, - :class_name => "ActiveRecord::Acts::Versioned::#{versioned_class_name}", - :foreign_key => "#{versioned_foreign_key}", - :order => 'version' - before_save :set_new_version - after_create :save_version_on_create - after_update :save_version - after_save :clear_old_versions - after_save :clear_changed_attributes - - unless options[:if_changed].nil? - self.track_changed_attributes = true - options[:if_changed] = [options[:if_changed]] unless options[:if_changed].is_a?(Array) - options[:if_changed].each do |attr_name| - define_method("#{attr_name}=") do |value| - (self.changed_attributes ||= []) << attr_name.to_s unless self.changed?(attr_name) or self.send(attr_name) == value - write_attribute(attr_name.to_s, value) - end - end - end - end - - # create the dynamic versioned model - # maybe if i sit down long enough i can think up a better way to do this. - dynamic_model = <<-EOV - class ActiveRecord::Acts::Versioned::#{versioned_class_name} < ActiveRecord::Base - set_table_name "#{versioned_table_name}" - belongs_to :#{self.to_s.demodulize.underscore}, :class_name => "#{self.to_s}" - EOV - - dynamic_model += %Q{set_sequence_name "#{version_sequence_name}"\n} if version_sequence_name - - eval dynamic_model + 'end' - end - end - - module ActMethods - def self.included(base) # :nodoc: - base.extend ClassMethods - end - - # Saves a version of the model if applicable - def save_version - save_version_on_create if save_version? - end - - # Saves a version of the model in the versioned table. This is called in the after_save callback by default - def save_version_on_create - rev = self.class.versioned_class.new - self.clone_versioned_model(self, rev) - rev.version = send(self.class.version_column) - rev.send("#{self.class.versioned_foreign_key}=", self.id) - rev.save - end - - # Clears old revisions if a limit is set with the :limit option in acts_as_versioned. - # Override this method to set your own criteria for clearing old versions. - def clear_old_versions - return if self.class.max_version_limit == 0 - excess_baggage = send(self.class.version_column).to_i - self.class.max_version_limit - if excess_baggage > 0 - sql = "DELETE FROM #{self.class.versioned_table_name} WHERE version <= #{excess_baggage} AND #{self.class.versioned_foreign_key} = #{self.id}" - self.class.versioned_class.connection.execute sql - end - end - - # Finds a specific version of this model. - def find_version(version) - return version if version.is_a?(self.class.versioned_class) - return nil if version.is_a?(ActiveRecord::Base) - find_versions(:conditions => ['version = ?', version], :limit => 1).first - end - - # Finds versions of this model. Takes an options hash like find - def find_versions(options = {}) - versions.find(:all, options) - end - - # Reverts a model to a given version. Takes either a version number or an instance of the versioned model - def revert_to(version) - if version.is_a?(self.class.versioned_class) - return false unless version.send(self.class.versioned_foreign_key) == self.id and !version.new_record? - else - return false unless version = find_version(version) - end - self.clone_versioned_model(version, self) - self.send("#{self.class.version_column}=", version.version) - true - end - - # Reverts a model to a given version and saves the model. - # Takes either a version number or an instance of the versioned model - def revert_to!(version) - revert_to(version) ? save_without_revision : false - end - - # Temporarily turns off Optimistic Locking while saving. Used when reverting so that a new version is not created. - def save_without_revision - old_lock_value = ActiveRecord::Base.lock_optimistically - ActiveRecord::Base.lock_optimistically = false if old_lock_value - disable_acts_as_versioned_callbacks - save_result = self.save - enable_acts_as_versioned_callbacks - ActiveRecord::Base.lock_optimistically = true if old_lock_value - save_result - end - - # Returns an array of attribute keys that are versioned. See non_versioned_fields - def versioned_attributes - self.attributes.keys.select { |k| !self.class.non_versioned_fields.include?(k) } - end - - # If called with no parameters, gets whether the current model has changed and needs to be versioned. - # If called with a single parameter, gets whether the parameter has changed. - def changed?(attr_name = nil) - attr_name.nil? ? - (!self.class.track_changed_attributes or (changed_attributes and changed_attributes.length > 0)) : - (changed_attributes and changed_attributes.include?(attr_name.to_s)) - end - - # keep old dirty? method - alias_method :dirty?, :changed? - - # Clones a model. Used when saving a new version or reverting a model's version. - def clone_versioned_model(orig_model, new_model) - self.versioned_attributes.each do |key| - new_model.send("#{key}=", orig_model.attributes[key]) if orig_model.attribute_present?(key) - end - - if orig_model.is_a?(self.class.versioned_class) - new_model[new_model.class.inheritance_column] = orig_model[self.class.versioned_inheritance_column] - elsif new_model.is_a?(self.class.versioned_class) - new_model[self.class.versioned_inheritance_column] = orig_model[orig_model.class.inheritance_column] - end - end - - # Checks whether a new version shall be saved or not. Calls version_condition_met? and changed?. - def save_version? - version_condition_met? and changed? - end - - # Checks condition set in the :if option to check whether a revision should be created or not. Override this for - # custom version condition checking. - def version_condition_met? - case - when version_condition.is_a?(Symbol) - send(version_condition) - when version_condition.respond_to?(:call) && (version_condition.arity == 1 || version_condition.arity == -1) - version_condition.call(self) - else - version_condition - end - end - - def previous_version(current_version = self.version) - self.versions.find(:first, :conditions => [ 'version < ?', current_version ], :order => 'version desc') - end - - protected - # sets the new version before saving, unless you're using optimistic locking. In that case, let it take care of the version. - def set_new_version - self.send("#{self.class.version_column}=", self.next_version) if new_record? or (!locking_enabled? and save_version?) - end - - # Gets the next available version for the current record, or 1 for a new record - def next_version - return 1 if new_record? - connection.select_one("SELECT MAX(version)+1 AS next_version FROM #{self.class.versioned_table_name} WHERE #{self.class.versioned_foreign_key} = #{self.id}")['next_version'] || 1 - end - - # clears current changed attributes. Called after save. - def clear_changed_attributes - self.changed_attributes = [] - end - - private - unless defined?(ACTS_AS_VERSIONED_CALLBACKS) - ACTS_AS_VERSIONED_CALLBACKS = [:set_new_version, :save_version_on_create, :save_version, :clear_changed_attributes] - end - - ACTS_AS_VERSIONED_CALLBACKS.each do |attr_name| - alias_method "orig_#{attr_name}".to_sym, attr_name - end - - def empty_callback() end #:nodoc: - - def enable_acts_as_versioned_callbacks - self.class.class_eval do - ACTS_AS_VERSIONED_CALLBACKS.each do |attr_name| - alias_method attr_name, "orig_#{attr_name}".to_sym - end - end - end - - def disable_acts_as_versioned_callbacks - self.class.class_eval do - ACTS_AS_VERSIONED_CALLBACKS.each do |attr_name| - alias_method attr_name, :empty_callback - end - end - end - - module ClassMethods - # Finds a specific version of a specific row of this model - def find_version(id, version) - find_versions(id, - :conditions => ["#{versioned_foreign_key} = ? AND version = ?", id, version], - :limit => 1).first - end - - # Finds versions of a specific model. Takes an options hash like find - def find_versions(id, options = {}) - versioned_class.find :all, { - :conditions => ["#{versioned_foreign_key} = ?", id], - :order => 'version' }.merge(options) - end - - # Returns an array of columns that are versioned. See non_versioned_fields - def versioned_columns - self.columns.select { |c| !non_versioned_fields.include?(c.name) } - end - - # Returns an instance of the dynamic versioned model - def versioned_class - "ActiveRecord::Acts::Versioned::#{versioned_class_name}".constantize - end - - # An array of fields that are not saved in the versioned table - def non_versioned_fields - [self.primary_key, inheritance_column, 'version', 'lock_version', versioned_inheritance_column] - end - - # Rake migration task to create the versioned table using options passed to acts_as_versioned - def create_versioned_table(create_table_options = {}) - # create version column in main table if it does not exist - if !self.content_columns.find { |c| %w(version lock_version).include? c.name } - self.connection.add_column table_name, :version, :integer - end - - self.connection.create_table(versioned_table_name, create_table_options) do |t| - t.column versioned_foreign_key, :integer - t.column :version, :integer - end - - updated_col = nil - self.versioned_columns.each do |col| - updated_col = col if !updated_col and %(updated_at updated_on).include?(col.name) - self.connection.add_column versioned_table_name, col.name, col.type, - :limit => col.limit, - :default => col.default - end - - if type_col = self.columns_hash[inheritance_column] - self.connection.add_column versioned_table_name, versioned_inheritance_column, type_col.type, - :limit => type_col.limit, - :default => type_col.default - end - - if updated_col.nil? - self.connection.add_column versioned_table_name, :updated_at, :timestamp - end - end - - # Rake migration task to drop the versioned table - def drop_versioned_table - self.connection.drop_table versioned_table_name - end - end - end - end - end -end - -ActiveRecord::Base.class_eval { include ActiveRecord::Acts::Versioned } diff --git a/vendor/gems/acts_as_versioned-0.2.3/test/fixtures/page.rb b/vendor/gems/acts_as_versioned-0.2.3/test/fixtures/page.rb deleted file mode 100644 index a5bc8f2..0000000 --- a/vendor/gems/acts_as_versioned-0.2.3/test/fixtures/page.rb +++ /dev/null @@ -1,24 +0,0 @@ -class Page < ActiveRecord::Base - cattr_accessor :feeling_good - @@feeling_good = true - - acts_as_versioned :if => :feeling_good? - - def feeling_good? - @@feeling_good == true - end -end - -class LockedPage < ActiveRecord::Base - acts_as_versioned \ - :inheritance_column => :version_type, - :foreign_key => :page_id, - :table_name => :locked_pages_revisions, - :class_name => 'LockedPageRevision', - :version_column => :lock_version, - :limit => 2, - :if_changed => :title -end - -class SpecialLockedPage < LockedPage -end \ No newline at end of file diff --git a/vendor/gems/acts_as_versioned-0.2.3/test/fixtures/widget.rb b/vendor/gems/acts_as_versioned-0.2.3/test/fixtures/widget.rb deleted file mode 100644 index 2bd849b..0000000 --- a/vendor/gems/acts_as_versioned-0.2.3/test/fixtures/widget.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Widget < ActiveRecord::Base - acts_as_versioned :sequence_name => 'widgets_seq' -end \ No newline at end of file diff --git a/vendor/gems/acts_as_versioned-0.2.3/test/versioned_test.rb b/vendor/gems/acts_as_versioned-0.2.3/test/versioned_test.rb deleted file mode 100644 index 3bf71f9..0000000 --- a/vendor/gems/acts_as_versioned-0.2.3/test/versioned_test.rb +++ /dev/null @@ -1,238 +0,0 @@ -require File.join(File.dirname(__FILE__), 'abstract_unit') -require File.join(File.dirname(__FILE__), 'fixtures/page') -require File.join(File.dirname(__FILE__), 'fixtures/widget') - -class VersionedTest < Test::Unit::TestCase - fixtures :pages, :page_versions, :locked_pages, :locked_pages_revisions - - def test_saves_versioned_copy - p = Page.create :title => 'first title', :body => 'first body' - assert !p.new_record? - assert_equal 1, p.versions.size - assert_equal 1, p.version - assert_instance_of Page.versioned_class, p.versions.first - end - - def test_rollback_with_version_number - p = pages(:welcome) - assert_equal 24, p.version - assert_equal 'Welcome to the weblog', p.title - - assert p.revert_to!(p.versions.first.version), "Couldn't revert to 23" - assert_equal 23, p.version - assert_equal 'Welcome to the weblg', p.title - end - - def test_versioned_class_name - assert_equal 'PageVersion', Page.versioned_class_name - assert_equal 'LockedPageRevision', LockedPage.versioned_class_name - end - - def test_rollback_with_version_class - p = pages(:welcome) - assert_equal 24, p.version - assert_equal 'Welcome to the weblog', p.title - - assert p.revert_to!(p.versions.first), "Couldn't revert to 23" - assert_equal 23, p.version - assert_equal 'Welcome to the weblg', p.title - end - - def test_rollback_fails_with_invalid_revision - p = locked_pages(:welcome) - assert !p.revert_to!(locked_pages(:thinking)) - end - - def test_saves_versioned_copy_with_options - p = LockedPage.create :title => 'first title' - assert !p.new_record? - assert_equal 1, p.versions.size - assert_instance_of LockedPage.versioned_class, p.versions.first - end - - def test_rollback_with_version_number_with_options - p = locked_pages(:welcome) - assert_equal 'Welcome to the weblog', p.title - assert_equal 'LockedPage', p.versions.first.version_type - - assert p.revert_to!(p.versions.first.version), "Couldn't revert to 23" - assert_equal 'Welcome to the weblg', p.title - assert_equal 'LockedPage', p.versions.first.version_type - end - - def test_rollback_with_version_class_with_options - p = locked_pages(:welcome) - assert_equal 'Welcome to the weblog', p.title - assert_equal 'LockedPage', p.versions.first.version_type - - assert p.revert_to!(p.versions.first), "Couldn't revert to 1" - assert_equal 'Welcome to the weblg', p.title - assert_equal 'LockedPage', p.versions.first.version_type - end - - def test_saves_versioned_copy_with_sti - p = SpecialLockedPage.create :title => 'first title' - assert !p.new_record? - assert_equal 1, p.versions.size - assert_instance_of LockedPage.versioned_class, p.versions.first - assert_equal 'SpecialLockedPage', p.versions.first.version_type - end - - def test_rollback_with_version_number_with_sti - p = locked_pages(:thinking) - assert_equal 'So I was thinking', p.title - - assert p.revert_to!(p.versions.first.version), "Couldn't revert to 1" - assert_equal 'So I was thinking!!!', p.title - assert_equal 'SpecialLockedPage', p.versions.first.version_type - end - - def test_lock_version_works_with_versioning - p = locked_pages(:thinking) - p2 = LockedPage.find(p.id) - - p.title = 'fresh title' - p.save - assert_equal 2, p.versions.size # limit! - - assert_raises(ActiveRecord::StaleObjectError) do - p2.title = 'stale title' - p2.save - end - end - - def test_version_if_condition - p = Page.create :title => "title" - assert_equal 1, p.version - - Page.feeling_good = false - p.save - assert_equal 1, p.version - Page.feeling_good = true - end - - def test_version_if_condition2 - # set new if condition - Page.class_eval do - def new_feeling_good() title[0..0] == 'a'; end - alias_method :old_feeling_good, :feeling_good? - alias_method :feeling_good?, :new_feeling_good - end - - p = Page.create :title => "title" - assert_equal 1, p.version # version does not increment - assert_equal 1, p.versions(true).size - - p.update_attributes(:title => 'new title') - assert_equal 1, p.version # version does not increment - assert_equal 1, p.versions(true).size - - p.update_attributes(:title => 'a title') - assert_equal 2, p.version - assert_equal 2, p.versions(true).size - - # reset original if condition - Page.class_eval { alias_method :feeling_good?, :old_feeling_good } - end - - def test_version_if_condition_with_block - # set new if condition - old_condition = Page.version_condition - Page.version_condition = Proc.new { |page| page.title[0..0] == 'b' } - - p = Page.create :title => "title" - assert_equal 1, p.version # version does not increment - assert_equal 1, p.versions(true).size - - p.update_attributes(:title => 'a title') - assert_equal 1, p.version # version does not increment - assert_equal 1, p.versions(true).size - - p.update_attributes(:title => 'b title') - assert_equal 2, p.version - assert_equal 2, p.versions(true).size - - # reset original if condition - Page.version_condition = old_condition - end - - def test_version_no_limit - p = Page.create :title => "title", :body => 'first body' - p.save - p.save - 5.times do |i| - assert_page_title p, i - end - end - - def test_version_max_limit - p = LockedPage.create :title => "title" - p.update_attributes(:title => "title1") - p.update_attributes(:title => "title2") - 5.times do |i| - assert_page_title p, i, :lock_version - assert p.versions(true).size <= 2, "locked version can only store 2 versions" - end - end - - def test_track_changed_attributes_default_value - assert !Page.track_changed_attributes - assert LockedPage.track_changed_attributes - assert SpecialLockedPage.track_changed_attributes - end - - def test_version_order - assert_equal 23, pages(:welcome).versions.first.version - assert_equal 24, pages(:welcome).versions.last.version - assert_equal 23, pages(:welcome).find_versions.first.version - assert_equal 24, pages(:welcome).find_versions.last.version - end - - def test_track_changed_attributes - p = LockedPage.create :title => "title" - assert_equal 1, p.lock_version - assert_equal 1, p.versions(true).size - - p.title = 'title' - assert !p.save_version? - p.save - assert_equal 2, p.lock_version # still increments version because of optimistic locking - assert_equal 1, p.versions(true).size - - p.title = 'updated title' - assert p.save_version? - p.save - assert_equal 3, p.lock_version - assert_equal 1, p.versions(true).size # version 1 deleted - - p.title = 'updated title!' - assert p.save_version? - p.save - assert_equal 4, p.lock_version - assert_equal 2, p.versions(true).size # version 1 deleted - end - - def assert_page_title(p, i, version_field = :version) - p.title = "title#{i}" - p.save - assert_equal "title#{i}", p.title - assert_equal (i+4), p.send(version_field) - end - - def test_find_versions - assert_equal 2, locked_pages(:welcome).versions.size - assert_equal 1, locked_pages(:welcome).find_versions(:conditions => ['title LIKE ?', '%weblog%']).length - assert_equal 2, locked_pages(:welcome).find_versions(:conditions => ['title LIKE ?', '%web%']).length - assert_equal 0, locked_pages(:thinking).find_versions(:conditions => ['title LIKE ?', '%web%']).length - assert_equal 2, locked_pages(:welcome).find_versions.length - end - - def test_with_sequence - assert_equal 'widgets_seq', Widget.versioned_class.sequence_name - Widget.create :name => 'new widget' - Widget.create :name => 'new widget' - Widget.create :name => 'new widget' - assert_equal 3, Widget.count - assert_equal 3, Widget.versioned_class.count - end -end diff --git a/vendor/gems/bluecloth-1.0.0/.specification b/vendor/gems/bluecloth-1.0.0/.specification new file mode 100644 index 0000000..0070a36 --- /dev/null +++ b/vendor/gems/bluecloth-1.0.0/.specification @@ -0,0 +1,57 @@ +--- !ruby/object:Gem::Specification +name: bluecloth +version: !ruby/object:Gem::Version + version: 1.0.0 +platform: ruby +authors: [] + +autorequire: +bindir: bin +cert_chain: [] + +date: 2009-07-16 00:00:00 -03:00 +default_executable: +dependencies: [] + +description: +email: +executables: [] + +extensions: [] + +extra_rdoc_files: [] + +files: +- lib +- lib/bluecloth.rb +has_rdoc: false +homepage: +post_install_message: +rdoc_options: [] + +require_paths: +- bin +- bin +- bin +- lib +required_ruby_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: "0" + version: +required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: "0" + version: +requirements: [] + +rubyforge_project: +rubygems_version: 1.3.1 +signing_key: +specification_version: 2 +summary: +test_files: [] + diff --git a/vendor/gems/BlueCloth-1.0.0/CHANGES b/vendor/gems/bluecloth-1.0.0/CHANGES similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/CHANGES rename to vendor/gems/bluecloth-1.0.0/CHANGES diff --git a/vendor/gems/BlueCloth-1.0.0/LICENSE b/vendor/gems/bluecloth-1.0.0/LICENSE similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/LICENSE rename to vendor/gems/bluecloth-1.0.0/LICENSE diff --git a/vendor/gems/BlueCloth-1.0.0/README b/vendor/gems/bluecloth-1.0.0/README similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/README rename to vendor/gems/bluecloth-1.0.0/README diff --git a/vendor/gems/BlueCloth-1.0.0/bin/bluecloth b/vendor/gems/bluecloth-1.0.0/bin/bluecloth similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/bin/bluecloth rename to vendor/gems/bluecloth-1.0.0/bin/bluecloth diff --git a/vendor/gems/BlueCloth-1.0.0/init.rb b/vendor/gems/bluecloth-1.0.0/init.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/init.rb rename to vendor/gems/bluecloth-1.0.0/init.rb diff --git a/vendor/gems/BlueCloth-1.0.0/install.rb b/vendor/gems/bluecloth-1.0.0/install.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/install.rb rename to vendor/gems/bluecloth-1.0.0/install.rb diff --git a/vendor/gems/BlueCloth-1.0.0/lib/bluecloth.rb b/vendor/gems/bluecloth-1.0.0/lib/bluecloth.rb similarity index 99% rename from vendor/gems/BlueCloth-1.0.0/lib/bluecloth.rb rename to vendor/gems/bluecloth-1.0.0/lib/bluecloth.rb index 90beb61..34ed960 100644 --- a/vendor/gems/BlueCloth-1.0.0/lib/bluecloth.rb +++ b/vendor/gems/bluecloth-1.0.0/lib/bluecloth.rb @@ -58,6 +58,7 @@ require 'digest/md5' require 'logger' require 'strscan' +require 'hpricot' ### BlueCloth is a Ruby implementation of Markdown, a text-to-HTML conversion diff --git a/vendor/gems/BlueCloth-1.0.0/test.rb b/vendor/gems/bluecloth-1.0.0/test.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/test.rb rename to vendor/gems/bluecloth-1.0.0/test.rb diff --git a/vendor/gems/BlueCloth-1.0.0/tests/00_Class.tests.rb b/vendor/gems/bluecloth-1.0.0/tests/00_Class.tests.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/00_Class.tests.rb rename to vendor/gems/bluecloth-1.0.0/tests/00_Class.tests.rb diff --git a/vendor/gems/BlueCloth-1.0.0/tests/05_Markdown.tests.rb b/vendor/gems/bluecloth-1.0.0/tests/05_Markdown.tests.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/05_Markdown.tests.rb rename to vendor/gems/bluecloth-1.0.0/tests/05_Markdown.tests.rb diff --git a/vendor/gems/BlueCloth-1.0.0/tests/10_Bug.tests.rb b/vendor/gems/bluecloth-1.0.0/tests/10_Bug.tests.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/10_Bug.tests.rb rename to vendor/gems/bluecloth-1.0.0/tests/10_Bug.tests.rb diff --git a/vendor/gems/BlueCloth-1.0.0/tests/15_Contrib.tests.rb b/vendor/gems/bluecloth-1.0.0/tests/15_Contrib.tests.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/15_Contrib.tests.rb rename to vendor/gems/bluecloth-1.0.0/tests/15_Contrib.tests.rb diff --git a/vendor/gems/BlueCloth-1.0.0/tests/bctestcase.rb b/vendor/gems/bluecloth-1.0.0/tests/bctestcase.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/bctestcase.rb rename to vendor/gems/bluecloth-1.0.0/tests/bctestcase.rb diff --git a/vendor/gems/BlueCloth-1.0.0/tests/data/antsugar.txt b/vendor/gems/bluecloth-1.0.0/tests/data/antsugar.txt similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/data/antsugar.txt rename to vendor/gems/bluecloth-1.0.0/tests/data/antsugar.txt diff --git a/vendor/gems/BlueCloth-1.0.0/tests/data/ml-announce.txt b/vendor/gems/bluecloth-1.0.0/tests/data/ml-announce.txt similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/data/ml-announce.txt rename to vendor/gems/bluecloth-1.0.0/tests/data/ml-announce.txt diff --git a/vendor/gems/BlueCloth-1.0.0/tests/data/re-overflow.txt b/vendor/gems/bluecloth-1.0.0/tests/data/re-overflow.txt similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/data/re-overflow.txt rename to vendor/gems/bluecloth-1.0.0/tests/data/re-overflow.txt diff --git a/vendor/gems/BlueCloth-1.0.0/tests/data/re-overflow2.txt b/vendor/gems/bluecloth-1.0.0/tests/data/re-overflow2.txt similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/tests/data/re-overflow2.txt rename to vendor/gems/bluecloth-1.0.0/tests/data/re-overflow2.txt diff --git a/vendor/gems/BlueCloth-1.0.0/utils.rb b/vendor/gems/bluecloth-1.0.0/utils.rb similarity index 100% rename from vendor/gems/BlueCloth-1.0.0/utils.rb rename to vendor/gems/bluecloth-1.0.0/utils.rb diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/.specification b/vendor/gems/dr_nic_magic_models-0.9.2/.specification new file mode 100644 index 0000000..ad62c58 --- /dev/null +++ b/vendor/gems/dr_nic_magic_models-0.9.2/.specification @@ -0,0 +1,107 @@ +--- !ruby/object:Gem::Specification +name: dr_nic_magic_models +version: !ruby/object:Gem::Version + version: 0.9.2 +platform: ruby +authors: +- nicwilliams +autorequire: +bindir: bin +cert_chain: +date: 2007-04-29 00:00:00 -03:00 +default_executable: +dependencies: [] + +description: Dr Nic's Magic Models - Invisible validations, assocations and Active Record models themselves! +email: drnicwilliams@gmail.com +executables: [] + +extensions: [] + +extra_rdoc_files: [] + +files: +- CHANGELOG +- History.txt +- Manifest.txt +- README +- Rakefile +- install.rb +- lib/base.rb +- lib/connection_adapters/abstract/schema_statements.rb +- lib/connection_adapters/abstract_adapter.rb +- lib/connection_adapters/mysql_adapter.rb +- lib/connection_adapters/postgresql_adapter.rb +- lib/dr_nic_magic_models.rb +- lib/dr_nic_magic_models/inflector.rb +- lib/dr_nic_magic_models/magic_model.rb +- lib/dr_nic_magic_models/schema.rb +- lib/dr_nic_magic_models/validations.rb +- lib/dr_nic_magic_models/version.rb +- lib/module.rb +- lib/rails.rb +- scripts/txt2html +- scripts/txt2js +- test.db +- test/abstract_unit.rb +- test/connections/native_mysql/connection.rb +- test/connections/native_postgresql/connection.rb +- test/connections/native_sqlite/connection.rb +- test/dummy_test.rb +- test/env_test.rb +- test/fixtures/.DS_Store +- test/fixtures/adjectives.yml +- test/fixtures/adjectives_fun_users.yml +- test/fixtures/db_definitions/mysql.drop.sql +- test/fixtures/db_definitions/mysql.sql +- test/fixtures/db_definitions/postgresql.sql +- test/fixtures/db_definitions/sqlite.sql +- test/fixtures/fun_users.yml +- test/fixtures/group_memberships.yml +- test/fixtures/group_tag.yml +- test/fixtures/groups.yml +- test/foreign_keys_test.rb +- test/fun_user_plus.rb +- test/invisible_model_access_test.rb +- test/invisible_model_assoc_test.rb +- test/invisible_model_classes_test.rb +- test/magic_module_test.rb +- test/test_existing_model.rb +- website/index.html +- website/index.txt +- website/javascripts/rounded_corners_lite.inc.js +- website/stylesheets/screen.css +- website/template.js +- website/template.rhtml +- website/version-raw.js +- website/version-raw.txt +- website/version.js +- website/version.txt +has_rdoc: true +homepage: http://magicmodels.rubyforge.org +post_install_message: +rdoc_options: [] + +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + requirements: + - - ">" + - !ruby/object:Gem::Version + version: 0.0.0 + version: +required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: "0" + version: +requirements: [] + +rubyforge_project: magicmodels +rubygems_version: 1.3.1 +signing_key: +specification_version: 1 +summary: Dr Nic's Magic Models - Invisible validations, assocations and Active Record models themselves! +test_files: +- test/test_existing_model.rb diff --git a/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/.DS_Store b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/.DS_Store new file mode 100644 index 0000000..00ad5ec Binary files /dev/null and b/vendor/gems/dr_nic_magic_models-0.9.2/test/fixtures/.DS_Store differ diff --git a/vendor/gems/haml-1.7.2/MIT-LICENSE b/vendor/gems/haml-1.7.2/MIT-LICENSE deleted file mode 100644 index 3b9f453..0000000 --- a/vendor/gems/haml-1.7.2/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2006-2007 Hampton Catlin - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/README b/vendor/gems/haml-1.7.2/README deleted file mode 100644 index 2022575..0000000 --- a/vendor/gems/haml-1.7.2/README +++ /dev/null @@ -1,248 +0,0 @@ -= Haml and Sass - -Haml and Sass are templating engines -for the two most common types of documents on the web: -HTML and CSS, respectively. -They are designed to make it both easier and more pleasant -to code HTML and CSS documents, -by eliminating redundancy, -reflecting the underlying structure that the document represents, -and providing elegant, easily understandable, and powerful syntax. - -== Using - -There are several ways to use Haml and Sass. -They can be used as a plugins for Rails or Merb, -or embedded on their own in other applications. -The first step of all of these is to install the Haml gem: - - gem install haml - -To install Haml and Sass as a Rails plugin, -just run haml --rails path/to/rails/app -and both Haml and Sass will be installed. -Views with the .haml (or .html.haml for edge) -extension will automatically use Haml. -Sass is a little more complicated; -.sass files should be placed in public/stylesheets/sass, -where they'll be automatically compiled -to corresponding CSS files in public/stylesheets when needed -(the Sass template directory is customizable... -see the Sass module docs for details). - -For Merb, .html.haml views will work without any further modification. -To enable Sass, you also need to add it add a dependency. -To do so, just add - - dependency "haml" - -to config/dependencies.rb. -Then it'll work just like it does in Rails. - -To use Haml and Sass programatically, -check out the RDocs for the Haml and Sass modules. - -== Formatting - -=== Haml - -The most basic element of Haml -is a shorthand for creating HTML tags: - - %tagname{ :attr1 => 'value1', :attr2 => 'value2' } Contents - -No end-tag is needed; Haml handles that automatically. -Adding class and id attributes is even easier. -Haml uses the same syntax as the CSS that styles the document: - - %tagname#id.class - -In fact, when you're using the
tag, -it becomes even easier. -Because
is such a common element, -a tag without a name defaults to a div. So - - #foo Hello! - -becomes - -
Hello!
- -Haml uses indentation -to bring the individual elements to represent the HTML structure. -A tag's children are indented two spaces more than the parent tag. -Again, a closing tag is automatically added. -For example: - - %ul - %li Salt - %li Pepper - -becomes: - - - -You can also put plain text as a child of an element: - - %p - Hello, - World! - -It's even possible to embed Ruby code into Haml documents. -An equals sign, =, will output the result of the code. -A hyphen, -, will run the code but not output the result. -You can even use control statements -like if and while: - - %p - Date/Time: - - now = DateTime.now - %strong= now - - if now > DateTime.parse("December 31, 2006") - = "Happy new " + "year!" - -Haml provides far more tools than those presented here. -Check out the reference documentation in the Haml module. - -=== Sass - -At its most basic, -Sass is just another way of writing CSS. -Although it's very much like normal CSS, -the basic syntax offers a few helpful features: -tabulation (using *two spaces*) -indicates the attributes in a rule, -rather than non-DRY brackets; -and newlines indicate the end of an attribute, -rather than a semicolon. -For example: - - #main - :background-color #f00 - :width 98% - -becomes: - - #main { - background-color: #f00; - width: 98% } - -However, Sass provides much more than a way to make CSS look nice. -In CSS, it's important to have accurate selectors, -so your styles don't just apply to everything. -However, in order to do this, -you need to use nested element selectors. -These get very ugly very quickly. -I'm sure everyone's had to write something like -"#main .sidebar .top p h1 a", -followed by -"#main .sidebar .top p h1 a:visited" and -"#main .sidebar .top p h1 a:hover". -Well, Sass gets rid of that. -Like Haml, it uses indentation to indicate the structure of the document. -So, what was: - - #main { - width: 90%; - } - #main p { - border-style: solid; - border-width: 1px; - border-color: #00f; - } - #main p a { - text-decoration: none; - font-weight: bold; - } - #main p a:hover { - text-decoration: underline; - } - -becomes: - - #main - :width 90% - p - :border-style solid - :border-width 1px - :border-color #00f - a - :text-decoration none - :font-weight bold - a:hover - :text-decoration underline - -Pretty nice, no? Well, it gets better. -One of the main complaints against CSS is that it doesn't allow constants. -What if have a color or a width you re-use all the time? -In CSS, you just have to re-type it each time, -which is a nightmare when you decide to change it later. -Not so for Sass! -You can use the "!" character to set constants. -Then, if you put "=" after your attribute name, -you can set it to a constant. -For example: - - !note_bg= #55aaff - - #main - :width 70% - .note - :background-color= !note_bg - p - :width 5em - :background-color= !note_bg - -becomes: - - #main { - width: 70%; } - #main .note { - background-color: #55aaff; } - #main p { - width: 5em; - background-color: #55aaff; } - -You can even do simple arithmetic operations with constants, -adding numbers and even colors together: - - !main_bg= #46ar12 - !main_width= 40em - - #main - :background-color= !main_bg - :width= !main_width - .sidebar - :background-color= !main_bg + #333333 - :width= !main_width - 25em - -becomes: - - #main { - background-color: #46a312; - width: 40em; } - #main .sidebar { - background-color: #79d645; - width: 15em; } - -A comprehensive list of features is in -the documentation for the Sass module. - -== Authors - -Haml and Sass are designed by Hampton Catlin (hcatlin). -Help with the Ruby On Rails implementation and much of the documentation -by Jeff Hardy (packagethief). - -Nathan Weizenbaum (Nex3) contributed the buffered-engine code to Haml, -along with many other enhancements -(including the silent-line syntax: "-"). -He continues to actively work on both Haml and Sass. - -If you use this software, you must pay Hampton a compliment. -Say something nice about it. -Beyond that, the implementation is licensed under the MIT License. -Ok, fine, I guess that means compliments aren't *required*. diff --git a/vendor/gems/haml-1.7.2/Rakefile b/vendor/gems/haml-1.7.2/Rakefile deleted file mode 100644 index 1942f61..0000000 --- a/vendor/gems/haml-1.7.2/Rakefile +++ /dev/null @@ -1,174 +0,0 @@ -require 'rubygems' -require 'rake' - -volatile_requires = ['rcov/rcovtask'] -not_loaded = [] -volatile_requires.each do |file| - begin - require file - rescue LoadError - not_loaded.push file - end -end - -# ----- Benchmarking ----- - -temp_desc = < :test - - require 'rake/testtask' - - desc 'Test the Haml plugin' - Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true - end - - # ----- Packaging ----- - - require 'rake/gempackagetask' - - spec = Gem::Specification.new do |spec| - spec.name = 'haml' - spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine." - spec.version = File.read('VERSION').strip - spec.author = 'Hampton Catlin' - spec.email = 'haml@googlegroups.com' - spec.description = <<-END - Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML - that's designed to express the structure of XHTML or XML documents - in a non-repetitive, elegant, easy way, - using indentation rather than closing tags - and allowing Ruby to be embedded with ease. - It was originally envisioned as a plugin for Ruby on Rails, - but it can function as a stand-alone templating engine. - END - #' - - readmes = FileList.new('*') do |list| - list.exclude(/[a-z]/) - list.exclude('TODO') - end.to_a - spec.executables = ['haml', 'html2haml', 'sass'] - spec.files = FileList['lib/**/*', 'bin/*', 'test/**/*', 'Rakefile', 'init.rb'].to_a + readmes - spec.autorequire = ['haml', 'sass'] - spec.homepage = 'http://haml.hamptoncatlin.com/' - spec.has_rdoc = true - spec.extra_rdoc_files = readmes - spec.rdoc_options += [ - '--title', 'Haml', - '--main', 'README', - '--exclude', 'lib/haml/buffer.rb', - '--line-numbers', - '--inline-source' - ] - spec.test_files = FileList['test/**/*_test.rb'].to_a - end - - Rake::GemPackageTask.new(spec) do |pkg| - pkg.need_zip = true - pkg.need_tar_gz = true - pkg.need_tar_bz2 = true - end - - task :install => [:package] do - sh %{gem install --no-ri pkg/haml-#{File.read('VERSION').strip}} - end - - # ----- Documentation ----- - - require 'rake/rdoctask' - - rdoc_task = Proc.new do |rdoc| - rdoc.title = 'Haml/Sass' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') - rdoc.rdoc_files.exclude('lib/haml/buffer.rb') - rdoc.rdoc_files.exclude('lib/haml/util.rb') - rdoc.rdoc_files.exclude('lib/sass/tree/*') - end - - Rake::RDocTask.new do |rdoc| - rdoc_task.call(rdoc) - rdoc.rdoc_dir = 'rdoc' - end - - Rake::RDocTask.new(:rdoc_devel) do |rdoc| - rdoc_task.call(rdoc) - rdoc.rdoc_dir = 'rdoc_devel' - rdoc.options << '--all' - rdoc.rdoc_files.include('test/*.rb') - - # Get rid of exclusion rules - rdoc.rdoc_files = Rake::FileList.new(*rdoc.rdoc_files.to_a) - rdoc.rdoc_files.include('lib/haml/buffer.rb') - rdoc.rdoc_files.include('lib/sass/tree/*') - end - - # ----- Coverage ----- - - unless not_loaded.include? 'rcov/rcovtask' - Rcov::RcovTask.new do |t| - t.libs << "test" - t.test_files = FileList['test/**/*_test.rb'] - t.rcov_opts << '-x' << '"^\/"' - if ENV['NON_NATIVE'] - t.rcov_opts << "--no-rcovrt" - end - t.verbose = true - end - end - - # ----- Profiling ----- - - temp_desc = <<-END - Run a profile of haml. - ENGINE=str sets the engine to be profiled (Haml or Sass). - TIMES=n sets the number of runs. Defaults to 100. - FILE=n sets the file to profile. Defaults to 'standard'. - END - desc temp_desc.chomp - task :profile do - require 'test/profile' - - engine = ENV['ENGINE'] && ENV['ENGINE'].downcase == 'sass' ? Sass : Haml - - puts '-'*51, "Profiling #{engine}", '-'*51 - - args = [] - args.push ENV['TIMES'].to_i if ENV['TIMES'] - args.push ENV['FILE'] if ENV['FILE'] - - profiler = engine::Profiler.new - res = profiler.profile(*args) - puts res - - puts '-'*51 - end - -end diff --git a/vendor/gems/haml-1.7.2/VERSION b/vendor/gems/haml-1.7.2/VERSION deleted file mode 100644 index f8a696c..0000000 --- a/vendor/gems/haml-1.7.2/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.7.2 diff --git a/vendor/gems/haml-1.7.2/bin/css2sass b/vendor/gems/haml-1.7.2/bin/css2sass deleted file mode 100644 index 8245f18..0000000 --- a/vendor/gems/haml-1.7.2/bin/css2sass +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -require File.dirname(__FILE__) + '/../lib/haml' -require 'haml/exec' - -opts = Haml::Exec::CSS2Sass.new(ARGV) -opts.parse! diff --git a/vendor/gems/haml-1.7.2/bin/haml b/vendor/gems/haml-1.7.2/bin/haml deleted file mode 100644 index 3480fb9..0000000 --- a/vendor/gems/haml-1.7.2/bin/haml +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby -# The command line Haml parser. - -require File.dirname(__FILE__) + '/../lib/haml' -require 'haml/exec' - -opts = Haml::Exec::Haml.new(ARGV) -opts.parse! diff --git a/vendor/gems/haml-1.7.2/bin/html2haml b/vendor/gems/haml-1.7.2/bin/html2haml deleted file mode 100644 index a85e95a..0000000 --- a/vendor/gems/haml-1.7.2/bin/html2haml +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby - -require File.dirname(__FILE__) + '/../lib/haml' -require 'haml/exec' - -opts = Haml::Exec::HTML2Haml.new(ARGV) -opts.parse! diff --git a/vendor/gems/haml-1.7.2/bin/sass b/vendor/gems/haml-1.7.2/bin/sass deleted file mode 100644 index 1cc522a..0000000 --- a/vendor/gems/haml-1.7.2/bin/sass +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env ruby -# The command line Sass parser. - -require File.dirname(__FILE__) + '/../lib/haml' -require 'haml/exec' - -opts = Haml::Exec::Sass.new(ARGV) -opts.parse! diff --git a/vendor/gems/haml-1.7.2/init.rb b/vendor/gems/haml-1.7.2/init.rb deleted file mode 100644 index 3d4283a..0000000 --- a/vendor/gems/haml-1.7.2/init.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'haml' -require 'haml/template' -require 'sass' -require 'sass/plugin' - -ActionView::Base.register_template_handler('haml', Haml::Template) -Sass::Plugin.update_stylesheets diff --git a/vendor/gems/haml-1.7.2/lib/haml.rb b/vendor/gems/haml-1.7.2/lib/haml.rb deleted file mode 100644 index 85f0fea..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml.rb +++ /dev/null @@ -1,708 +0,0 @@ -dir = File.dirname(__FILE__) -$LOAD_PATH << dir unless $LOAD_PATH.include?(dir) - -# = Haml (XHTML Abstraction Markup Language) -# -# Haml is a markup language -# that's used to cleanly and simply describe the XHTML of any web document, -# without the use of inline code. -# Haml functions as a replacement -# for inline page templating systems such as PHP, ERB, and ASP. -# However, Haml avoids the need for explicitly coding XHTML into the template, -# because it is actually an abstract description of the XHTML, -# with some code to generate dynamic content. -# -# == Features -# -# * Whitespace active -# * Well-formatted markup -# * DRY -# * Follows CSS conventions -# * Integrates Ruby code -# * Implements Rails templates with the .haml extension -# -# == Using Haml -# -# Haml can be used in two ways: -# as a plugin for Ruby on Rails, -# and as a standalone Ruby module. -# -# Sass can be used in several ways: -# As a template engine for Ruby on Rails or Merb, -# or as a standalone engine. -# The first step for all of these is to install the Haml gem: -# -# gem install haml -# -# To enable it as a Rails plugin, -# then run -# -# haml --rails path/to/rails/app -# -# Haml is enabled in Merb by default, -# so Merb users don't have to do anything more. -# -# Once it's installed, all view files with the ".haml" extension -# (or ".html.haml" for Merb or edge Rails) -# will be compiled using Haml. -# -# You can access instance variables in Haml templates -# the same way you do in ERb templates. -# Helper methods are also available in Haml templates. -# For example (this example uses Rails, but the principle for Merb is the same): -# -# # file: app/controllers/movies_controller.rb -# -# class MoviesController < ApplicationController -# def index -# @title = "Teen Wolf" -# end -# end -# -# -# file: app/views/movies/index.haml -# -# #content -# .title -# %h1= @title -# = link_to 'Home', home_url -# -# may be compiled to: -# -#
-#
-#

Teen Wolf

-# Home -#
-#
-# -# === Ruby Module -# -# Haml can also be used completely separately from Rails and ActionView. -# To do this, install the gem with RubyGems: -# -# gem install haml -# -# You can then use it by including the "haml" gem in Ruby code, -# and using Haml::Engine like so: -# -# engine = Haml::Engine.new("%p Haml code!") -# engine.render #=> "

Haml code!

\n" -# -# == Characters with meaning to Haml -# -# Various characters, when placed at a certain point in a line, -# instruct Haml to render different types of things. -# -# === XHTML Tags -# -# These characters render XHTML tags. -# -# ==== % -# -# -# The percent character is placed at the beginning of a line. -# It's followed immediately by the name of an element, -# then optionally by modifiers (see below), a space, -# and text to be rendered inside the element. -# It creates an element in the form of . -# For example: -# -# %one -# %two -# %three Hey there -# -# is compiled to: -# -# -# -# Hey there -# -# -# -# Any string is a valid element name; -# Haml will automatically generate opening and closing tags for any element. -# -# ==== {} -# -# Brackets represent a Ruby hash -# that is used for specifying the attributes of an element. -# It is literally evaluated as a Ruby hash, -# so logic will work in it and local variables may be used. -# Quote characters within the attribute -# will be replaced by appropriate escape sequences. -# The hash is placed after the tag is defined. -# For example: -# -# %head{ :name => "doc_head" } -# %script{ 'type' => "text/" + "javascript", -# :src => "javascripts/script_#{2 + 7}" } -# -# is compiled to: -# -# -# -# -# -# ==== [] -# -# Square brackets follow a tag definition and contain a Ruby object -# that is used to set the class and id of that tag. -# The class is set to the object's class -# (transformed to use underlines rather than camel case) -# and the id is set to the object's class, followed by its id. -# Because the id of an object is normally an obscure implementation detail, -# this is most useful for elements that represent instances of Models. -# For example: -# -# # file: app/controllers/users_controller.rb -# -# def show -# @user = CrazyUser.find(15) -# end -# -# -# file: app/views/users/show.haml -# -# %div[@user] -# %bar[290]/ -# Hello! -# -# is compiled to: -# -#
-# -# Hello! -#
-# -# This is based off of DHH's SimplyHelpful syntax, -# as presented at RailsConf Europe 2006. -# -# ==== / -# -# The forward slash character, when placed at the end of a tag definition, -# causes the tag to be self-closed. -# For example: -# -# %br/ -# %meta{'http-equiv' => 'Content-Type', :content => 'text/html'}/ -# -# is compiled to: -# -#
-# -# -# Some tags are automatically closed, as long as they have no content. -# +meta+, +img+, +link+, +script+, +br+, and +hr+ tags are closed by default. -# This list can be customized by setting the :autoclose option (see below). -# For example: -# -# %br -# %meta{'http-equiv' => 'Content-Type', :content => 'text/html'} -# -# is also compiled to: -# -#
-# -# -# ==== . and # -# -# The period and pound sign are borrowed from CSS. -# They are used as shortcuts to specify the class -# and id attributes of an element, respectively. -# Multiple class names can be specified in a similar way to CSS, -# by chaining the class names together with periods. -# They are placed immediately after the tag and before an attributes hash. -# For example: -# -# %div#things -# %span#rice Chicken Fried -# %p.beans{ :food => 'true' } The magical fruit -# %h1.class.otherclass#id La La La -# -# is compiled to: -# -#
-# Chicken Fried -#

The magical fruit

-#

La La La

-#
-# -# And, -# -# #content -# .articles -# .article.title -# Doogie Howser Comes Out -# .article.date -# 2006-11-05 -# .article.entry -# Neil Patrick Harris would like to dispel any rumors that he is straight -# -# is compiled to: -# -#
-#
-#
Doogie Howser Comes Out
-#
2006-11-05
-#
-# Neil Patrick Harris would like to dispel any rumors that he is straight -#
-#
-#
-# -# ==== Implicit Div Elements -# -# Because the div element is used so often, it is the default element. -# If you only define a class and/or id using the . or # syntax, -# a div element is automatically used. -# For example: -# -# #collection -# .item -# .description What a cool item! -# -# is the same as: -# -# %div{:id => collection} -# %div{:class => 'item'} -# %div{:class => 'description'} What a cool item! -# -# and is compiled to: -# -#
-#
-#
What a cool item!
-#
-#
-# -# ==== = -# -# = is placed at the end of a tag definition, -# after class, id, and attribute declarations. -# It's just a shortcut for inserting Ruby code into an element. -# It works the same as = without a tag: -# it inserts the result of the Ruby code into the template. -# However, if the result is short enough, -# it is displayed entirely on one line. -# For example: -# -# %p= "hello" -# -# is not quite the same as: -# -# %p -# = "hello" -# -# It's compiled to: -# -#

hello

-# -# === XHTML Helpers -# -# ==== No Special Character -# -# If no special character appears at the beginning of a line, -# the line is rendered as plain text. -# For example: -# -# %gee -# %whiz -# Wow this is cool! -# -# is compiled to: -# -# -# -# Wow this is cool! -# -# -# -# ==== !!! -# -# When describing XHTML documents with Haml, -# you can have a document type or XML prolog generated automatically -# by including the characters !!!. -# For example: -# -# !!! XML -# !!! -# %html -# %head -# %title Myspace -# %body -# %h1 I am the international space station -# %p Sign my guestbook -# -# is compiled to: -# -# -# -# -# -# Myspace -# -# -#

I am the international space station

-#

Sign my guestbook

-# -# -# -# You can also specify the version and type of XHTML after the !!!. -# XHTML 1.0 Strict, Transitional, and Frameset and XHTML 1.1 are supported. -# The default version is 1.0 and the default type is Transitional. -# For example: -# -# !!! 1.1 -# -# is compiled to: -# -# -# -# and -# -# !!! Strict -# -# is compiled to: -# -# -# -# If you're not using the UTF-8 character set for your document, -# you can specify which encoding should appear -# in the XML prolog in a similar way. -# For example: -# -# !!! XML iso-8859-1 -# -# is compiled to: -# -# -# -# ==== / -# -# The forward slash character, when placed at the beginning of a line, -# wraps all text after it in an HTML comment. -# For example: -# -# %peanutbutterjelly -# / This is the peanutbutterjelly element -# I like sandwiches! -# -# is compiled to: -# -# -# -# I like sandwiches! -# -# -# The forward slash can also wrap indented sections of code. For example: -# -# / -# %p This doesn't render... -# %div -# %h1 Because it's commented out! -# -# is compiled to: -# -# -# -# You can also use Internet Explorer conditional comments -# (about)[http://www.quirksmode.org/css/condcom.html] -# by enclosing the condition in square brackets after the /. -# For example: -# -# /[if IE] -# %a{ :href => 'http://www.mozilla.com/en-US/firefox/' } -# %h1 Get Firefox -# -# is compiled to: -# -# -# -# ==== \ -# -# The backslash character escapes the first character of a line, -# allowing use of otherwise interpreted characters as plain text. -# For example: -# -# %title -# = @title -# \- MySite -# -# is compiled to: -# -# -# MyPage -# - MySite -# -# -# ==== | -# -# The pipe character designates a multiline string. -# It's placed at the end of a line -# and means that all following lines that end with | -# will be evaluated as though they were on the same line. -# For example: -# -# %whoo -# %hoo I think this might get | -# pretty long so I should | -# probably make it | -# multiline so it doesn't | -# look awful. | -# %p This is short. -# -# is compiled to: -# -# -# -# I think this might get pretty long so I should probably make it multiline so it doesn't look awful. -# -# -# -# ==== : -# -# The colon character designates a filter. -# This allows you to pass an indented block of text as input -# to another filtering program and add the result to the output of Haml. -# The syntax is simply a colon followed by the name of the filter. -# For example, -# -# %p -# :markdown -# Textile -# ======= -# -# Hello, *World* -# -# is compiled to -# -#

-#

Textile

-# -#

Hello, World

-#

-# -# Haml has the following filters defined: -# -# [plain] Does not parse the filtered text. -# This is useful for large blocks of text without HTML tags, -# when you don't want lines starting with . or - -# to be parsed. -# -# [ruby] Parses the filtered text with the normal Ruby interpreter. -# All output sent to $stdout, like with +puts+, -# is output into the Haml document. -# Not available if the suppress_eval option is set to true. -# -# [preserve] Inserts the filtered text into the template with whitespace preserved. -# preserved blocks of text aren't indented, -# and newlines are replaced with the HTML escape code for newlines, -# to preserve nice-looking output. -# -# [erb] Parses the filtered text with ERB, like an RHTML template. -# Not available if the suppress_eval option is set to true. -# At the moment, this doesn't support access to variables -# defined by Ruby on Rails or Haml code. -# -# [sass] Parses the filtered text with Sass to produce CSS output. -# -# [redcloth] Parses the filtered text with RedCloth (http://whytheluckystiff.net/ruby/redcloth), -# which uses both Textile and Markdown syntax. -# Only works if RedCloth is installed. -# -# [textile] Parses the filtered text with Textile (http://www.textism.com/tools/textile). -# Only works if RedCloth is installed. -# -# [markdown] Parses the filtered text with Markdown (http://daringfireball.net/projects/markdown). -# Only works if RedCloth or BlueCloth (http://www.deveiate.org/projects/BlueCloth) -# is installed -# (BlueCloth takes precedence if both are installed). -# -# You can also define your own filters (see Setting Options, below). -# -# === Ruby evaluators -# -# ==== = -# -# The equals character is followed by Ruby code, -# which is evaluated and the output inserted into the document as plain text. -# For example: -# -# %p -# = ['hi', 'there', 'reader!'].join " " -# = "yo" -# -# is compiled to: -# -#

-# hi there reader! -# yo -#

-# -# You can also use two equal signs, ==, -# along with conventional Ruby string-embedding syntax -# to easily embed Ruby code in otherwise static text. -# For example: -# -# %p -# == 1 + 1 = #{1 + 1} -# -# is compiled to: -# -#

-# 1 + 1 = 2 -#

-# -# ==== - -# -# The hyphen character makes the text following it into "silent script": -# Ruby script that is evaluated, but not output. -# -# It is not recommended that you use this widely; -# almost all processing code and logic should be restricted -# to the Controller, the Helper, or partials. -# -# For example: -# -# - foo = "hello" -# - foo << " there" -# - foo << " you!" -# %p= foo -# -# is compiled to: -# -#

-# hello there you! -#

-# -# ===== Blocks -# -# Ruby blocks, like XHTML tags, don't need to be explicitly closed in Haml. -# Rather, they're automatically closed, based on indentation. -# A block begins whenever the indentation is increased -# after a silent script command. -# It ends when the indentation decreases -# (as long as it's not an +else+ clause or something similar). -# For example: -# -# - (42...47).each do |i| -# %p= i -# %p See, I can count! -# -# is compiled to: -# -#

-# 42 -#

-#

-# 43 -#

-#

-# 44 -#

-#

-# 45 -#

-#

-# 46 -#

-# -# Another example: -# -# %p -# - case 2 -# - when 1 -# = "1!" -# - when 2 -# = "2?" -# - when 3 -# = "3." -# -# is compiled to: -# -#

-# 2? -#

-# -# ==== -# -# -# The hyphen followed immediately by the pound sign -# signifies a silent comment. -# Any text following this isn't rendered in the resulting document -# at all. -# -# For example: -# -# %p foo -# -# This is a comment -# %p bar -# -# is compiled to: -# -#

foo

-#

bar

-# -# == Other Useful Things -# -# === Helpers -# -# Haml offers a bunch of helpers that are useful -# for doing stuff like preserving whitespace, -# creating nicely indented output for user-defined helpers, -# and other useful things. -# The helpers are all documented in the Haml::Helpers and Haml::Helpers::ActionViewExtensions modules. -# -# === Haml Options -# -# Options can be set by setting the hash Haml::Template.options -# from environment.rb in Rails, -# or by passing an options hash to Haml::Engine. -# Available options are: -# -# [:suppress_eval] Whether or not attribute hashes and Ruby scripts -# designated by = or ~ should be -# evaluated. If this is true, said scripts are -# rendered as empty strings. Defaults to false. -# -# [:attr_wrapper] The character that should wrap element attributes. -# This defaults to ' (an apostrophe). Characters -# of this type within the attributes will be escaped -# (e.g. by replacing them with ') if -# the character is an apostrophe or a quotation mark. -# -# [:filename] The name of the Haml file being parsed. -# This is only used as information when exceptions are raised. -# This is automatically assigned when working through ActionView, -# so it's really only useful for the user to assign -# when dealing with Haml programatically. -# -# [:filters] A hash of filters that can be applied to Haml code. -# The keys are the string names of the filters; -# the values are references to the classes of the filters. -# User-defined filters should always have lowercase keys, -# and should have: -# * An +initialize+ method that accepts one parameter, -# the text to be filtered. -# * A +render+ method that returns the result of the filtering. -# -# [:locals] The local variables that will be available within the -# template. For instance, if :locals is -# { :foo => "bar" }, then within the template, -# = foo will produce bar. -# -# [:autoclose] A list of tag names that should be automatically self-closed -# if they have no content. -# Defaults to ['meta', 'img', 'link', 'script', 'br', 'hr']. -# -module Haml; end - -require 'haml/engine' diff --git a/vendor/gems/haml-1.7.2/lib/haml/buffer.rb b/vendor/gems/haml-1.7.2/lib/haml/buffer.rb deleted file mode 100644 index ca7674f..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/buffer.rb +++ /dev/null @@ -1,213 +0,0 @@ -module Haml - # This class is used only internally. It holds the buffer of XHTML that - # is eventually output by Haml::Engine's to_html method. It's called - # from within the precompiled code, and helps reduce the amount of - # processing done within instance_eval'd code. - class Buffer - include Haml::Helpers - - # Set the maximum length for a line to be considered a one-liner. - # Lines <= the maximum will be rendered on one line, - # i.e.

Hello world

- ONE_LINER_LENGTH = 50 - - # The string that holds the compiled XHTML. This is aliased as - # _erbout for compatibility with ERB-specific code. - attr_accessor :buffer - - # Gets the current tabulation of the document. - def tabulation - @real_tabs + @tabulation - end - - # Sets the current tabulation of the document. - def tabulation=(val) - val = val - @real_tabs - @tabulation = val > -1 ? val : 0 - end - - # Creates a new buffer. - def initialize(options = {}) - @options = options - @quote_escape = options[:attr_wrapper] == '"' ? """ : "'" - @other_quote_char = options[:attr_wrapper] == '"' ? "'" : '"' - @buffer = "" - @one_liner_pending = false - @tabulation = 0 - - # The number of tabs that Engine thinks we should have - # @real_tabs + @tabulation is the number of tabs actually output - @real_tabs = 0 - end - - # Renders +text+ with the proper tabulation. This also deals with - # making a possible one-line tag one line or not. - def push_text(text, tabulation) - if @one_liner_pending && Buffer.one_liner?(text) - @buffer << text - else - if @one_liner_pending - @buffer << "\n" - @one_liner_pending = false - end - @buffer << "#{tabs(tabulation)}#{text}\n" - end - end - - # Properly formats the output of a script that was run in the - # instance_eval. - def push_script(result, tabulation, flattened) - if flattened - result = Haml::Helpers.find_and_preserve(result) - end - - result = result.to_s - while result[-1] == 10 # \n - # String#chomp is slow - result = result[0...-1] - end - - result = result.gsub("\n", "\n#{tabs(tabulation)}") - push_text result, tabulation - nil - end - - - def open_prerendered_tag(tag, tabulation) - @buffer << "#{tabs(tabulation)}#{tag}" - @real_tabs += 1 - end - - # Takes the various information about the opening tag for an - # element, formats it, and adds it to the buffer. - def open_tag(name, tabulation, atomic, try_one_line, class_id, obj_ref, attributes_hash) - attributes = class_id - if attributes_hash - attributes_hash.keys.each { |key| attributes_hash[key.to_s] = attributes_hash.delete(key) } - self.class.merge_attrs(attributes, attributes_hash) - end - self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref - - @one_liner_pending = false - if atomic - str = " />\n" - elsif try_one_line - @one_liner_pending = true - str = ">" - else - str = ">\n" - end - @buffer << "#{tabs(tabulation)}<#{name}#{build_attributes(attributes)}#{str}" - @real_tabs += 1 - end - - def self.merge_attrs(to, from) - if to['id'] && from['id'] - to['id'] << '_' << from.delete('id') - end - - if to['class'] && from['class'] - # Make sure we don't duplicate class names - from['class'] = (from['class'].split(' ') | to['class'].split(' ')).join(' ') - end - - to.merge!(from) - end - - # Creates a closing tag with the given name. - def close_tag(name, tabulation) - if @one_liner_pending - @buffer << "\n" - @one_liner_pending = false - else - push_text("", tabulation) - end - end - - # Opens an XHTML comment. - def open_comment(try_one_line, conditional, tabulation) - conditional << ">" if conditional - @buffer << "#{tabs(tabulation)}" : "-->" - if @one_liner_pending - @buffer << " #{close_tag}\n" - @one_liner_pending = false - else - push_text(close_tag, tabulation) - end - end - - # Some of these methods are exposed as public class methods - # so they can be re-used in helpers. - - # Takes a hash and builds a list of XHTML attributes from it, returning - # the result. - def build_attributes(attributes = {}) - result = attributes.collect do |a,v| - v = v.to_s - unless v.nil? || v.empty? - attr_wrapper = @options[:attr_wrapper] - if v.include? attr_wrapper - if v.include? @other_quote_char - v = v.gsub(attr_wrapper, @quote_escape) - else - attr_wrapper = @other_quote_char - end - end - " #{a}=#{attr_wrapper}#{v}#{attr_wrapper}" - end - end - result.compact.sort.join - end - - # Returns whether or not the given value is short enough to be rendered - # on one line. - def self.one_liner?(value) - value.length <= ONE_LINER_LENGTH && value.scan(/\n/).empty? - end - - private - - @@tab_cache = {} - # Gets count tabs. Mostly for internal use. - def tabs(count) - @real_tabs = count - tabs = count + @tabulation - ' ' * tabs - @@tab_cache[tabs] ||= ' ' * tabs - end - - # Takes an array of objects and uses the class and id of the first - # one to create an attributes hash. - def parse_object_ref(ref) - ref = ref[0] - # Let's make sure the value isn't nil. If it is, return the default Hash. - return {} if ref.nil? - class_name = underscore(ref.class) - id = "#{class_name}_#{ref.id || 'new'}" - - {'id' => id, 'class' => class_name} - end - - # Changes a word from camel case to underscores. - # Based on the method of the same name in Rails' Inflector, - # but copied here so it'll run properly without Rails. - def underscore(camel_cased_word) - camel_cased_word.to_s.gsub(/::/, '_'). - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). - gsub(/([a-z\d])([A-Z])/,'\1_\2'). - tr("-", "_"). - downcase - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/engine.rb b/vendor/gems/haml-1.7.2/lib/haml/engine.rb deleted file mode 100644 index 32d2e42..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/engine.rb +++ /dev/null @@ -1,876 +0,0 @@ -require 'haml/helpers' -require 'haml/buffer' -require 'haml/filters' -require 'haml/error' -require 'haml/util' - -module Haml - # This is the class where all the parsing and processing of the Haml - # template is done. It can be directly used by the user by creating a - # new instance and calling to_html to render the template. For example: - # - # template = File.read('templates/really_cool_template.haml') - # haml_engine = Haml::Engine.new(template) - # output = haml_engine.to_html - # puts output - class Engine - # Allow reading and writing of the options hash - attr :options, true - - # Designates an XHTML/XML element. - ELEMENT = ?% - - # Designates a
element with the given class. - DIV_CLASS = ?. - - # Designates a
element with the given id. - DIV_ID = ?# - - # Designates an XHTML/XML comment. - COMMENT = ?/ - - # Designates an XHTML doctype. - DOCTYPE = ?! - - # Designates script, the result of which is output. - SCRIPT = ?= - - # Designates script, the result of which is flattened and output. - FLAT_SCRIPT = ?~ - - # Designates script which is run but not output. - SILENT_SCRIPT = ?- - - # When following SILENT_SCRIPT, designates a comment that is not output. - SILENT_COMMENT = ?# - - # Designates a non-parsed line. - ESCAPE = ?\\ - - # Designates a block of filtered text. - FILTER = ?: - - # Designates a non-parsed line. Not actually a character. - PLAIN_TEXT = -1 - - # Keeps track of the ASCII values of the characters that begin a - # specially-interpreted line. - SPECIAL_CHARACTERS = [ - ELEMENT, - DIV_CLASS, - DIV_ID, - COMMENT, - DOCTYPE, - SCRIPT, - FLAT_SCRIPT, - SILENT_SCRIPT, - ESCAPE, - FILTER - ] - - # The value of the character that designates that a line is part - # of a multiline string. - MULTILINE_CHAR_VALUE = ?| - - # Characters that designate that a multiline string may be about - # to begin. - MULTILINE_STARTERS = SPECIAL_CHARACTERS - [?/] - - # Keywords that appear in the middle of a Ruby block with lowered - # indentation. If a block has been started using indentation, - # lowering the indentation with one of these won't end the block. - # For example: - # - # - if foo - # %p yes! - # - else - # %p no! - # - # The block is ended after %p no!, because else - # is a member of this array. - MID_BLOCK_KEYWORDS = ['else', 'elsif', 'rescue', 'ensure', 'when'] - - # The Regex that matches an HTML comment command. - COMMENT_REGEX = /\/(\[[\w\s\.]*\])?(.*)/ - - # The Regex that matches a Doctype command. - DOCTYPE_REGEX = /(\d\.\d)?[\s]*([a-z]*)/i - - # The Regex that matches an HTML tag command. - TAG_REGEX = /[%]([-:\w]+)([-\w\.\#]*)(\{.*\})?(\[.*\])?([=\/\~]?)?(.*)?/ - - # The Regex that matches a literal string or symbol value - LITERAL_VALUE_REGEX = /^\s*(:(\w*)|(('|")([^\\\#'"]*?)\4))\s*$/ - - FLAT_WARNING = <render is called. - # See README for available options. - # - #-- - # When adding options, remember to add information about them - # to README! - #++ - # - def initialize(template, l_options = {}) - @options = { - :suppress_eval => false, - :attr_wrapper => "'", - :locals => {}, - :autoclose => ['meta', 'img', 'link', 'br', 'hr', 'input', 'area'], - :filters => { - 'sass' => Sass::Engine, - 'plain' => Haml::Filters::Plain, - 'preserve' => Haml::Filters::Preserve } - } - - if !NOT_LOADED.include? 'redcloth' - @options[:filters].merge!({ - 'redcloth' => RedCloth, - 'textile' => Haml::Filters::Textile, - 'markdown' => Haml::Filters::Markdown - }) - end - if !NOT_LOADED.include? 'bluecloth' - @options[:filters]['markdown'] = Haml::Filters::Markdown - end - - @options.rec_merge! l_options - - unless @options[:suppress_eval] - @options[:filters].merge!({ - 'erb' => ERB, - 'ruby' => Haml::Filters::Ruby - }) - end - @options[:filters].rec_merge! l_options[:filters] if l_options[:filters] - - @template = template.strip #String - @to_close_stack = [] - @output_tabs = 0 - @template_tabs = 0 - @index = 0 - - # This is the base tabulation of the currently active - # flattened block. -1 signifies that there is no such block. - @flat_spaces = -1 - - begin - # Only do the first round of pre-compiling if we really need to. - # They might be passing in the precompiled string. - requires_precompile = true - if @@method_names[@template] - # Check that the compiled method supports a superset of the local assigns we want to do - supported_assigns = @@supported_local_assigns[@template] - requires_precompile = !@options[:locals].keys.all? {|var| supported_assigns.include? var} - end - do_precompile if requires_precompile - rescue Haml::Error => e - e.add_backtrace_entry(@index, @options[:filename]) - raise e - end - end - - # Processes the template and returns the result as a string. - def render(scope = Object.new, &block) - @scope_object = scope - @buffer = Haml::Buffer.new(@options) - - # Run the compiled evaluator function - compile &block - - # Return the result string - @buffer.buffer - end - - alias_method :to_html, :render - - # This method is deprecated and shouldn't be used. - def precompiled - $stderr.puts < old_tabs && !line.empty? - - suppress_render = handle_multiline(old_tabs, old_line, old_index) unless @flat_spaces != -1 - - if !suppress_render - line_empty = old_line.empty? - - process_indent(old_tabs, old_line) unless line_empty - flat = @flat_spaces != -1 - - - if !flat && old_spaces != old_tabs * 2 - raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.") - end - - if flat - push_flat(old_uline, old_spaces) - elsif !line_empty && !@haml_comment - process_line(old_line, old_index, block_opened) - end - - if @flat_spaces == -1 && tabs - old_tabs > 1 - raise SyntaxError.new("Illegal Indentation: Indenting more than once per line is illegal.") - end - end - end - - old_line = line - old_index = index - old_spaces = spaces - old_tabs = tabs - old_uline = uline - elsif @flat_spaces != -1 - process_indent(old_tabs, old_line) unless old_line.empty? - - if @flat_spaces != -1 - push_flat(old_line, old_spaces) - old_line = '' - old_uline = '' - old_spaces = 0 - end - end - end - - # Close all the open tags - @template_tabs.times { close } - - push_silent "@haml_is_haml = false\nend\n" - end - - # Processes and deals with lowering indentation. - def process_indent(count, line) - if count <= @template_tabs && @template_tabs > 0 - to_close = @template_tabs - count - - to_close.times do |i| - offset = to_close - 1 - i - unless offset == 0 && mid_block_keyword?(line) - close - end - end - end - end - - # Processes a single line of Haml. - # - # This method doesn't return anything; it simply processes the line and - # adds the appropriate code to @precompiled. - def process_line(line, index, block_opened) - @index = index + 1 - @block_opened = block_opened - - case line[0] - when DIV_CLASS, DIV_ID - render_div(line) - when ELEMENT - render_tag(line) - when COMMENT - render_comment(line) - when SCRIPT - sub_line = line[1..-1] - if sub_line[0] == SCRIPT - push_script(unescape_interpolation(sub_line[1..-1].strip), false) - else - push_script(sub_line, false) - end - when FLAT_SCRIPT - push_flat_script(line[1..-1]) - when SILENT_SCRIPT - sub_line = line[1..-1] - unless sub_line[0] == SILENT_COMMENT - mbk = mid_block_keyword?(line) - push_silent(sub_line, !mbk, true) - if (@block_opened && !mbk) || line[1..-1].split(' ', 2)[0] == "case" - push_and_tabulate([:script]) - end - else - start_haml_comment - end - when FILTER - name = line[1..-1].downcase - start_filtered(options[:filters][name.to_s] || name) - when DOCTYPE - if line[0...3] == '!!!' - render_doctype(line) - else - push_plain line - end - when ESCAPE - push_plain line[1..-1] - else - push_plain line - end - end - - # Returns whether or not the line is a silent script line with one - # of Ruby's mid-block keywords. - def mid_block_keyword?(line) - line.length > 2 && line[0] == SILENT_SCRIPT && MID_BLOCK_KEYWORDS.include?(line[1..-1].split[0]) - end - - # Deals with all the logic of figuring out whether a given line is - # the beginning, continuation, or end of a multiline sequence. - # - # This returns whether or not the line should be - # rendered normally. - def handle_multiline(count, line, index) - suppress_render = false - # Multilines are denoting by ending with a `|` (124) - if is_multiline?(line) && @multiline_buffer - # A multiline string is active, and is being continued - @multiline_buffer += line[0...-1] - suppress_render = true - elsif is_multiline?(line) && (MULTILINE_STARTERS.include? line[0]) - # A multiline string has just been activated, start adding the lines - @multiline_buffer = line[0...-1] - @multiline_count = count - @multiline_index = index - process_indent(count, line) - suppress_render = true - elsif @multiline_buffer - # A multiline string has just ended, make line into the result - unless line.empty? - process_line(@multiline_buffer, @multiline_index, count > @multiline_count) - @multiline_buffer = nil - end - end - - return suppress_render - end - - # Checks whether or not +line+ is in a multiline sequence. - def is_multiline?(line) # ' '[0] == 32 - line && line.length > 1 && line[-1] == MULTILINE_CHAR_VALUE && line[-2] == 32 - end - - # Method for generating compiled method names basically ripped out of ActiveView::Base - # If Haml is to be used as a standalone module without rails and still use the precompiled - # methods technique, it will end up duplicating this stuff. I can't decide whether - # checking compile times to decide whether to recompile a template belongs in here or - # out in template.rb - @@method_names = {} - @@supported_local_assigns = {} - @@render_method_count = 0 - def assign_method_name(template, file_name) - @@render_method_count += 1 - @@method_names[template] = "_render_haml_#{@@render_method_count}".intern - end - - module CompiledTemplates - # holds compiled template code - end - - # Takes @precompiled, a string buffer of Ruby code, and - # evaluates it in the context of @scope_object, after preparing - # @scope_object. The code in @precompiled populates - # @buffer with the compiled XHTML code. - def compile(&block) - # Set the local variables pointing to the buffer - buffer = @buffer - @scope_object.extend Haml::Helpers - @scope_object.instance_eval do - @haml_stack ||= Array.new - @haml_stack.push(buffer) - - class << self - attr :haml_lineno # :nodoc: - end - end - @scope_object.class.instance_eval do - include CompiledTemplates - end - - begin - method_name = @@method_names[@template] - - unless @scope_object.respond_to?(method_name) - CompiledTemplates.module_eval @precompiled - end - @scope_object.send(method_name, options[:locals], &block) - rescue Exception => e - class << e - include Haml::Error - end - - lineno = @scope_object.haml_lineno - - # Get information from the exception and format it so that - # Rails can understand it. - compile_error = e.message.scan(/\(eval\):([0-9]*):in `[-_a-zA-Z]*': compile error/)[0] - - if compile_error - if @precompiled - eval_line = compile_error[0].to_i - line_marker = @precompiled.split("\n")[0...eval_line].grep(/@haml_lineno = [0-9]*/)[-1] - lineno = line_marker.scan(/[0-9]+/)[0].to_i if line_marker - else - lineno = -1 - end - end - - e.add_backtrace_entry(lineno, @options[:filename]) - raise e - end - - # Get rid of the current buffer - @scope_object.instance_eval do - @haml_stack.pop - end - end - - # Evaluates text in the context of @scope_object, but - # does not output the result. - def push_silent(text, add_index = false, can_suppress = false) - unless (can_suppress && options[:suppress_eval]) - if add_index - @precompiled << "@haml_lineno = #{@index}\n#{text}\n" - else - # Not really DRY, but probably faster - @precompiled << "#{text}\n" - end - end - end - - # Adds text to @buffer with appropriate tabulation - # without parsing it. - def push_text(text) - @precompiled << "_hamlout.push_text(#{text.dump}, #{@output_tabs})\n" - end - - # Renders a block of text as plain text. - # Also checks for an illegally opened block. - def push_plain(text) - if @block_opened - raise SyntaxError.new("Illegal Nesting: Nesting within plain text is illegal.") - end - push_text text - end - - # Adds +text+ to @buffer while flattening text. - def push_flat(text, spaces) - tabulation = spaces - @flat_spaces - tabulation = tabulation > -1 ? tabulation : 0 - @filter_buffer << "#{' ' * tabulation}#{text}\n" - end - - # Causes text to be evaluated in the context of - # @scope_object and the result to be added to @buffer. - # - # If flattened is true, Haml::Helpers#find_and_flatten is run on - # the result before it is added to @buffer - def push_script(text, flattened) - unless options[:suppress_eval] - push_silent("haml_temp = #{text}", true) - out = "haml_temp = _hamlout.push_script(haml_temp, #{@output_tabs}, #{flattened})\n" - if @block_opened - push_and_tabulate([:loud, out]) - else - @precompiled << out - end - end - end - - # Causes text to be evaluated, and Haml::Helpers#find_and_flatten - # to be run on it afterwards. - def push_flat_script(text) - if text.empty? - raise SyntaxError.new("Tag has no content.") - else - push_script(text, true) - end - end - - def start_haml_comment - if @block_opened - @haml_comment = true - push_and_tabulate([:haml_comment]) - end - end - - # Closes the most recent item in @to_close_stack. - def close - tag, value = @to_close_stack.pop - case tag - when :script - close_block - when :comment - close_comment value - when :element - close_tag value - when :loud - close_loud value - when :filtered - close_filtered value - when :haml_comment - close_haml_comment - end - end - - # Puts a line in @precompiled that will add the closing tag of - # the most recently opened tag. - def close_tag(tag) - @output_tabs -= 1 - @template_tabs -= 1 - @precompiled << "_hamlout.close_tag(#{tag.dump}, #{@output_tabs})\n" - end - - # Closes a Ruby block. - def close_block - push_silent "end", false, true - @template_tabs -= 1 - end - - # Closes a comment. - def close_comment(has_conditional) - @output_tabs -= 1 - @template_tabs -= 1 - push_silent "_hamlout.close_comment(#{has_conditional}, #{@output_tabs})" - end - - # Closes a loud Ruby block. - def close_loud(command) - push_silent 'end', false, true - @precompiled << command - @template_tabs -= 1 - end - - # Closes a filtered block. - def close_filtered(filter) - @flat_spaces = -1 - if filter.is_a? String - if filter == 'redcloth' || filter == 'markdown' || filter == 'textile' - raise HamlError.new("You must have the RedCloth gem installed to use #{filter}") - else - raise HamlError.new("Filter \"#{filter}\" is not defined!") - end - else - filtered = filter.new(@filter_buffer).render - - unless filter == Haml::Filters::Preserve - push_text(filtered.rstrip.gsub("\n", "\n#{' ' * @output_tabs}")) - else - push_silent("_hamlout.buffer << #{filtered.dump} << \"\\n\"\n") - end - end - - @filter_buffer = nil - @template_tabs -= 1 - end - - def close_haml_comment - @haml_comment = false - @template_tabs -= 1 - end - - # Iterates through the classes and ids supplied through . - # and # syntax, and returns a hash with them as attributes, - # that can then be merged with another attributes hash. - def parse_class_and_id(list) - attributes = {} - list.scan(/([#.])([-_a-zA-Z0-9]+)/) do |type, property| - case type - when '.' - if attributes['class'] - attributes['class'] += " " - else - attributes['class'] = "" - end - attributes['class'] += property - when '#' - attributes['id'] = property - end - end - attributes - end - - def parse_literal_value(text) - text.match(LITERAL_VALUE_REGEX) - - # $2 holds the value matched by a symbol, but is nil for a string match - # $5 holds the value matched by a string - $2 || $5 - end - - def parse_literal_hash(text) - unless text - return {} - end - - attributes = {} - if inner = text.scan(/^\{(.*)\}$/)[0] - inner[0].split(',').each do |attrib| - key, value, more = attrib.split('=>') - - # Make sure the key and value and only the key and value exist - # Otherwise, it's too complicated and we'll defer it to the actual Ruby parser - if more || (key = parse_literal_value(key)).nil? || - (value = parse_literal_value(value)).nil? - return nil - end - - attributes[key] = value - end - end - attributes - end - - def build_attributes(attributes = {}) - @quote_escape = @options[:attr_wrapper] == '"' ? """ : "'" - @other_quote_char = @options[:attr_wrapper] == '"' ? "'" : '"' - - result = attributes.collect do |a,v| - v = v.to_s - unless v.nil? || v.empty? - attr_wrapper = @options[:attr_wrapper] - if v.include? attr_wrapper - if v.include? @other_quote_char - # An imperfection in LITERAL_VALUE_REGEX prevents this - # from ever actually being reached, - # but in case it becomes possible, - # I'm leaving it in. - v = v.gsub(attr_wrapper, @quote_escape) - else - attr_wrapper = @other_quote_char - end - end - " #{a}=#{attr_wrapper}#{v}#{attr_wrapper}" - end - end - result.sort.join - end - - def prerender_tag(name, atomic, attributes) - if atomic - str = " />" - else - str = ">" - end - - "<#{name}#{build_attributes(attributes)}#{str}" - end - - # Parses a line that will render as an XHTML tag, and adds the code that will - # render that tag to @precompiled. - def render_tag(line) - matched = false - line.scan(TAG_REGEX) do |tag_name, attributes, attributes_hash, object_ref, action, value| - matched = true - value = value.to_s.strip - - case action - when '/' - atomic = true - when '=', '~' - parse = true - - if value[0] == ?= - value = value[1..-1].strip.dump.gsub('\\#', '#') - end - end - - flattened = (action == '~') - - value_exists = !value.empty? - literal_attributes = parse_literal_hash(attributes_hash) - attributes_hash = "{nil}" if attributes_hash.nil? || literal_attributes || @options[:suppress_eval] - object_ref = "nil" if object_ref.nil? || @options[:suppress_eval] - - if attributes =~ /[\.#](\.|#|\z)/ - raise SyntaxError.new("Illegal element: classes and ids must have values. Use %div instead.") - end - - # Preparse the attributes hash - attributes = parse_class_and_id(attributes) - Buffer.merge_attrs(attributes, literal_attributes) if literal_attributes - - if @block_opened - if atomic - raise SyntaxError.new("Illegal Nesting: Nesting within an atomic tag is illegal.") - elsif action == '=' || value_exists - raise SyntaxError.new("Illegal Nesting: Nesting within a tag that already has content is illegal.") - end - elsif atomic && value_exists - raise SyntaxError.new("Atomic tags can't have content.") - elsif parse && !value_exists - raise SyntaxError.new("Tag has no content.") - end - - if !@block_opened && !value_exists && @options[:autoclose].include?(tag_name) - atomic = true - end - - do_one_liner = value_exists && !parse && Buffer.one_liner?(value) - - if object_ref == "nil" && attributes_hash == "{nil}" && !flattened && (do_one_liner || !value_exists) - # This means that we can render the tag directly to text and not process it in the buffer - open_tag = prerender_tag(tag_name, atomic, attributes) - - if do_one_liner - open_tag += value - open_tag += "" - end - - open_tag += "\n" - - push_silent "_hamlout.open_prerendered_tag(#{open_tag.dump}, #{@output_tabs})" - return if do_one_liner - else - push_silent "_hamlout.open_tag(#{tag_name.inspect}, #{@output_tabs}, #{atomic.inspect}, #{value_exists.inspect}, #{attributes.inspect}, #{object_ref}, #{attributes_hash[1...-1]})", true - end - - unless atomic - push_and_tabulate([:element, tag_name]) - @output_tabs += 1 - - if value_exists - if parse - push_script(value, flattened) - else - push_text(value) - end - close - elsif flattened - raise SyntaxError.new("Tag has no content.") - end - end - end - - unless matched - raise SyntaxError.new("Invalid tag: \"#{line}\"") - end - end - - # Renders a line that creates an XHTML tag and has an implicit div because of - # . or #. - def render_div(line) - render_tag('%div' + line) - end - - # Renders an XHTML comment. - def render_comment(line) - conditional, content = line.scan(COMMENT_REGEX)[0] - content.strip! - - if @block_opened && !content.empty? - raise SyntaxError.new('Illegal Nesting: Nesting within a tag that already has content is illegal.') - end - - try_one_line = !content.empty? - push_silent "_hamlout.open_comment(#{try_one_line}, #{conditional.inspect}, #{@output_tabs})" - @output_tabs += 1 - push_and_tabulate([:comment, !conditional.nil?]) - if try_one_line - push_text content - close - end - end - - # Renders an XHTML doctype or XML shebang. - def render_doctype(line) - if @block_opened - raise SyntaxError.new("Illegal Nesting: Nesting within a header command is illegal.") - end - line = line[3..-1].lstrip.downcase - if line[0...3] == "xml" - encoding = line.split[1] || "utf-8" - wrapper = @options[:attr_wrapper] - doctype = "" - else - version, type = line.scan(DOCTYPE_REGEX)[0] - if version == "1.1" - doctype = '' - else - case type - when "strict" - doctype = '' - when "frameset" - doctype = '' - else - doctype = '' - end - end - end - push_text doctype - end - - # Starts a filtered block. - def start_filtered(filter) - unless @block_opened - raise SyntaxError.new('Filters must have nested text.') - end - push_and_tabulate([:filtered, filter]) - @flat_spaces = @template_tabs * 2 - @filter_buffer = String.new - end - - def unescape_interpolation(str) - str.dump.gsub('\\#', '#').gsub(/\#\{[^\}]+\}/) do |substr| - substr.gsub('\\"', '"') - end - end - - # Counts the tabulation of a line. - def count_soft_tabs(line) - spaces = line.index(/[^ ]/) - if line[spaces] == ?\t - return nil if line.strip.empty? - - raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.") - end - [spaces, spaces/2] - end - - # Pushes value onto @to_close_stack and increases - # @template_tabs. - def push_and_tabulate(value) - @to_close_stack.push(value) - @template_tabs += 1 - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/error.rb b/vendor/gems/haml-1.7.2/lib/haml/error.rb deleted file mode 100644 index 078eb24..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/error.rb +++ /dev/null @@ -1,43 +0,0 @@ -module Haml - # The abstract type of exception raised by Haml code. - # Haml::SyntaxError includes this module, - # as do all exceptions raised by Ruby code within Haml. - # - # Haml::Error encapsulates information about the exception, - # such as the line of the Haml template it was raised on - # and the Haml file that was being parsed (if applicable). - # It also provides a handy way to rescue only exceptions raised - # because of a faulty template. - module Error - # The line of the Haml template on which the exception was thrown. - attr_reader :haml_line - - # The name of the file that was being parsed when the exception was raised. - # This will be nil unless Haml is being used as an ActionView plugin. - attr_reader :haml_filename - - # Adds a properly formatted entry to the exception's backtrace. - # +lineno+ should be the line on which the error occurred. - # +filename+ should be the file in which the error occurred, - # if applicable (defaults to "(haml)"). - def add_backtrace_entry(lineno, filename = nil) # :nodoc: - @haml_line = lineno - @haml_filename = filename - self.backtrace ||= [] - self.backtrace.unshift "#{filename || '(haml)'}:#{lineno}" - end - end - - # SyntaxError is the type of exception raised when Haml encounters an - # ill-formatted document. - # It's not particularly interesting, except in that it includes Haml::Error. - class SyntaxError < StandardError - include Haml::Error - end - - # HamlError is the type of exception raised when Haml encounters an error - # not of a syntactical nature, such as an undefined Filter. - class HamlError < StandardError - include Haml::Error - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/exec.rb b/vendor/gems/haml-1.7.2/lib/haml/exec.rb deleted file mode 100644 index fd6cd1f..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/exec.rb +++ /dev/null @@ -1,296 +0,0 @@ -require File.dirname(__FILE__) + '/../haml' -require 'optparse' - -module Haml - # This module contains code for working with the - # haml, sass, and haml2html executables, - # such as command-line parsing stuff. - # It shouldn't need to be invoked by client code. - module Exec # :nodoc: - # A class that encapsulates the executable code - # for all three executables. - class Generic # :nodoc: - def initialize(args) - @args = args - @options = {} - end - - def parse! - begin - @opts = OptionParser.new(&(method(:set_opts).to_proc)) - @opts.parse!(@args) - - process_result - - @options - rescue Exception => e - raise e if e.is_a? SystemExit - - line = e.backtrace[0].scan(/:(.*)/)[0] - puts "#{e.class} on line #{line}: #{e.message}" - - if @options[:trace] - e.backtrace[1..-1].each { |t| puts " #{t}" } - else - puts " Use --trace to see traceback" - end - - exit 1 - end - exit 0 - end - - def to_s - @opts.to_s - end - - private - - def set_opts(opts) - opts.on('--stdin', :NONE, 'Read input from standard input instead of an input file') do - @options[:input] = $stdin - end - - opts.on('--stdout', :NONE, 'Print output to standard output instead of an output file') do - @options[:output] = $stdout - end - - opts.on('-s', '--stdio', 'Read input from standard input and print output to standard output') do - @options[:input] = $stdin - @options[:output] = $stdout - end - - opts.on('--trace', :NONE, 'Show a full traceback on error') do - @options[:trace] = true - end - - opts.on_tail("-?", "-h", "--help", "Show this message") do - puts opts - exit - end - - opts.on_tail("-v", "--version", "Print version") do - puts("Haml " + File.read(File.dirname(__FILE__) + '/../../VERSION')) - exit - end - end - - def process_result - input = @options[:input] - output = @options[:output] - - if input - output ||= ARGV[0] - else - input ||= ARGV[0] - output ||= ARGV[1] - end - - unless input && output - puts @opts - exit 1 - end - - if input.is_a?(String) && !File.exists?(input) - puts "File #{input} doesn't exist!" - exit 1 - end - - unless input.is_a? IO - input = File.open(input) - input_file = true - end - - unless output.is_a? IO - output = File.open(output, "w") - output_file = true - end - - @options[:input] = input - @options[:output] = output - end - end - - # A class encapsulating the executable functionality - # specific to Haml and Sass. - class HamlSass < Generic # :nodoc: - private - - def set_opts(opts) - opts.banner = < err - dep = err.message.scan(/^no such file to load -- (.*)/)[0] - puts "Required dependency #{dep} not found!" - exit 1 - end - end - - def set_opts(opts) - opts.banner = <]*>(.*?)<\/\1>/im) do |tag, contents| - input = input.gsub(contents, preserve(contents)) - end - input - end - - # Takes any string, finds all the endlines and converts them to - # HTML entities for endlines so they'll render correctly in - # whitespace-sensitive tags without screwing up the indentation. - def preserve(input) - input.gsub(/\n/, ' ').gsub(/\r/, '') - end - - alias_method :flatten, :preserve - - # Takes an Enumerable object and a block - # and iterates over the object, - # yielding each element to a Haml block - # and putting the result into
  • elements. - # This creates a list of the results of the block. - # For example: - # - # = list_of([['hello'], ['yall']]) do |i| - # = i[0] - # - # Produces: - # - #
  • hello
  • - #
  • yall
  • - # - # And - # - # = list_of({:title => 'All the stuff', :description => 'A book about all the stuff.'}) do |key, val| - # %h3= key.humanize - # %p= val - # - # Produces: - # - #
  • - #

    Title

    - #

    All the stuff

    - #
  • - #
  • - #

    Description

    - #

    A book about all the stuff.

    - #
  • - # - def list_of(array, &block) # :yields: item - to_return = array.collect do |i| - result = capture_haml(i, &block) - - if result.count("\n") > 1 - result.gsub!("\n", "\n ") - result = "\n #{result.strip}\n" - else - result.strip! - end - - "
  • #{result}
  • " - end - to_return.join("\n") - end - - # Returns a hash containing default assignments for the xmlns and xml:lang - # attributes of the html HTML element. - # It also takes an optional argument for the value of xml:lang and lang, - # which defaults to 'en-US'. - # For example, - # - # %html{html_attrs} - # - # becomes - # - # - # - def html_attrs(lang = 'en-US') - {:xmlns => "http://www.w3.org/1999/xhtml", 'xml:lang' => lang, :lang => lang} - end - - # Increments the number of tabs the buffer automatically adds - # to the lines of the template. - # For example: - # - # %h1 foo - # - tab_up - # %p bar - # - tab_down - # %strong baz - # - # Produces: - # - #

    foo

    - #

    bar

    - # baz - # - def tab_up(i = 1) - buffer.tabulation += i - end - - # Increments the number of tabs the buffer automatically adds - # to the lines of the template. - # - # See tab_up. - def tab_down(i = 1) - buffer.tabulation -= i - end - - # Surrounds the given block of Haml code with the given characters, - # with no whitespace in between. - # For example: - # - # = surround '(', ')' do - # %a{:href => "food"} chicken - # - # Produces: - # - # (chicken) - # - # and - # - # = surround '*' do - # %strong angry - # - # Produces: - # - # *angry* - # - def surround(front, back = nil, &block) - back ||= front - output = capture_haml(&block) - - "#{front}#{output.chomp}#{back}\n" - end - - # Prepends the given character to the beginning of the Haml block, - # with no whitespace between. - # For example: - # - # = precede '*' do - # %span.small Not really - # - # Produces: - # - # *Not really - # - def precede(char, &block) - "#{char}#{capture_haml(&block).chomp}\n" - end - - # Appends the given character to the end of the Haml block, - # with no whitespace between. - # For example: - # - # click - # = succeed '.' do - # %a{:href=>"thing"} here - # - # Produces: - # - # click - # here. - # - def succeed(char, &block) - "#{capture_haml(&block).chomp}#{char}\n" - end - - # Captures the result of the given block of Haml code, - # gets rid of the excess indentation, - # and returns it as a string. - # For example, after the following, - # - # .foo - # - foo = capture_haml(13) do |a| - # %p= a - # - # the local variable foo would be assigned to "

    13

    \n". - # - def capture_haml(*args, &block) - capture_haml_with_buffer(buffer.buffer, *args, &block) - end - - # Outputs text directly to the Haml buffer, with the proper tabulation - def puts(text = "") - buffer.buffer << (' ' * buffer.tabulation) << text.to_s << "\n" - nil - end - - # - # call-seq: - # open(name, attributes = {}) {...} - # open(name, text, attributes = {}) {...} - # - # Creates an HTML tag with the given name and optionally text and attributes. - # Can take a block that will be executed - # between when the opening and closing tags are output. - # If the block is a Haml block or outputs text using puts, - # the text will be properly indented. - # - # For example, - # - # open :table do - # open :tr do - # open :td, {:class => 'cell'} do - # open :strong, "strong!" - # puts "data" - # end - # open :td do - # puts "more_data" - # end - # end - # end - # - # outputs - # - # - # - # - # - # - #
    - # - # strong! - # - # data - # - # more_data - #
    - # - def open(name, attributes = {}, alt_atts = {}, &block) - text = nil - if attributes.is_a? String - text = attributes - attributes = alt_atts - end - - puts "<#{name}#{buffer.build_attributes(attributes)}>" - tab_up - # Print out either the text (using push_text) or call the block and add an endline - if text - puts(text) - elsif block - block.call - end - tab_down - puts "" - nil - end - - private - - # Gets a reference to the current Haml::Buffer object. - def buffer - @haml_stack[-1] - end - - # Gives a proc the same local "_hamlout" and "_erbout" variables - # that the current template has. - def bind_proc(&proc) - _hamlout = buffer - _erbout = _hamlout.buffer - proc { |*args| proc.call(*args) } - end - - # Performs the function of capture_haml, assuming local_buffer - # is where the output of block goes. - def capture_haml_with_buffer(local_buffer, *args, &block) - position = local_buffer.length - - block.call *args - - captured = local_buffer.slice!(position..-1) - - min_tabs = nil - captured.each do |line| - tabs = line.index(/[^ ]/) - min_tabs ||= tabs - min_tabs = min_tabs > tabs ? tabs : min_tabs - end - - result = captured.map do |line| - line[min_tabs..-1] - end - result.to_s - end - - # Returns whether or not the current template is a Haml template. - # - # This function, unlike other Haml::Helpers functions, - # also works in other ActionView templates, - # where it will always return false. - def is_haml? - @haml_is_haml - end - - include ActionViewExtensions if self.const_defined? "ActionViewExtensions" - end -end - -module ActionView - class Base # :nodoc: - def is_haml? - false - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_extensions.rb b/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_extensions.rb deleted file mode 100644 index 53329b3..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_extensions.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'haml/helpers/action_view_mods' - -if defined?(ActionView) - module Haml - module Helpers - # This module contains various useful helper methods - # that either tie into ActionView or the rest of the ActionPack stack, - # or are only useful in that context. - # Thus, the methods defined here are only available - # if ActionView is installed. - module ActionViewExtensions - # Returns a value for the "class" attribute - # unique to this controller/action pair. - # This can be used to target styles specifically at this action or controller. - # For example, if the current action were EntryController#show, - # - # %div{:class => page_class} My Div - # - # would become - # - #
    My Div
    - # - # Then, in a stylesheet - # (shown here as Sass), - # you could refer to this specific action: - # - # .entry.show - # :font-weight bold - # - # or to all actions in the entry controller: - # - # .entry - # :color #00f - # - def page_class - controller.controller_name + " " + controller.action_name - end - - # :stopdoc: - alias_method :generate_content_class_names, :page_class - # :startdoc: - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_mods.rb b/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_mods.rb deleted file mode 100644 index ee2da7a..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_mods.rb +++ /dev/null @@ -1,86 +0,0 @@ -if defined?(ActionView) and not defined?(Merb::Plugins) - module ActionView - class Base # :nodoc: - def render_with_haml(*args, &block) - was_haml = is_haml? - @haml_is_haml = false - res = render_without_haml(*args, &block) - @haml_is_haml = was_haml - res - end - alias_method :render_without_haml, :render - alias_method :render, :render_with_haml - end - - # This overrides various helpers in ActionView - # to make them work more effectively with Haml. - module Helpers - # :stopdoc: - module CaptureHelper - def capture_erb_with_buffer_with_haml(*args, &block) - if is_haml? - capture_haml_with_buffer(*args, &block) - else - capture_erb_with_buffer_without_haml(*args, &block) - end - end - alias_method :capture_erb_with_buffer_without_haml, :capture_erb_with_buffer - alias_method :capture_erb_with_buffer, :capture_erb_with_buffer_with_haml - end - - module TextHelper - def concat_with_haml(string, binding = nil) - if is_haml? - buffer.buffer.concat(string) - else - concat_without_haml(string, binding) - end - end - alias_method :concat_without_haml, :concat - alias_method :concat, :concat_with_haml - end - - module FormTagHelper - def form_tag_with_haml(url_for_options = {}, options = {}, *parameters_for_url, &proc) - if is_haml? - if block_given? - oldproc = proc - proc = bind_proc do |*args| - concat "\n" - tab_up - oldproc.call(*args) - tab_down - end - end - res = form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc) + "\n" - concat "\n" if block_given? && is_haml? - res - else - form_tag_without_haml(url_for_options, options, *parameters_for_url, &proc) - end - end - alias_method :form_tag_without_haml, :form_tag - alias_method :form_tag, :form_tag_with_haml - end - - module FormHelper - def form_for_with_haml(object_name, *args, &proc) - if block_given? && is_haml? - oldproc = proc - proc = bind_proc do |*args| - tab_up - oldproc.call(*args) - tab_down - end - end - form_for_without_haml(object_name, *args, &proc) - concat "\n" if block_given? && is_haml? - end - alias_method :form_for_without_haml, :form_for - alias_method :form_for, :form_for_with_haml - end - # :startdoc: - end - end -end - diff --git a/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_mods.rb.rej b/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_mods.rb.rej deleted file mode 100644 index 2c8a0f5..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/helpers/action_view_mods.rb.rej +++ /dev/null @@ -1,30 +0,0 @@ -*************** -*** 1,11 **** -- begin -- require 'rubygems' -- require 'active_support' -- require 'action_controller' -- require 'action_view' -- action_view_included = true -- rescue LoadError -- action_view_included = false - end - - ---- 1,16 ---- -+ -+ # This obviously requires that ActiveSupport be present prior to Haml -+ # being loaded. -+ action_view_included = false -+ if defined?(ActiveSupport) -+ begin -+ require 'rubygems' -+ require 'active_support' -+ require 'action_controller' -+ require 'action_view' -+ action_view_included = true -+ rescue LoadError -+ end - end - - diff --git a/vendor/gems/haml-1.7.2/lib/haml/html.rb b/vendor/gems/haml-1.7.2/lib/haml/html.rb deleted file mode 100644 index da388d1..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/html.rb +++ /dev/null @@ -1,173 +0,0 @@ -require File.dirname(__FILE__) + '/../haml' - -require 'haml/engine' -require 'rubygems' -require 'hpricot' -require 'cgi' - -module Haml - # This class contains the functionality used in the +html2haml+ utility, - # namely converting HTML documents to Haml templates. - # It depends on Hpricot for HTML parsing (http://code.whytheluckystiff.net/hpricot/). - class HTML - # Creates a new instance of Haml::HTML that will compile the given template, - # which can either be a string containing HTML or an Hpricot node, - # to a Haml string when +render+ is called. - def initialize(template, options = {}) - @@options = options - - if template.is_a? Hpricot::Node - @template = template - else - if template.is_a? IO - template = template.read - end - - if @@options[:rhtml] - match_to_html(template, /<%=(.*?)-?%>/m, 'loud') - match_to_html(template, /<%(.*?)-?%>/m, 'silent') - end - @template = Hpricot(template) - end - end - - # Processes the document and returns the result as a string - # containing the Haml template. - def render - @template.to_haml(0) - end - alias_method :to_haml, :render - - module ::Hpricot::Node - # Returns the Haml representation of the given node, - # at the given tabulation. - def to_haml(tabs = 0) - parse_text(self.to_s, tabs) - end - - private - - def tabulate(tabs) - ' ' * tabs - end - - def parse_text(text, tabs) - text.strip! - if text.empty? - String.new - else - lines = text.split("\n") - - lines.map do |line| - line.strip! - "#{tabulate(tabs)}#{'\\' if Haml::Engine::SPECIAL_CHARACTERS.include?(line[0])}#{line}\n" - end.join - end - end - end - - # :stopdoc: - - def self.options - @@options - end - - TEXT_REGEXP = /^(\s*).*$/ - - class ::Hpricot::Doc - def to_haml(tabs = 0) - output = '' - children.each { |child| output += child.to_haml(0) } - output - end - end - - class ::Hpricot::XMLDecl - def to_haml(tabs = 0) - "#{tabulate(tabs)}!!! XML\n" - end - end - - class ::Hpricot::DocType - def to_haml(tabs = 0) - attrs = public_id.scan(/DTD\s+([^\s]+)\s*([^\s]*)\s*([^\s]*)\s*\/\//)[0] - if attrs == nil - raise Exception.new("Invalid doctype") - end - - type, version, strictness = attrs.map { |a| a.downcase } - if type == "html" - version = "1.0" - strictness = "transitional" - end - - if version == "1.0" || version.empty? - version = nil - end - - if strictness == 'transitional' || strictness.empty? - strictness = nil - end - - version = " #{version}" if version - if strictness - strictness[0] = strictness[0] - 32 - strictness = " #{strictness}" - end - - "#{tabulate(tabs)}!!!#{version}#{strictness}\n" - end - end - - class ::Hpricot::Comment - def to_haml(tabs = 0) - "#{tabulate(tabs)}/\n#{parse_text(self.content, tabs + 1)}" - end - end - - class ::Hpricot::Elem - def to_haml(tabs = 0) - output = "#{tabulate(tabs)}" - if HTML.options[:rhtml] && name[0...5] == 'haml:' - return output + HTML.send("haml_tag_#{name[5..-1]}", self.innerHTML) - end - - output += "%#{name}" unless name == 'div' && (attributes.include?('id') || attributes.include?('class')) - - if attributes - output += "##{attributes['id']}" if attributes['id'] - attributes['class'].split(' ').each { |c| output += ".#{c}" } if attributes['class'] - attributes.delete("id") - attributes.delete("class") - output += attributes.inspect if attributes.length > 0 - end - - output += "/" if children.length == 0 - output += "\n" - - self.children.each do |child| - output += child.to_haml(tabs + 1) - end - - output - end - end - - def self.haml_tag_loud(text) - "= #{text.gsub(/\n\s*/, '; ').strip}\n" - end - - def self.haml_tag_silent(text) - text.split("\n").map { |line| "- #{line.strip}\n" }.join - end - - private - - def match_to_html(string, regex, tag) - string.gsub!(regex) do - "#{CGI.escapeHTML($1)}" - end - end - # :startdoc: - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/template.rb b/vendor/gems/haml-1.7.2/lib/haml/template.rb deleted file mode 100644 index 6ad7d65..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/template.rb +++ /dev/null @@ -1,99 +0,0 @@ -require 'haml/engine' -require 'rubygems' -require 'active_support' -require 'action_view' - -module Haml - # This class interfaces with ActionView - # to make Haml usable as a Ruby on Rails plugin. - # It usually shouldn't need to be used by end users. - # Just in case, though, here's what you might do to render - # templates/index.haml: - # - # ActionView::Base.register_template_handler("haml", Haml::Template) - # base = ActionView::Base.new("templates") - # base.render("index") - # - # Or, if you want to really get into the nitty-gritty: - # - # base = ActionView::Base.new - # template = Haml::Template.new(base) - # template.render("templates/index.haml") - # - class Template - - class << self - @@options = {} - - # Gets various options for Haml. See README for details. - def options - @@options - end - - # Sets various options for Haml. See README for details. - def options=(value) - @@options = value - end - end - - # Creates a new Haml::Template object that uses view - # to render its templates. - def initialize(view) - @view = view - end - - # Renders the file at the location template, - # with local_assigns available as local variables within the template. - # Returns the result as a string. - def render(template, local_assigns={}) - @view.instance_eval do - evaluate_assigns - end - - options = @@options.dup - locals = options[:locals] || {} - locals.merge! local_assigns - options[:locals] = locals - - if @view.haml_inline - engine = Haml::Engine.new(template, options) - else - options[:filename] ||= template - engine = Haml::Engine.new(File.read(template), options) - end - - yield_proc = @view.instance_eval do - proc { |*name| instance_variable_get("@content_for_#{name.first || 'layout'}") } - end - - engine.to_html(@view) { |*args| yield_proc.call(*args) } - - end - end -end - -# This module refers to the ActionView module that's part of Ruby on Rails. -# Haml can be used as an alternate templating engine for it, -# and includes several modifications to make it more Haml-friendly. -# The documentation can be found -# here[http://rubyonrails.org/api/classes/ActionView/Base.html]. -module ActionView - class Base # :nodoc: - attr :haml_inline - - alias_method :read_template_file_old, :read_template_file - def read_template_file(template_path, extension) - if extension =~ /haml/i - template_path - else - read_template_file_old(template_path, extension) - end - end - - alias_method :render_template_old, :render_template - def render_template(template_extension, template, file_path = nil, local_assigns = {}) - @haml_inline = !template.nil? - render_template_old(template_extension, template, file_path, local_assigns) - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/haml/util.rb b/vendor/gems/haml-1.7.2/lib/haml/util.rb deleted file mode 100644 index b899e2e..0000000 --- a/vendor/gems/haml-1.7.2/lib/haml/util.rb +++ /dev/null @@ -1,18 +0,0 @@ -# This file contains various useful bits of code -# that are shared between Haml and Sass. - -class Hash # :nodoc: - # Same as Hash#merge!, - # but recursively merges sub-hashes - def rec_merge!(other) - other.each do |key, value| - myval = self[key] - if value.is_a?(Hash) && myval.is_a?(Hash) - myval.rec_merge!(value) - else - self[key] = value - end - end - self - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass.rb b/vendor/gems/haml-1.7.2/lib/sass.rb deleted file mode 100644 index 590f70c..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass.rb +++ /dev/null @@ -1,613 +0,0 @@ -dir = File.dirname(__FILE__) -$LOAD_PATH << dir unless $LOAD_PATH.include?(dir) - -# = Sass (Syntactically Awesome StyleSheets) -# -# Sass is a meta-language on top of CSS -# that's used to describe the style of a document -# cleanly and structurally, -# with more power than flat CSS allows. -# Sass both provides a simpler, more elegant syntax for CSS -# and implements various features that are useful -# for creating manageable stylesheets. -# -# == Features -# -# * Whitespace active -# * Well-formatted output -# * Elegant input -# * Feature-rich -# -# == Using Sass -# -# Sass can be used in several ways: -# As a plugin for Ruby on Rails or Merb, -# or as a standalone parser. -# Sass is bundled with Haml, -# so if the Haml plugin or RubyGem is installed, -# Sass will already be installed as a plugin or gem, respectively. -# The first step for all of these is to install the Haml gem: -# -# gem install haml -# -# To enable it as a Rails plugin, -# then run -# -# haml --rails path/to/rails/app -# -# To enable Sass in Merb, -# add -# -# dependency "haml" -# -# to config/dependencies.rb. -# -# Sass templates in Rails and Merb don't quite function in the same way as views, -# because they don't contain dynamic content, -# and so only need to be compiled when the template file has been updated. -# By default (see options, below), -# ".sass" files are placed in public/stylesheets/sass. -# Then, whenever necessary, they're compiled into corresponding CSS files in public/stylesheets. -# For instance, public/stylesheets/sass/main.sass would be compiled to public/stylesheets/main.css. -# -# Using Sass in Ruby code is very simple. -# After installing the Haml gem, -# you can use it by running require "sass" -# and using Sass::Engine like so: -# -# engine = Sass::Engine.new("#main\n :background-color #0000ff") -# engine.render #=> "#main { background-color: #0000ff; }\n" -# -# == CSS Rules -# -# Rules in flat CSS have two elements: -# the selector -# (e.g. "#main", "div p", "li a:hover") -# and the attributes -# (e.g. "color: #00ff00;", "width: 5em;"). -# -# Sass has both of these, -# as well as one additional element: nested rules. -# -# === Rules and Selectors -# -# However, some of the syntax is a little different. -# The syntax for selectors is the same, -# but instead of using brackets to delineate the attributes that belong to a particular rule, -# Sass uses two spaces of indentation. -# For example: -# -# #main p -# -# -# ... -# -# === Attributes -# -# There are two different ways to write CSS attrbibutes. -# The first is very similar to the how you're used to writing them: -# with a colon between the name and the value. -# However, Sass attributes don't have semicolons at the end; -# each attribute is on its own line, so they aren't necessary. -# For example: -# -# #main p -# color: #00ff00 -# width: 97% -# -# is compiled to: -# -# #main p { -# color: #00ff00; -# width: 97% } -# -# The second syntax for attributes is slightly different. -# The colon is at the beginning of the attribute, -# rather than between the name and the value, -# so it's easier to tell what elements are attributes just by glancing at them. -# For example: -# -# #main p -# :color #00ff00 -# :width 97% -# -# is compiled to: -# -# #main p { -# color: #00ff00; -# width: 97% } -# -# === Nested Rules -# -# Rules can also be nested within each other. -# This signifies that the inner rule's selector is a child of the outer selector. -# For example: -# -# #main p -# :color #00ff00 -# :width 97% -# -# .redbox -# :background-color #ff0000 -# :color #000000 -# -# is compiled to: -# -# #main p { -# color: #00ff00; -# width: 97%; } -# #main p .redbox { -# background-color: #ff0000; -# color: #000000; } -# -# This makes insanely complicated CSS layouts with lots of nested selectors very simple: -# -# #main -# :width 97% -# -# p, div -# :font-size 2em -# a -# :font-weight bold -# -# pre -# :font-size 3em -# -# is compiled to: -# -# #main { -# width: 97%; } -# #main p, #main div { -# font-size: 2em; } -# #main p a, #main div a { -# font-weight: bold; } -# #main pre { -# font-size: 3em; } -# -# === Referencing Parent Rules -# -# In addition to the default behavior of inserting the parent selector -# as a CSS parent of the current selector -# (e.g. above, "#main" is the parent of "p"), -# you can have more fine-grained control over what's done with the parent selector -# by using the ampersand character "&" in your selectors. -# -# The ampersand is automatically replaced by the parent selector, -# instead of having it prepended. -# This allows you to cleanly create pseudo-attributes: -# -# a -# :font-weight bold -# :text-decoration none -# &:hover -# :text-decoration underline -# &:visited -# :font-weight normal -# -# Which would become: -# -# a { -# font-weight: bold; -# text-decoration: none; } -# a:hover { -# text-decoration: underline; } -# a:visited { -# font-weight: normal; } -# -# It also allows you to add selectors at the base of the hierarchy, -# which can be useuful for targeting certain styles to certain browsers: -# -# #main -# :width 90% -# #sidebar -# :float left -# :margin-left 20% -# .ie6 & -# :margin-left 40% -# -# Which would become: -# -# #main { -# width: 90%; } -# #main #sidebar { -# float: left; -# margin-left: 20%; } -# .ie6 #main #sidebar { -# margin-left: 40%; } -# -# === Attribute Namespaces -# -# CSS has quite a few attributes that are in "namespaces;" -# for instance, "font-family," "font-size," and "font-weight" -# are all in the "font" namespace. -# In CSS, if you want to set a bunch of attributes in the same namespace, -# you have to type it out each time. -# Sass offers a shortcut for this: -# just write the namespace one, -# then indent each of the sub-attributes within it. -# For example: -# -# .funky -# :font -# :family fantasy -# :size 30em -# :weight bold -# -# is compiled to: -# -# .funky { -# font-family: fantasy; -# font-size: 30em; -# font-weight: bold; } -# -# == Constants -# -# Sass has support for setting document-wide constants. -# They're set using an exclamation mark followed by the name, -# an equals sign, and the value. -# An attribute can then be set to the value of a constant -# by following it with another equals sign. -# For example: -# -# !main_color = #00ff00 -# -# #main -# :color = !main_color -# :p -# :background-color = !main_color -# :color #000000 -# -# is compiled to: -# -# #main { -# color: #00ff00; } -# #main p { -# background-color: #00ff00; -# color: #000000; } -# -# === Arithmetic -# -# You can even do basic arithmetic with constants. -# Sass recognizes numbers, colors, -# lengths (numbers with units), -# and strings (everything that's not one of the above), -# and various operators that work on various values. -# All the normal arithmetic operators -# (+, -, *, /, %, and parentheses for grouping) -# are defined as usual -# for numbers, colors, and lengths. -# The "+" operator is also defined for Strings -# as the concatenation operator. -# For example: -# -# !main_width = 10 -# !unit1 = em -# !unit2 = px -# !bg_color = #a5f39e -# -# #main -# :background-color = !bg_color -# p -# :background-color = !bg_color + #202020 -# :width = !main_width + !unit1 -# img.thumb -# :width = (!main_width + 15) + !unit2 -# -# is compiled to: -# -# #main { -# background-color: #a5f39e; } -# #main p { -# background-color: #c5ffbe; -# width: 10em; } -# #main img.thumb { -# width: 25em; } -# -# === Colors -# -# Colors may be written as three- or six-digit hex numbers prefixed -# by a pound sign (#), or as HTML4 color names. For example, -# "#ff0", "#ffff00" and "yellow" all refer to the same color. -# -# Not only can arithmetic be done between colors and other colors, -# but it can be done between colors and normal numbers. -# In this case, the operation is done piecewise one each of the -# Red, Green, and Blue components of the color. -# For example: -# -# !main_color = #a5f39e -# -# #main -# :background-color = !main_color -# p -# :background-color = !main_color + 32 -# -# is compiled to: -# -# #main { -# background-color: #a5f39e; } -# #main p { -# background-color: #c5ffbe; } -# -# === Strings -# -# Strings are the type that's used by default -# when an element in a bit of constant arithmetic isn't recognized -# as another type of constant. -# However, they can also be created explicitly be wrapping a section of code with quotation marks. -# Inside the quotation marks, -# a backslash can be used to -# escape quotation marks that you want to appear in the CSS. -# For example: -# -# !content = "Hello, \"Hubert\" Bean." -# -# #main -# :content = "string(" + !content + ")" -# -# is compiled to: -# -# #main { -# content: string(Hello, "Hubert" Bean.) } -# -# === Default Concatenation -# -# All those plusses and quotes for concatenating strings -# can get pretty messy, though. -# Most of the time, if you want to concatenate stuff, -# you just want individual values with spaces in between them. -# Thus, in Sass, when two values are next to each other without an operator, -# they're simply joined with a space. -# For example: -# -# !font_family = "sans-serif" -# !main_font_size = 1em -# -# #main -# :font -# :family = !font_family -# :size = !main_font_size -# h6 -# :font = italic "small-caps" bold (!main_font_size + 0.1em) !font_family -# -# is compiled to: -# -# #main { -# font-family: sans-serif; -# font-size: 1em; } -# #main h6 { -# font: italic small-caps bold 1.1em sans-serif; } -# -# == Directives -# -# Directives allow the author to directly issue instructions to the Sass compiler. -# They're prefixed with an at sign, "@", -# followed by the name of the directive, -# a space, and any arguments to it - -# just like CSS directives. -# For example: -# -# @import red.sass -# -# === Import -# -# Currently, the only directive is the "import" directive. -# It works in a very similar way to the CSS import directive, -# and sometimes compiles to a literal CSS "@import". -# -# Sass can import either other Sass files or plain CSS files. -# If it imports a Sass file, -# not only are the rules from that file included, -# but all constants in that file are made available in the current file. -# -# Sass looks for other Sass files in the working directory, -# and the Sass file directory under Rails or Merb. -# Additional search directories may be specified -# using the :load_paths option (see below). -# -# Sass can also import plain CSS files. -# In this case, it doesn't literally include the content of the files; -# rather, it uses the built-in CSS "@import" directive to tell the client program -# to import the files. -# -# The import directive can take either a full filename -# or a filename without an extension. -# If an extension isn't provided, -# Sass will try to find a Sass file with the given basename in the load paths, -# and, failing that, will assume a relevant CSS file will be available. -# -# For example, -# -# @import foo.sass -# -# would compile to -# -# .foo -# :color #f00 -# -# whereas -# -# @import foo.css -# -# would compile to -# -# @import foo.css -# -# Finally, -# -# @import foo -# -# might compile to either, -# depending on whether a file called "foo.sass" existed. -# -# == Comments -# -# === Silent Comments -# -# It's simple to add "silent" comments, -# which don't output anything to the CSS document, -# to a Sass document. -# Simply use the familiar C-style notation for a one-line comment, "//", -# at the normal indentation level and all text following it won't be output. -# For example: -# -# // A very awesome rule. -# #awesome.rule -# // An equally awesome attribute. -# :awesomeness very -# -# becomes -# -# #awesome.rule { -# awesomeness: very; } -# -# === Loud Comments -# -# "Loud" comments are just as easy as silent ones. -# These comments output to the document as CSS comments, -# and thus use the same opening sequence: "/*". -# For example: -# -# /* A very awesome rule. -# #awesome.rule -# /* An equally awesome attribute. -# :awesomeness very -# -# becomes -# -# /* A very awesome rule. */ -# #awesome.rule { -# /* An equally awesome attribute. */ -# awesomeness: very; } -# -# == Output Style -# -# Although the default CSS style that Sass outputs is very nice, -# and reflects the structure of the document in a similar way that Sass does, -# sometimes it's good to have other formats available. -# -# Sass allows you to choose between three different output styles -# by setting the :style option. -# In Rails, this is done by setting Sass::Plugin.options[:style]; -# outside Rails, it's done by passing an options hash with :style set. -# -# === :nested -# -# Nested style is the default Sass style, -# because it reflects the structure of the document -# in much the same way Sass does. -# Each attribute has its own line, -# but the indentation isn't constant. -# Each rule is indented based on how deeply it's nested. -# For example: -# -# #main { -# color: #fff; -# background-color: #000; } -# #main p { -# width: 10em; } -# -# .huge { -# font-size: 10em; -# font-weight: bold; -# text-decoration: underline; } -# -# Nested style is very useful when looking at large CSS files -# for the same reason Sass is useful for making them: -# it allows you to very easily grasp the structure of the file -# without actually reading anything. -# -# === :expanded -# -# Expanded is the typical human-made CSS style, -# with each attribute and rule taking up one line. -# Attributes are indented within the rules, -# but the rules aren't indented in any special way. -# For example: -# -# #main { -# color: #fff; -# background-color: #000; -# } -# #main p { -# width: 10em; -# } -# -# .huge { -# font-size: 10em; -# font-weight: bold; -# text-decoration: underline; -# } -# -# === :compact -# -# Compact style, as the name would imply, -# takes up less space than Nested or Expanded. -# However, it's also harder to read. -# Each CSS rule takes up only one line, -# with every attribute defined on that line. -# Nested rules are placed next to each other with no newline, -# while groups of rules have newlines between them. -# For example: -# -# #main { color: #fff; background-color: #000; } -# #main p { width: 10em; } -# -# .huge { font-size: 10em; font-weight: bold; text-decoration: underline; } -# -# == Sass Options -# -# Options can be set by setting the hash Sass::Plugin.options -# from environment.rb in Rails, -# or by passing an options hash to Sass::Engine. -# Available options are: -# -# [:style] Sets the style of the CSS output. -# See the section on Output Style, above. -# -# [:always_update] Whether the CSS files should be updated every -# time a controller is accessed, -# as opposed to only when the template has been modified. -# Defaults to false. -# Only has meaning within Ruby on Rails or Merb. -# -# [:always_check] Whether a Sass template should be checked for updates every -# time a controller is accessed, -# as opposed to only when the Rails server starts. -# If a Sass template has been updated, -# it will be recompiled and will overwrite the corresponding CSS file. -# Defaults to false if Rails is running in production mode, -# true otherwise. -# Only has meaning within Ruby on Rails. -# -# [:full_exception] Whether an error in the Sass code -# should cause Sass to provide a detailed description. -# If set to true, the specific error will be displayed -# along with a line number and source snippet. -# Otherwise, a simple uninformative error message will be displayed. -# Defaults to false in production mode, true otherwise. -# Only has meaning within Ruby on Rails or Merb. -# -# [:template_location] The directory where Sass templates should be read from. -# Defaults to RAILS_ROOT + "/public/stylesheets/sass" -# or MERB_ROOT + "/public/stylesheets/sass". -# Only has meaning within Ruby on Rails or Merb. -# -# [:css_location] The directory where CSS output should be written to. -# Defaults to RAILS_ROOT + "/public/stylesheets" -# or MERB_ROOT + "/public/stylesheets". -# Only has meaning within Ruby on Rails or Merb. -# -# [:filename] The filename of the file being rendered. -# This is used solely for reporting errors, -# and is automatically set when using Rails or Merb. -# -# [:load_paths] An array of filesystem paths which should be searched -# for Sass templates imported with the "@import" directive. -# This defaults to the working directory and, in Rails or Merb, -# whatever :template_location is. -# -module Sass; end - -require 'sass/engine' -require 'sass/plugin' if defined?(Merb::Plugins) diff --git a/vendor/gems/haml-1.7.2/lib/sass/constant.rb b/vendor/gems/haml-1.7.2/lib/sass/constant.rb deleted file mode 100644 index b6e4c6c..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/constant.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'sass/constant/operation' -require 'sass/constant/literal' - -module Sass - module Constant # :nodoc: - # The character that begins a constant. - CONSTANT_CHAR = ?! - - # Whitespace characters - WHITESPACE = [?\ , ?\t, ?\n, ?\r] - - # The character used to escape values - ESCAPE_CHAR = ?\\ - - # The character used to open and close strings - STRING_CHAR = ?" - - # A mapping of syntactically-significant characters - # to parsed symbols - SYMBOLS = { - ?( => :open, - ?) => :close, - ?+ => :plus, - ?- => :minus, - ?* => :times, - ?/ => :div, - ?% => :mod, - STRING_CHAR => :str, - ESCAPE_CHAR => :esc - } - - # The regular expression used to parse constants - MATCH = /^#{Regexp.escape(CONSTANT_CHAR.chr)}([^\s#{(SYMBOLS.keys + [ ?= ]).map {|c| Regexp.escape("#{c.chr}") }}]+)\s*=\s*(.+)/ - - # First-order operations - FIRST_ORDER = [:times, :div, :mod] - - # Second-order operations - SECOND_ORDER = [:plus, :minus] - - class << self - def parse(value, constants, line) - begin - operationalize(parenthesize(tokenize(value)), constants).to_s - rescue Sass::SyntaxError => e - if e.message == "Constant arithmetic error" - e.instance_eval do - @message += ": #{value.dump}" - end - end - e.sass_line = line - raise e - end - end - - private - - def tokenize(value) - escaped = false - is_string = false - negative_okay = true - str = '' - to_return = [] - - reset_str = Proc.new do - to_return << str unless str.empty? - '' - end - - value.each_byte do |byte| - unless escaped - if byte == ESCAPE_CHAR - escaped = true - next - end - - last = to_return[-1] - - # Do we need to open or close a string literal? - if byte == STRING_CHAR - is_string = !is_string - - # Adjacent strings should be concatenated - if is_string && last && (!last.is_a?(Symbol) || last == :close) - to_return << :concat - end - - str = reset_str.call - next - end - - unless is_string - - # Are we looking at whitespace? - if WHITESPACE.include?(byte) - str = reset_str.call - next - end - - symbol = SYMBOLS[byte] - - # Adjacent values without an operator should be concatenated - if (symbol.nil? || symbol == :open) && - last && (!last.is_a?(Symbol) || last == :close) - to_return << :concat - end - - # Time for a unary minus! - if negative_okay && symbol == :minus - negative_okay = true - to_return << :neg - next - end - - # Are we looking at an operator? - if symbol && (str.empty? || symbol != :mod) - str = reset_str.call - negative_okay = true - to_return << symbol - next - end - end - end - - escaped = false - negative_okay = false - str << byte.chr - end - - if is_string - raise Sass::SyntaxError.new("Unterminated string: #{value.dump}") - end - str = reset_str.call - to_return - end - - def parenthesize(value) - parenthesize_helper(0, value, value.length)[0] - end - - def parenthesize_helper(i, value, value_len) - to_return = [] - beginning = i - token = value[i] - - while i < value_len && token != :close - if token == :open - to_return.push(*value[beginning...i]) - sub, i = parenthesize_helper(i + 1, value, value_len) - beginning = i - to_return << sub - elsif token == :neg - if value[i + 1].nil? - raise Sass::SyntaxError("Unterminated unary minus.") - elsif value[i + 1] == :open - to_return.push(*value[beginning...i]) - sub, i = parenthesize_helper(i + 2, value, value_len) - beginning = i - to_return << [:neg, sub] - else - to_return.push(*value[beginning...i]) - to_return << [:neg, value[i + 1]] - beginning = i = i + 2 - end - else - i += 1 - end - - token = value[i] - end - to_return.push(*value[beginning...i]) - return to_return, i + 1 - end - - #-- - # TODO: Don't pass around original value; - # have Constant.parse automatically add it to exception. - #++ - def operationalize(value, constants) - value = [value] unless value.is_a?(Array) - if value.length == 1 - value = value[0] - if value.is_a? Array - operationalize(value, constants) - elsif value.is_a? Operation - value - else - Literal.parse(insert_constant(value, constants)) - end - elsif value.length == 2 - if value[0] == :neg - Operation.new(Sass::Constant::Number.new('0'), operationalize(value[1], constants), :minus) - else - raise SyntaxError.new("Constant arithmetic error") - end - elsif value.length == 3 - Operation.new(operationalize(value[0], constants), operationalize(value[2], constants), value[1]) - else - if SECOND_ORDER.include?(value[1]) && FIRST_ORDER.include?(value[3]) - operationalize([value[0], value[1], operationalize(value[2..4], constants), *value[5..-1]], constants) - else - operationalize([operationalize(value[0..2], constants), *value[3..-1]], constants) - end - end - end - - def insert_constant(value, constants) - to_return = value - if value[0] == CONSTANT_CHAR - to_return = constants[value[1..-1]] - unless to_return - raise SyntaxError.new("Undefined constant: \"#{value}\"") - end - end - to_return - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/constant/color.rb b/vendor/gems/haml-1.7.2/lib/sass/constant/color.rb deleted file mode 100644 index db59a97..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/constant/color.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'sass/constant/literal' - -module Sass::Constant # :nodoc: - class Color < Literal # :nodoc: - - HTML4_COLORS = { - 'black' => 0x000000, - 'silver' => 0xc0c0c0, - 'gray' => 0x808080, - 'white' => 0xffffff, - 'maroon' => 0x800000, - 'red' => 0xff0000, - 'purple' => 0x800080, - 'fuchsia' => 0xff00ff, - 'green' => 0x008000, - 'lime' => 0x00ff00, - 'olive' => 0x808000, - 'yellow' => 0xffff00, - 'navy' => 0x000080, - 'blue' => 0x0000ff, - 'teal' => 0x008080, - 'aqua' => 0x00ffff - } - - REGEXP = /\##{"([0-9a-fA-F]{1,2})" * 3}/ - - def parse(value) - if (value =~ REGEXP) - @value = value.scan(REGEXP)[0].map { |num| num.ljust(2, num).to_i(16) } - else - color = HTML4_COLORS[value.downcase] - @value = (0..2).map{ |n| color >> (n << 3) & 0xff }.reverse - end - end - - def plus(other) - if other.is_a? Sass::Constant::String - Sass::Constant::String.from_value(self.to_s + other.to_s) - else - piecewise(other, :+) - end - end - - def minus(other) - if other.is_a? Sass::Constant::String - raise NoMethodError.new(nil, :minus) - else - piecewise(other, :-) - end - end - - def times(other) - if other.is_a? Sass::Constant::String - raise NoMethodError.new(nil, :times) - else - piecewise(other, :*) - end - end - - def div(other) - if other.is_a? Sass::Constant::String - raise NoMethodError.new(nil, :div) - else - piecewise(other, :/) - end - end - - def mod(other) - if other.is_a? Sass::Constant::String - raise NoMethodError.new(nil, :mod) - else - piecewise(other, :%) - end - end - - def to_s - red, green, blue = @value.map { |num| num.to_s(16).rjust(2, '0') } - "##{red}#{green}#{blue}" - end - - protected - - def self.filter_value(value) - value.map { |num| num.to_i } - end - - private - - def piecewise(other, operation) - other_num = other.is_a? Number - other_val = other.value - - rgb = [] - for i in (0...3) - res = @value[i].send(operation, other_num ? other_val : other_val[i]) - rgb[i] = [ [res, 255].min, 0 ].max - end - Color.from_value(rgb) - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/constant/literal.rb b/vendor/gems/haml-1.7.2/lib/sass/constant/literal.rb deleted file mode 100644 index 34fbced..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/constant/literal.rb +++ /dev/null @@ -1,53 +0,0 @@ -# Let the subclasses see the superclass -module Sass::Constant; class Literal; end; end; # :nodoc: - -require 'sass/constant/string' -require 'sass/constant/number' -require 'sass/constant/color' - -class Sass::Constant::Literal # :nodoc: - # The regular expression matching numbers. - NUMBER = /^(-?\d*?\.?)(\d+)([^\d\s]*)$/ - - html_color_matcher = Sass::Constant::Color::HTML4_COLORS.keys.map { |c| "^#{c}$" }.join '|' - - # The regular expression matching colors. - COLOR = /^\# (?: [\da-f]{3} | [\da-f]{6} ) | #{html_color_matcher}/ix - - def self.parse(value) - case value - when NUMBER - Sass::Constant::Number.new(value) - when COLOR - Sass::Constant::Color.new(value) - else - Sass::Constant::String.new(value) - end - end - - def initialize(value = nil) - self.parse(value) if value - end - - def perform - self - end - - def concat(other) - Sass::Constant::String.from_value("#{self.to_s} #{other.to_s}") - end - - attr_reader :value - - protected - - def self.filter_value(value) - value - end - - def self.from_value(value) - instance = self.new - instance.instance_variable_set('@value', self.filter_value(value)) - instance - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/constant/number.rb b/vendor/gems/haml-1.7.2/lib/sass/constant/number.rb deleted file mode 100644 index d822f13..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/constant/number.rb +++ /dev/null @@ -1,87 +0,0 @@ -require 'sass/constant/literal' - -module Sass::Constant # :nodoc: - class Number < Literal # :nodoc: - - attr_reader :unit - - def parse(value) - first, second, unit = value.scan(Literal::NUMBER)[0] - @value = first.empty? ? second.to_i : "#{first}#{second}".to_f - @unit = unit unless unit.empty? - end - - def plus(other) - if other.is_a? Number - operate(other, :+) - elsif other.is_a? Color - other.plus(self) - else - Sass::Constant::String.from_value(self.to_s + other.to_s) - end - end - - def minus(other) - if other.is_a? Number - operate(other, :-) - else - raise NoMethodError.new(nil, :minus) - end - end - - def times(other) - if other.is_a? Number - operate(other, :*) - elsif other.is_a? Color - other.times(self) - else - raise NoMethodError.new(nil, :times) - end - end - - def div(other) - if other.is_a? Number - operate(other, :/) - else - raise NoMethodError.new(nil, :div) - end - end - - def mod(other) - if other.is_a? Number - operate(other, :%) - else - raise NoMethodError.new(nil, :mod) - end - end - - def to_s - value = @value - value = value.to_i if value % 1 == 0.0 - "#{value}#{@unit}" - end - - protected - - def self.from_value(value, unit=nil) - instance = super(value) - instance.instance_variable_set('@unit', unit) - instance - end - - def operate(other, operation) - unit = nil - if other.unit.nil? - unit = self.unit - elsif self.unit.nil? - unit = other.unit - elsif other.unit == self.unit - unit = self.unit - else - raise Sass::SyntaxError.new("Incompatible units: #{self.unit} and #{other.unit}") - end - - Number.from_value(self.value.send(operation, other.value), unit) - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/constant/operation.rb b/vendor/gems/haml-1.7.2/lib/sass/constant/operation.rb deleted file mode 100644 index 3033af5..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/constant/operation.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'sass/constant/string' -require 'sass/constant/number' -require 'sass/constant/color' - -module Sass::Constant # :nodoc: - class Operation # :nodoc: - def initialize(operand1, operand2, operator) - @operand1 = operand1 - @operand2 = operand2 - @operator = operator - end - - def to_s - self.perform.to_s - end - - protected - - def perform - literal1 = @operand1.perform - literal2 = @operand2.perform - begin - literal1.send(@operator, literal2) - rescue NoMethodError => e - raise e unless e.name.to_s == @operator.to_s - raise Sass::SyntaxError.new("Undefined operation: \"#{literal1} #{@operator} #{literal2}\"") - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/constant/string.rb b/vendor/gems/haml-1.7.2/lib/sass/constant/string.rb deleted file mode 100644 index 21b7f35..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/constant/string.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'sass/constant/literal' - -module Sass::Constant # :nodoc: - class String < Literal # :nodoc: - - def parse(value) - @value = value - end - - def plus(other) - Sass::Constant::String.from_value(self.to_s + other.to_s) - end - - def to_s - @value - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/css.rb b/vendor/gems/haml-1.7.2/lib/sass/css.rb deleted file mode 100644 index c4bfea8..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/css.rb +++ /dev/null @@ -1,197 +0,0 @@ -require File.dirname(__FILE__) + '/../sass' -require 'sass/tree/node' -require 'strscan' - -module Sass - # :stopdoc: - module Tree - class Node - def to_sass - result = '' - - children.each do |child| - result << "#{child.to_sass(0)}\n" - end - - result - end - end - - class ValueNode - def to_sass(tabs) - "#{value}\n" - end - end - - class RuleNode - def to_sass(tabs) - str = "#{' ' * tabs}#{rule}\n" - - children.each do |child| - str << "#{child.to_sass(tabs + 1)}" - end - - str - end - end - - class AttrNode - def to_sass(tabs) - "#{' ' * tabs}:#{name} #{value}\n" - end - end - end - # :startdoc: - - # This class contains the functionality used in the +css2sass+ utility, - # namely converting CSS documents to Sass templates. - class CSS - # :stopdoc: - - # The Regexp matching a CSS rule - RULE_RE = /\s*([^\{]+)\s*\{/ - - # The Regexp matching a CSS attribute - ATTR_RE = /\s*[^::\{\}]+\s*:\s*[^:;\{\}]+\s*;/ - - # :startdoc: - - # Creates a new instance of Sass::CSS that will compile the given document - # to a Sass string when +render+ is called. - def initialize(template) - if template.is_a? IO - template = template.read - end - - @template = StringScanner.new(template) - end - - # Processes the document and returns the result as a string - # containing the CSS template. - def render - begin - build_tree.to_sass - rescue Exception => err - line = @template.string[0...@template.pos].split("\n").size - - err.backtrace.unshift "(css):#{line}" - raise err - end - end - - private - - def build_tree - root = Tree::Node.new(nil) - whitespace - directives(root) - rules(root) - sort_rules(root) - root - end - - def directives(root) - while @template.scan(/@/) - name = @template.scan /[^\s;]+/ - whitespace - value = @template.scan /[^;]+/ - assert_match /;/ - whitespace - - if name == "import" && value =~ /^(url\()?"?([^\s\(\)\"]+)\.css"?\)?$/ - value = $2 - end - - root << Tree::ValueNode.new("@#{name} #{value};", nil) - end - end - - def rules(root) - rules = [] - while @template.scan(/[^\{\s]+/) - rules << @template[0] - whitespace - - if @template.scan(/\{/) - result = Tree::RuleNode.new(rules.join(' '), nil) - root << result - rules = [] - - whitespace - attributes(result) - end - end - end - - def attributes(rule) - while @template.scan(/[^:\}\s]+/) - name = @template[0] - whitespace - - assert_match /:/ - - value = '' - while @template.scan(/[^;\s]+/) - value << @template[0] << whitespace - end - - assert_match /;/ - rule << Tree::AttrNode.new(name, value, nil) - end - - assert_match /\}/ - end - - def whitespace - space = @template.scan(/\s*/) || '' - - # If we've hit a comment, - # go past it and look for more whitespace - if @template.scan(/\/\*/) - @template.scan_until(/\*\//) - return space + whitespace - end - return space - end - - def assert_match(re) - if !@template.scan(re) - raise Exception.new("Invalid CSS!") - end - whitespace - end - - def sort_rules(root) - root.children.sort! do |c1, c2| - if c1.is_a?(Tree::RuleNode) && c2.is_a?(Tree::RuleNode) - c1.rule <=> c2.rule - elsif !(c1.is_a?(Tree::RuleNode) || c2.is_a?(Tree::RuleNode)) || c2.is_a?(Tree::RuleNode) - -1 - else - 1 - end - end - - prev_rules = [] - prev_rule_values = [] - root.children.each do |child| - if child.is_a? Tree::RuleNode - joined_prev_values = prev_rule_values.join(' ') - until prev_rules.empty? || child.rule =~ /^#{Regexp.escape(joined_prev_values)}/ - prev_rules.pop - prev_rule_values.pop - end - - unless prev_rules.empty? - child.rule.slice!(0..(joined_prev_values.size)) - prev_rules[-1] << child - root.children.delete child - end - - prev_rules << child - prev_rule_values << child.rule - end - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/engine.rb b/vendor/gems/haml-1.7.2/lib/sass/engine.rb deleted file mode 100644 index 813a429..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/engine.rb +++ /dev/null @@ -1,354 +0,0 @@ -require 'sass/tree/node' -require 'sass/tree/value_node' -require 'sass/tree/rule_node' -require 'sass/tree/comment_node' -require 'sass/tree/attr_node' -require 'sass/constant' -require 'sass/error' -require 'haml/util' - -module Sass - # This is the class where all the parsing and processing of the Sass - # template is done. It can be directly used by the user by creating a - # new instance and calling render to render the template. For example: - # - # template = File.load('stylesheets/sassy.sass') - # sass_engine = Sass::Engine.new(template) - # output = sass_engine.render - # puts output - class Engine - # The character that begins a CSS attribute. - ATTRIBUTE_CHAR = ?: - - # The character that designates that - # an attribute should be assigned to the result of constant arithmetic. - SCRIPT_CHAR = ?= - - # The character that designates the beginning of a comment, - # either Sass or CSS. - COMMENT_CHAR = ?/ - - # The character that follows the general COMMENT_CHAR and designates a Sass comment, - # which is not output as a CSS comment. - SASS_COMMENT_CHAR = ?/ - - # The character that follows the general COMMENT_CHAR and designates a CSS comment, - # which is embedded in the CSS document. - CSS_COMMENT_CHAR = ?* - - # The character used to denote a compiler directive. - DIRECTIVE_CHAR = ?@ - - # The regex that matches and extracts data from - # attributes of the form :name attr. - ATTRIBUTE = /^:([^\s=:]+)\s*(=?)(?:\s+|$)(.*)/ - - # The regex that matches attributes of the form name: attr. - ATTRIBUTE_ALTERNATE_MATCHER = /^[^\s:]+\s*[=:](\s|$)/ - - # The regex that matches and extracts data from - # attributes of the form name: attr. - ATTRIBUTE_ALTERNATE = /^([^\s=:]+)(\s*=|:)(?:\s+|$)(.*)/ - - # Creates a new instace of Sass::Engine that will compile the given - # template string when render is called. - # See README for available options. - # - #-- - # - # TODO: Add current options to REFRENCE. Remember :filename! - # - # When adding options, remember to add information about them - # to README! - #++ - # - def initialize(template, options={}) - @options = { - :style => :nested, - :load_paths => ['.'] - }.merge! options - @template = template.split(/\n\r|\n/) - @lines = [] - @constants = {} - end - - # Processes the template and returns the result as a string. - def render - begin - render_to_tree.to_s - rescue SyntaxError => err - unless err.sass_filename - err.add_backtrace_entry(@options[:filename]) - end - raise err - end - end - - alias_method :to_css, :render - - protected - - def constants - @constants - end - - def render_to_tree - split_lines - - root = Tree::Node.new(@options[:style]) - index = 0 - while @lines[index] - child, index = build_tree(index) - - if child.is_a? Tree::Node - child.line = index - root << child - elsif child.is_a? Array - child.each do |c| - root << c - end - end - end - @line = nil - - root - end - - private - - # Readies each line in the template for parsing, - # and computes the tabulation of the line. - def split_lines - @line = 0 - old_tabs = 0 - @template.each_with_index do |line, index| - @line += 1 - - tabs = count_tabs(line) - - if line[0] == COMMENT_CHAR && line[1] == SASS_COMMENT_CHAR && tabs == 0 - tabs = old_tabs - end - - if tabs # if line isn't blank - if tabs - old_tabs > 1 - raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.", @line) - end - @lines << [line.strip, tabs] - - old_tabs = tabs - else - @lines << ['//', old_tabs] - end - end - - @line = nil - end - - # Counts the tabulation of a line. - def count_tabs(line) - spaces = line.index(/[^ ]/) - if spaces - if spaces % 2 == 1 || line[spaces] == ?\t - # Make sure a line with just tabs isn't an error - return nil if line.strip.empty? - - raise SyntaxError.new("Illegal Indentation: Only two space characters are allowed as tabulation.", @line) - end - spaces / 2 - else - nil - end - end - - def build_tree(index) - line, tabs = @lines[index] - index += 1 - @line = index - node = parse_line(line) - - has_children = has_children?(index, tabs) - - # Node is a symbol if it's non-outputting, like a constant assignment - unless node.is_a? Tree::Node - if has_children - if node == :constant - raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath constants.", @line) - elsif node.is_a? Array - raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath import directives.", @line) - end - end - - return node, index - end - - if node.is_a? Tree::CommentNode - while has_children - line, index = raw_next_line(index) - node << line - - has_children = has_children?(index, tabs) - end - else - while has_children - child, index = build_tree(index) - - if child == :constant - raise SyntaxError.new("Constants may only be declared at the root of a document.", @line) - elsif child.is_a? Array - raise SyntaxError.new("Import directives may only be used at the root of a document.", @line) - elsif child.is_a? Tree::Node - child.line = @line - node << child - end - - has_children = has_children?(index, tabs) - end - end - - return node, index - end - - def has_children?(index, tabs) - next_line = ['//', 0] - while !next_line.nil? && next_line[0] == '//' && next_line[1] = 0 - next_line = @lines[index] - index += 1 - end - next_line && next_line[1] > tabs - end - - def raw_next_line(index) - [@lines[index][0], index + 1] - end - - def parse_line(line) - case line[0] - when ATTRIBUTE_CHAR - parse_attribute(line, ATTRIBUTE) - when Constant::CONSTANT_CHAR - parse_constant(line) - when COMMENT_CHAR - parse_comment(line) - when DIRECTIVE_CHAR - parse_directive(line) - else - if line =~ ATTRIBUTE_ALTERNATE_MATCHER - parse_attribute(line, ATTRIBUTE_ALTERNATE) - else - Tree::RuleNode.new(line, @options[:style]) - end - end - end - - def parse_attribute(line, attribute_regx) - name, eq, value = line.scan(attribute_regx)[0] - - if name.nil? || value.nil? - raise SyntaxError.new("Invalid attribute: \"#{line}\"", @line) - end - - if eq.strip[0] == SCRIPT_CHAR - value = Sass::Constant.parse(value, @constants, @line).to_s - end - - Tree::AttrNode.new(name, value, @options[:style]) - end - - def parse_constant(line) - name, value = line.scan(Sass::Constant::MATCH)[0] - unless name && value - raise SyntaxError.new("Invalid constant: \"#{line}\"", @line) - end - @constants[name] = Sass::Constant.parse(value, @constants, @line) - :constant - end - - def parse_comment(line) - if line[1] == SASS_COMMENT_CHAR - :comment - elsif line[1] == CSS_COMMENT_CHAR - Tree::CommentNode.new(line, @options[:style]) - else - Tree::RuleNode.new(line, @options[:style]) - end - end - - def parse_directive(line) - directive, value = line[1..-1].split(/\s+/, 2) - - case directive - when "import" - import(value) - else - raise SyntaxError.new("Unknown compiler directive: #{"@#{directive} #{value}".dump}", @line) - end - end - - def import(files) - nodes = [] - - files.split(/,\s*/).each do |filename| - engine = nil - filename = find_file_to_import(filename) - if filename =~ /\.css$/ - nodes << Tree::ValueNode.new("@import url(#{filename});", @options[:style]) - else - File.open(filename) do |file| - new_options = @options.dup - new_options[:filename] = filename - engine = Sass::Engine.new(file.read, @options) - end - - engine.constants.merge! @constants - - begin - root = engine.render_to_tree - rescue Sass::SyntaxError => err - err.add_backtrace_entry(filename) - raise err - end - root.children.each do |child| - child.filename = filename - nodes << child - end - @constants = engine.constants - end - end - - nodes - end - - def find_file_to_import(filename) - was_sass = false - original_filename = filename - new_filename = nil - - if filename[-5..-1] == ".sass" - filename = filename[0...-5] - was_sass = true - elsif filename[-4..-1] == ".css" - return filename - end - - @options[:load_paths].each do |path| - full_path = File.join(path, filename) + '.sass' - - if File.readable?(full_path) - new_filename = full_path - break - end - end - - if new_filename.nil? - if was_sass - raise SyntaxError.new("File to import not found or unreadable: #{original_filename}", @line) - else - return filename + '.css' - end - else - new_filename - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/error.rb b/vendor/gems/haml-1.7.2/lib/sass/error.rb deleted file mode 100644 index 8d3ae5d..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/error.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Sass - # Sass::SyntaxError encapsulates information about the exception, - # such as the line of the Sass template it was raised on - # and the Sass file that was being parsed (if applicable). - # It also provides a handy way to rescue only exceptions raised - # because of a faulty template. - class SyntaxError < StandardError - # The line of the Sass template on which the exception was thrown. - attr_accessor :sass_line - - # The name of the file that was being parsed when the exception was raised. - # This will be nil unless Sass is being used as an ActionView plugin. - attr_reader :sass_filename - - # Creates a new SyntaxError. - # +lineno+ should be the line of the Sass template on which the error occurred. - def initialize(msg, lineno = nil) - @message = msg - @sass_line = lineno - end - - # Adds a properly formatted entry to the exception's backtrace. - # +filename+ should be the file in which the error occurred, - # if applicable (defaults to "(sass)"). - def add_backtrace_entry(filename) # :nodoc: - @sass_filename ||= filename - self.backtrace ||= [] - self.backtrace.unshift "#{@sass_filename || '(sass)'}:#{@sass_line}" - end - - def to_s # :nodoc: - @message - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/plugin.rb b/vendor/gems/haml-1.7.2/lib/sass/plugin.rb deleted file mode 100644 index 65741cd..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/plugin.rb +++ /dev/null @@ -1,111 +0,0 @@ -require 'sass/engine' - -module Sass - # This module contains methods to aid in using Sass - # as a stylesheet-rendering plugin for various systems. - # Currently Rails/ActionController and Merb are supported out of the box. - module Plugin - class << self - @@options = { - :template_location => './public/stylesheets/sass', - :css_location => './public/stylesheets', - :always_update => false, - :always_check => true, - :full_exception => true - } - - # Gets various options for Sass. See README for details. - #-- - # TODO: *DOCUMENT OPTIONS* - #++ - def options - @@options - end - - # Sets various options for Sass. - def options=(value) - @@options.merge!(value) - end - - # Checks each stylesheet in options[:css_location] - # to see if it needs updating, - # and updates it using the corresponding template - # from options[:templates] - # if it does. - def update_stylesheets - Dir.glob(File.join(options[:template_location], "**", "*.sass")).entries.each do |file| - - # Get the relative path to the file with no extension - name = file.sub(options[:template_location] + "/", "")[0...-5] - - if options[:always_update] || stylesheet_needs_update?(name) - css = css_filename(name) - File.delete(css) if File.exists?(css) - - filename = template_filename(name) - l_options = @@options.dup - l_options[:filename] = filename - l_options[:load_paths] = (l_options[:load_paths] || []) + [l_options[:template_location]] - engine = Engine.new(File.read(filename), l_options) - begin - result = engine.render - rescue Exception => e - if options[:full_exception] - e_string = "#{e.class}: #{e.message}" - - if e.is_a? Sass::SyntaxError - e_string << "\non line #{e.sass_line}" - - if e.sass_filename - e_string << " of #{e.sass_filename}" - - if File.exists?(e.sass_filename) - e_string << "\n\n" - - min = [e.sass_line - 5, 0].max - File.read(e.sass_filename).rstrip.split("\n")[ - min .. e.sass_line + 5 - ].each_with_index do |line, i| - e_string << "#{min + i + 1}: #{line}\n" - end - end - end - end - result = "/*\n#{e_string}\n\nBacktrace:\n#{e.backtrace.join("\n")}\n*/" - else - result = "/* Internal stylesheet error */" - end - end - - # Create any directories that might be necessary - dirs = [l_options[:css_location]] - name.split("/")[0...-1].each { |dir| dirs << "#{dirs[-1]}/#{dir}" } - dirs.each { |dir| Dir.mkdir(dir) unless File.exist?(dir) } - - # Finally, write the file - File.open(css, 'w') do |file| - file.print(result) - end - end - end - end - - private - - def template_filename(name) - "#{@@options[:template_location]}/#{name}.sass" - end - - def css_filename(name) - "#{@@options[:css_location]}/#{name}.css" - end - - def stylesheet_needs_update?(name) - !File.exists?(css_filename(name)) || (File.mtime(template_filename(name)) - 2) > File.mtime(css_filename(name)) - end - end - end -end - -require 'sass/plugin/rails' if defined?(ActionController) -require 'sass/plugin/merb' if defined?(Merb::Plugins) diff --git a/vendor/gems/haml-1.7.2/lib/sass/plugin/merb.rb b/vendor/gems/haml-1.7.2/lib/sass/plugin/merb.rb deleted file mode 100644 index d89a923..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/plugin/merb.rb +++ /dev/null @@ -1,20 +0,0 @@ -unless defined?(Sass::MERB_LOADED) - Sass::MERB_LOADED = true - - Sass::Plugin.options.merge!(:template_location => MERB_ROOT + '/public/stylesheets/sass', - :css_location => MERB_ROOT + '/public/stylesheets', - :always_check => MERB_ENV != "production", - :full_exception => MERB_ENV != "production") - config = Merb::Plugins.config[:sass] || Merb::Plugins.config["sass"] || {} - config.symbolize_keys! - Sass::Plugin.options.merge!(config) - - class MerbHandler # :nodoc: - def process_with_sass(request, response) - Sass::Plugin.update_stylesheets if Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check] - process_without_sass(request, response) - end - alias_method :process_without_sass, :process - alias_method :process, :process_with_sass - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/plugin/rails.rb b/vendor/gems/haml-1.7.2/lib/sass/plugin/rails.rb deleted file mode 100644 index f21a8f2..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/plugin/rails.rb +++ /dev/null @@ -1,18 +0,0 @@ -unless defined?(Sass::RAILS_LOADED) - Sass::RAILS_LOADED = true - - Sass::Plugin.options.merge!(:template_location => RAILS_ROOT + '/public/stylesheets/sass', - :css_location => RAILS_ROOT + '/public/stylesheets', - :always_check => RAILS_ENV != "production", - :full_exception => RAILS_ENV != "production") - - module ActionController # :nodoc: - class Base # :nodoc: - alias_method :sass_old_process, :process - def process(*args) - Sass::Plugin.update_stylesheets if Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check] - sass_old_process(*args) - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/tree/attr_node.rb b/vendor/gems/haml-1.7.2/lib/sass/tree/attr_node.rb deleted file mode 100644 index 6ea0e68..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/tree/attr_node.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'sass/tree/node' - -module Sass::Tree - class AttrNode < ValueNode - attr_accessor :name - - def initialize(name, value, style) - @name = name - super(value, style) - end - - def to_s(parent_name = nil) - if value[-1] == ?; - raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (This isn't CSS!)", @line) - end - real_name = name - real_name = "#{parent_name}-#{real_name}" if parent_name - - if value.empty? && children.empty? - raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump}", @line) - end - - join_string = @style == :compact ? ' ' : "\n" - to_return = '' - if !value.empty? - to_return << "#{real_name}: #{value};#{join_string}" - end - - children.each do |kid| - if @style == :compact - to_return << "#{kid.to_s(real_name)} " - else - to_return << "#{kid.to_s(real_name)}\n" - end - end - to_return << "\n" unless children.empty? || @style == :compact - to_return[0...-1] - end - - private - - def declaration - ":#{name} #{value}" - end - - def invalid_child?(child) - if !child.is_a?(AttrNode) - "Illegal nesting: Only attributes may be nested beneath attributes." - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/tree/comment_node.rb b/vendor/gems/haml-1.7.2/lib/sass/tree/comment_node.rb deleted file mode 100644 index e741ded..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/tree/comment_node.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'sass/tree/node' - -module Sass::Tree - class CommentNode < ValueNode - def initialize(value, style) - super(value[2..-1].strip, style) - end - - def to_s(parent_name = nil) - join_string = @style == :compact ? ' ' : "\n * " - "/* #{value}#{join_string unless children.empty?}#{children.join join_string} */" - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/tree/node.rb b/vendor/gems/haml-1.7.2/lib/sass/tree/node.rb deleted file mode 100644 index 20acd72..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/tree/node.rb +++ /dev/null @@ -1,46 +0,0 @@ -module Sass - module Tree - class Node - attr_accessor :children - attr_accessor :line - attr_accessor :filename - - def initialize(style) - @style = style - @children = [] - end - - def <<(child) - if msg = invalid_child?(child) - raise Sass::SyntaxError.new(msg, child.line) - end - @children << child - end - - def to_s - result = String.new - children.each do |child| - if child.is_a? AttrNode - raise SyntaxError.new('Attributes aren\'t allowed at the root of a document.', child.line) - end - - begin - result += "#{child.to_s(1)}\n" - rescue SyntaxError => e - raise e - end - end - result[0...-1] - end - - private - - # This method should be overridden by subclasses to return an error message - # if the given child node is invalid, - # and false or nil otherwise. - def invalid_child?(child) - false - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/tree/rule_node.rb b/vendor/gems/haml-1.7.2/lib/sass/tree/rule_node.rb deleted file mode 100644 index 75e0773..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/tree/rule_node.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'sass/tree/node' -require 'sass/tree/attr_node' - -module Sass::Tree - class RuleNode < ValueNode - # The character used to include the parent selector - PARENT = '&' - - alias_method :rule, :value - alias_method :rule=, :value= - - def to_s(tabs, super_rules = nil) - attributes = [] - sub_rules = [] - total_rule = if super_rules - super_rules.split(/,\s*/).collect! do |s| - self.rule.split(/,\s*/).collect do |r| - if r.include?(PARENT) - r.gsub(PARENT, s) - else - "#{s} #{r}" - end - end.join(", ") - end.join(", ") - elsif self.rule.include?(PARENT) - raise Sass::SyntaxError.new("Base-level rules cannot contain the parent-selector-referencing character '#{PARENT}'", line) - else - self.rule - end - - children.each do |child| - if child.is_a? RuleNode - sub_rules << child - else - attributes << child - end - end - - to_return = '' - unless attributes.empty? - if @style == :compact - to_return << "#{total_rule} { #{attributes.join(' ')} }\n" - else - spaces = (@style == :expanded ? 2 : tabs * 2) - old_spaces = ' ' * (spaces - 2) - spaces = ' ' * spaces - - attributes = attributes.join("\n").gsub("\n", "\n#{spaces}").rstrip - end_attrs = (@style == :expanded ? "\n" : ' ') - to_return << "#{old_spaces}#{total_rule} {\n#{spaces}#{attributes}#{end_attrs}}\n" - end - end - - tabs += 1 unless attributes.empty? - sub_rules.each { |sub| to_return << sub.to_s(tabs, total_rule) } - to_return - end - end -end diff --git a/vendor/gems/haml-1.7.2/lib/sass/tree/value_node.rb b/vendor/gems/haml-1.7.2/lib/sass/tree/value_node.rb deleted file mode 100644 index e7b43d9..0000000 --- a/vendor/gems/haml-1.7.2/lib/sass/tree/value_node.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'sass/tree/node' - -module Sass::Tree - class ValueNode < Node - attr_accessor :value - - def initialize(value, style) - @value = value - super(style) - end - - def to_s(tabs = 0) - value - end - end -end diff --git a/vendor/gems/haml-1.7.2/test/benchmark.rb b/vendor/gems/haml-1.7.2/test/benchmark.rb deleted file mode 100644 index fb22216..0000000 --- a/vendor/gems/haml-1.7.2/test/benchmark.rb +++ /dev/null @@ -1,62 +0,0 @@ -require 'rubygems' -require 'active_support' -require 'action_controller' -require 'action_view' - -require File.dirname(__FILE__) + '/../lib/haml' -require 'haml/template' -require 'sass/engine' - -require 'benchmark' -require 'stringio' - -module Haml - class Benchmarker - - # Creates a new benchmarker that looks for templates in the base - # directory. - def initialize(base = File.dirname(__FILE__)) - ActionView::Base.register_template_handler("haml", Haml::Template) - unless base.class == ActionView::Base - @base = ActionView::Base.new(base) - else - @base = base - end - end - - # Benchmarks haml against ERb, and Sass on its own. - # - # Returns the results of the benchmarking as a string. - # - def benchmark(runs = 100) - template_name = 'standard' - haml_template = "haml/templates/#{template_name}" - rhtml_template = "haml/rhtml/#{template_name}" - sass_template = File.dirname(__FILE__) + "/sass/templates/complex.sass" - - old_stdout = $stdout - $stdout = StringIO.new - - times = Benchmark.bmbm do |b| - b.report("haml:") { runs.times { @base.render haml_template } } - b.report("erb:") { runs.times { @base.render rhtml_template } } - end - - #puts times[0].inspect, times[1].inspect - ratio = sprintf("%g", times[0].to_a[5] / times[1].to_a[5]) - puts "Haml/ERB: " + ratio - - puts '', '-' * 50, 'Sass on its own', '-' * 50 - - Benchmark.bmbm do |b| - b.report("sass:") { runs.times { Sass::Engine.new(File.read(sass_template)).render } } - end - - $stdout.pos = 0 - to_return = $stdout.read - $stdout = old_stdout - - to_return - end - end -end diff --git a/vendor/gems/haml-1.7.2/test/haml/engine_test.rb b/vendor/gems/haml-1.7.2/test/haml/engine_test.rb deleted file mode 100644 index b7e1bea..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/engine_test.rb +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'active_support' -require 'action_controller' -require 'action_view' - -require 'test/unit' -require File.dirname(__FILE__) + '/../../lib/haml' -require 'haml/engine' - -class EngineTest < Test::Unit::TestCase - - def render(text, options = {}) - Haml::Engine.new(text, options).to_html - end - - def test_empty_render_should_remain_empty - assert_equal('', render('')) - end - - # This is ugly because Hashes are unordered; we don't always know the order - # in which attributes will be returned. - # There is probably a better way to do this. - def test_attributes_should_render_correctly - assert_equal("
    \n
    ", render(".atlantis{:style => 'ugly'}").chomp) - rescue - assert_equal("
    \n
    ", render(".atlantis{:style => 'ugly'}").chomp) - end - - def test_ruby_code_should_work_inside_attributes - author = 'hcatlin' - assert_equal("

    foo

    ", render("%p{:class => 1+2} foo").chomp) - end - - def test_nil_should_render_empty_tag - assert_equal("
    \n
    ", - render(".no_attributes{:nil => nil}").chomp) - end - - def test_strings_should_get_stripped_inside_tags - assert_equal("
    This should have no spaces in front of it
    ", - render(".stripped This should have no spaces in front of it").chomp) - end - - def test_one_liner_should_be_one_line - assert_equal("

    Hello

    ", render('%p Hello').chomp) - end - - def test_long_liner_should_not_print_on_one_line - assert_equal("
    \n #{'x' * 51}\n
    ", render("%div #{'x' * 51}").chomp) - end - - def test_multi_render - engine = Haml::Engine.new("%strong Hi there!") - assert_equal("Hi there!\n", engine.to_html) - assert_equal("Hi there!\n", engine.to_html) - assert_equal("Hi there!\n", engine.to_html) - end - - def test_double_equals - assert_equal("

    Hello World

    \n", render('%p== Hello #{who}', :locals => {:who => 'World'})) - assert_equal("

    \n Hello World\n

    \n", render("%p\n == Hello \#{who}", :locals => {:who => 'World'})) - end - - def test_nil_tag_value_should_render_as_empty - assert_equal("

    \n", render("%p= nil")) - end - - def test_tag_with_failed_if_should_render_as_empty - assert_equal("

    \n", render("%p= 'Hello' if false")) - end - - # Options tests - - def test_stop_eval - assert_equal("", render("= 'Hello'", :suppress_eval => true)) - assert_equal("", render("- puts 'foo'", :suppress_eval => true)) - assert_equal("
    \n", render("#foo{:yes => 'no'}/", :suppress_eval => true)) - assert_equal("
    \n", render("#foo{:yes => 'no', :call => a_function() }/", :suppress_eval => true)) - assert_equal("
    \n", render("%div[1]/", :suppress_eval => true)) - - begin - assert_equal("", render(":ruby\n puts 'hello'", :suppress_eval => true)) - rescue Haml::HamlError => err - caught = true - assert_equal('Filter "ruby" is not defined!', err.message) - end - assert(caught, "Rendering a ruby filter without evaluating didn't throw an error!") - end - - def test_attr_wrapper - assert_equal("

    \n

    \n", render("%p{ :strange => 'attrs'}", :attr_wrapper => '*')) - assert_equal("

    \n

    \n", render("%p{ :escaped => 'quo\"te'}", :attr_wrapper => '"')) - assert_equal("

    \n

    \n", render("%p{ :escaped => 'q\\'uo\"te'}", :attr_wrapper => '"')) - assert_equal("\n", render("!!! XML", :attr_wrapper => '"')) - end - - def test_attrs_parsed_correctly - assert_equal("

    biddly='bar => baz'>\n

    \n", render("%p{'boom=>biddly' => 'bar => baz'}")) - assert_equal("

    \n

    \n", render("%p{'foo,bar' => 'baz, qux'}")) - assert_equal("

    \n

    \n", render("%p{ :escaped => \"quo\\nte\"}")) - assert_equal("

    \n

    \n", render("%p{ :escaped => \"quo\#{2 + 2}te\"}")) - end - - def test_locals - assert_equal("

    Paragraph!

    \n", render("%p= text", :locals => { :text => "Paragraph!" })) - end - - def test_recompile_with_new_locals - template = "%p= (text == 'first time') ? text : new_text" - assert_equal("

    first time

    \n", render(template, :locals => { :text => "first time" })) - assert_equal("

    second time

    \n", render(template, :locals => { :text => "recompile", :new_text => "second time" })) - - # Make sure the method called will return junk unless recompiled - method_name = Haml::Engine.send(:class_variable_get, '@@method_names')[template] - Haml::Engine::CompiledTemplates.module_eval "def #{method_name}(stuff); @haml_stack[-1].push_text 'NOT RECOMPILED', 0; end" - - assert_equal("NOT RECOMPILED\n", render(template, :locals => { :text => "first time" })) - assert_equal("

    first time

    \n", render(template, :locals => { :text => "first time", :foo => 'bar' })) - end - - def test_dynamc_attrs_shouldnt_register_as_literal_values - assert_equal("

    \n

    \n", render('%p{:a => "b#{1 + 1}c"}')) - assert_equal("

    \n

    \n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}")) - end - - def test_rec_merge - hash1 = {1=>2, 3=>{5=>7, 8=>9}} - hash2 = {4=>5, 3=>{5=>2, 16=>12}} - hash3 = {1=>2, 4=>5, 3=>{5=>2, 8=>9, 16=>12}} - - hash1.rec_merge!(hash2) - assert_equal(hash3, hash1) - end - - def test_exception_type - begin - render("%p hi\n= undefined") - rescue Exception => e - assert(e.is_a?(Haml::Error)) - assert_equal(2, e.haml_line) - assert_equal(nil, e.haml_filename) - assert_equal('(haml):2', e.backtrace[0]) - else - # Test failed... should have raised an exception - assert(false) - end - end - - def test_syntax_errors - errs = [ "!!!\n a", "a\n b", "a\n:foo\nb", "/ a\n b", - "% a", "%p a\n b", "a\n%p=\nb", "%p=\n a", - "a\n%p~\nb", "a\n~\nb", "a\n~\n b", "%p~\n b", "%p/\n a", - "%p\n \t%a b", "%a\n b\nc", "%a\n b\nc", - ":notafilter\n This isn't\n a filter!", - ".{} a", "\#{} a", ".= 'foo'", "%a/ b", "%p..class", "%p..#." ] - errs.each do |err| - begin - render(err) - rescue Exception => e - assert(e.is_a?(Haml::Error), - "#{err.dump} doesn't produce Haml::SyntaxError!") - else - assert(false, - "#{err.dump} doesn't produce an exception!") - end - end - end - - def test_compile_error - begin - render("a\nb\n- fee do\nc") - rescue Exception => e - assert_equal(3, e.haml_line) - else - assert(false, - '"a\nb\n- fee do\nc" doesn\'t produce an exception!') - end - end - - def test_no_bluecloth - old_markdown = false - if defined?(Haml::Filters::Markdown) - old_markdown = Haml::Filters::Markdown - end - - Kernel.module_eval do - alias_method :haml_old_require, :gem_original_require - - def gem_original_require(file) - raise LoadError if file == 'bluecloth' - haml_old_require(file) - end - end - - if old_markdown - Haml::Filters.instance_eval do - remove_const 'Markdown' - end - end - - # This is purposefully redundant, so it doesn't stop - # haml/filters from being required later on. - require 'haml/../haml/filters' - - assert_equal("

    Foo

    \t

    - a\n- b

    \n", - Haml::Engine.new(":markdown\n Foo\n ===\n - a\n - b").to_html) - - Haml::Filters.instance_eval do - remove_const 'Markdown' - end - - Haml::Filters.const_set('Markdown', old_markdown) if old_markdown - - Kernel.module_eval do - alias_method :gem_original_require, :haml_old_require - end - - NOT_LOADED.delete 'bluecloth' - end - - def test_no_redcloth - Kernel.module_eval do - alias_method :haml_old_require2, :gem_original_require - - def gem_original_require(file) - raise LoadError if file == 'redcloth' - haml_old_require2(file) - end - end - - # This is purposefully redundant, so it doesn't stop - # haml/filters from being required later on. - require 'haml/../haml/../haml/filters' - - begin - Haml::Engine.new(":redcloth\n _foo_").to_html - rescue Haml::HamlError - else - assert(false, "No exception raised!") - end - - Kernel.module_eval do - alias_method :gem_original_require2, :haml_old_require - end - - NOT_LOADED.delete 'redcloth' - end - - def test_local_assigns_dont_modify_class - assert_equal("bar\n", render("= foo", :locals => {:foo => 'bar'})) - assert_equal(nil, defined?(foo)) - end - - def test_object_ref_with_nil_id - user = Struct.new('User', :id).new - assert_equal("

    New User

    \n", - render("%p[user] New User", :locals => {:user => user})) - end -end diff --git a/vendor/gems/haml-1.7.2/test/haml/helper_test.rb b/vendor/gems/haml-1.7.2/test/haml/helper_test.rb deleted file mode 100644 index f0f30d4..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/helper_test.rb +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'active_support' -require 'action_controller' -require 'action_view' - -require 'test/unit' -require File.dirname(__FILE__) + '/../../lib/haml' -require 'haml/template' - -class HelperTest < Test::Unit::TestCase - include Haml::Helpers - - def setup - ActionView::Base.register_template_handler("haml", Haml::Template) - @base = ActionView::Base.new - @base.controller = ActionController::Base.new - end - - def render(text, options = {}) - if options == :action_view - @base.render :inline => text, :type => :haml - else - scope = options.delete :scope_object - Haml::Engine.new(text, options).to_html(scope ? scope : Object.new) - end - end - - def test_flatten - assert_equal(flatten("FooBar"), "FooBar") - - assert_equal(flatten("Foo\rBar"), "FooBar") - - assert_equal(flatten("Foo\nBar"), "Foo Bar") - - assert_equal(flatten("Hello\nWorld!\nYOU ARE \rFLAT?\n\rOMGZ!"), - "Hello World! YOU ARE FLAT? OMGZ!") - end - - def test_list_of_should_render_correctly - assert_equal("
  • 1
  • \n
  • 2
  • \n", render("= list_of([1, 2]) do |i|\n = i")) - assert_equal("
  • [1]
  • \n", render("= list_of([[1]]) do |i|\n = i.inspect")) - assert_equal("
  • \n

    Fee

    \n

    A word!

    \n
  • \n
  • \n

    Fi

    \n

    A word!

    \n
  • \n
  • \n

    Fo

    \n

    A word!

    \n
  • \n
  • \n

    Fum

    \n

    A word!

    \n
  • \n", - render("= list_of(['Fee', 'Fi', 'Fo', 'Fum']) do |title|\n %h1= title\n %p A word!")) - end - - def test_buffer_access - assert(render("= buffer") =~ /#/) - assert_equal(render("= (buffer == _hamlout)"), "true\n") - end - - def test_tabs - assert_equal(render("foo\n- tab_up\nbar\n- tab_down\nbaz"), "foo\n bar\nbaz\n") - end - - def test_helpers_dont_leak - # Haml helpers shouldn't be accessible from ERB - render("foo") - proper_behavior = false - - begin - ActionView::Base.new.render(:inline => "<%= flatten('Foo\\nBar') %>") - rescue NoMethodError - proper_behavior = true - end - assert(proper_behavior) - - begin - ActionView::Base.new.render(:inline => "<%= concat('foo') %>") - rescue ArgumentError, NameError - proper_behavior = true - end - assert(proper_behavior) - end - - def test_action_view_included - assert(Haml::Helpers.action_view?) - end - - def test_form_tag - result = render("- form_tag 'foo' do\n %p bar\n %strong baz", :action_view) - should_be = "
    \n

    bar

    \n baz\n
    \n" - assert_equal(should_be, result) - end - - def test_capture_haml - assert_equal("\"

    13

    \\n\"\n", render("- foo = capture_haml(13) do |a|\n %p= a\n= foo.dump")) - end - - def test_is_haml - assert(!ActionView::Base.new.is_haml?) - assert_equal("true\n", render("= is_haml?")) - assert_equal("true\n", render("= is_haml?", :action_view)) - assert_equal("false", @base.render(:inline => '<%= is_haml? %>')) - assert_equal("false\n", render("= render :inline => '<%= is_haml? %>'", :action_view)) - end - - def test_page_class - controller = Struct.new(:controller_name, :action_name).new('troller', 'tion') - scope = Struct.new(:controller).new(controller) - result = render("%div{:class => page_class} MyDiv", :scope_object => scope) - expected = "
    MyDiv
    \n" - assert_equal expected, result - end - - def test_indented_capture - assert_equal(" \n Foo\n ", @base.render(:inline => " <% res = capture do %>\n Foo\n <% end %><%= res %>")) - end - - def test_capture_deals_properly_with_collections - Haml::Helpers.module_eval do - def trc(collection, &block) - collection.each do |record| - puts capture_haml(record, &block) - end - end - end - - assert_equal("1\n\n2\n\n3\n\n", render("- trc([1, 2, 3]) do |i|\n = i.inspect")) - end -end - diff --git a/vendor/gems/haml-1.7.2/test/haml/mocks/article.rb b/vendor/gems/haml-1.7.2/test/haml/mocks/article.rb deleted file mode 100644 index 805f8ca..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/mocks/article.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Article - attr_accessor :id, :title, :body - def initialize - @id, @title, @body = 1, 'Hello', 'World' - end -end \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/haml/results/content_for_layout.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/content_for_layout.xhtml deleted file mode 100644 index 8761e35..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/content_for_layout.xhtml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - -
    - Lorem ipsum dolor sit amet -
    -
    - Lorem ipsum dolor sit amet -
    -
    - Lorem ipsum dolor sit amet -
    - - diff --git a/vendor/gems/haml-1.7.2/test/haml/results/eval_suppressed.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/eval_suppressed.xhtml deleted file mode 100644 index 8d0bf7b..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/eval_suppressed.xhtml +++ /dev/null @@ -1,8 +0,0 @@ -

    -

    Me!

    -
    -

    All

    -
    -

    This

    - Should render -
    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/filters.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/filters.xhtml deleted file mode 100644 index a336a9c..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/filters.xhtml +++ /dev/null @@ -1,57 +0,0 @@ - -TESTING HAHAHAHA! -

    Foo

    - - -
    This is preformatted!
    -Look at that!
    -Wowie-zowie!
    - - -

    boldilicious!

    -

    Yeah

    - - -

    pretty much the same as above

    -This - Is - Plain - Text - %strong right? - - a - - b - - c - - d - - e - - f - - g - - h - - i - - j -
      -
    • Foo
    • -
    • Bar
    • -
    • BAZ!
    • -
    -Text! -Hello, World! -How are you doing today? - diff --git a/vendor/gems/haml-1.7.2/test/haml/results/helpers.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/helpers.xhtml deleted file mode 100644 index cd27475..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/helpers.xhtml +++ /dev/null @@ -1,84 +0,0 @@ -&&&&&&&&&&& -
    -

    Title

    -

    - Woah this is really crazy - I mean wow, - man. -

    -
    -
    -

    Title

    -

    - Woah this is really crazy - I mean wow, - man. -

    -
    -
    -

    Title

    -

    - Woah this is really crazy - I mean wow, - man. -

    -
    -

    foo

    -

    - reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong -

    -
    -
    -
    -

    Big!

    -

    Small

    - -
    -
    -

    foo

    -

    bar

    -
    -
    - (parentheses!) -
    -*Not really -click -here. -

    baz

    -

    boom

    -foo -

    -

    -

    - -
    -
    -
    - Title: - - Body: - -
    -
  • google
  • -

    - foo -

    - bar -
    - boom - baz - boom, again -

    - - - - - -
    - - strong! - - data - - more_data -
    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/helpful.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/helpful.xhtml deleted file mode 100644 index 042291d..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/helpful.xhtml +++ /dev/null @@ -1,10 +0,0 @@ -
    -

    Hello

    -
    World
    -
    -
    id
    -
    class
    -
    id class
    -
    boo
    -
    moo
    -
    foo
    \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/haml/results/just_stuff.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/just_stuff.xhtml deleted file mode 100644 index 71b9195..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/just_stuff.xhtml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - -Boo! -Embedded? false! -Embedded? true! -Embedded? true! -
    wow!
    -stuff followed by whitespace -block with whitespace -

    - Escape - - character - %p foo - yee\ha -

    - - - -

    class attribute shouldn't appear!

    - - - -testtest -
    - - -
    - - -
    - Nested content -
    -

    Blah

    -

    Blah

    -

    Blump

    -Woah inner quotes -

    -

    -

    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/list.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/list.xhtml deleted file mode 100644 index b8ef0b0..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/list.xhtml +++ /dev/null @@ -1,12 +0,0 @@ -! Not a Doctype ! -

      -
    • a
    • -
    • b
    • -
    • c
    • -
    • d
    • -
    • e
    • -
    • f
    • -
    • g
    • -
    • h
    • -
    • i
    • -
    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/original_engine.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/original_engine.xhtml deleted file mode 100644 index 600fc98..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/original_engine.xhtml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Stop. haml time -
    -

    This is a title!

    -

    - Lorem ipsum dolor sit amet, consectetur adipisicing elit -

    -

    Cigarettes!

    -

    Man alive!

    -
      -
    • Slippers
    • -
    • Shoes
    • -
    • Bathrobe
    • -
    • Coffee
    • -
    -
    -        This is some text that's in a pre block!
    -        Let's see what happens when it's rendered! What about now, since we're on a new line?
    -      
    -
    - - diff --git a/vendor/gems/haml-1.7.2/test/haml/results/partials.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/partials.xhtml deleted file mode 100644 index 3c8c437..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/partials.xhtml +++ /dev/null @@ -1,20 +0,0 @@ -

    - @foo = - value one -

    -

    - @foo = - value two -

    -

    - @foo = - value two -

    -

    - @foo = - value three -

    -

    - @foo = - value three -

    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/silent_script.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/silent_script.xhtml deleted file mode 100644 index 76e90e0..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/silent_script.xhtml +++ /dev/null @@ -1,74 +0,0 @@ -
    -

    I can count!

    - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 -

    I know my ABCs!

    -
      -
    • a
    • -
    • b
    • -
    • c
    • -
    • d
    • -
    • e
    • -
    • f
    • -
    • g
    • -
    • h
    • -
    • i
    • -
    • j
    • -
    • k
    • -
    • l
    • -
    • m
    • -
    • n
    • -
    • o
    • -
    • p
    • -
    • q
    • -
    • r
    • -
    • s
    • -
    • t
    • -
    • u
    • -
    • v
    • -
    • w
    • -
    • x
    • -
    • y
    • -
    • z
    • -
    -

    I can catch errors!

    - Oh no! "undefined method `silly' for String:Class" happened! -

    - "false" is: - false -

    - Even! - Odd! - Even! - Odd! - Even! -
    -
    - foobar -
    -0 -1 -2 -3 -4 -
    -

    boom

    -
    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/standard.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/standard.xhtml deleted file mode 100644 index f87c158..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/standard.xhtml +++ /dev/null @@ -1,43 +0,0 @@ - - - - Hampton Catlin Is Totally Awesome - - - - -foo -
    - Yes, ladies and gentileman. He is just that egotistical. - Fantastic! This should be multi-line output - The question is if this would translate! Ahah! - 20 -
    -
    Quotes should be loved! Just like people!
    - Wow.| -

    - Holy cow multiline tags! A pipe (|) even! - PipesIgnored|PipesIgnored|PipesIgnored| - 1|2|3 -

    -
    - this shouldn't evaluate but now it should! -
    -
      -
    • a
    • -
    • b
    • -
    • c
    • -
    • d
    • -
    • e
    • -
    • f
    • -
    -
    with this text
    - hello - - - diff --git a/vendor/gems/haml-1.7.2/test/haml/results/tag_parsing.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/tag_parsing.xhtml deleted file mode 100644 index c1d694c..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/tag_parsing.xhtml +++ /dev/null @@ -1,28 +0,0 @@ -
    - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 -
    -
    -

    -

    -
    a
    -
    b
    -
    c
    -
    d
    -
    e
    -
    f
    -
    g
    -
    -
    - <{ :a => :b } -
    >{ :c => :d }
    -
    diff --git a/vendor/gems/haml-1.7.2/test/haml/results/very_basic.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/very_basic.xhtml deleted file mode 100644 index 9713fb1..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/very_basic.xhtml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/vendor/gems/haml-1.7.2/test/haml/results/whitespace_handling.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/whitespace_handling.xhtml deleted file mode 100644 index 2c49b4d..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/results/whitespace_handling.xhtml +++ /dev/null @@ -1,94 +0,0 @@ -
    -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    -
    - -
    - -
    -
    -
    - Foo bar -
    foo bar
    -
    foo
    bar
    -

    foo
    bar

    -

    - foo - bar -

    -
    -
    - 13 - -
    -
    -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    -
    - -
    - -
    -
    -
    - Foo bar -
    foo bar
    -
    foo
    bar
    -

    foo
    bar

    -

    - foo - bar -

    -
    -                                                 ___
                                                  ,o88888
                                               ,o8888888'
                         ,:o:o:oooo.        ,8O88Pd8888"
                     ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
                   ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
                  , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
                 , ..:.::o:ooOoOO8O888O8O,COCOO"
                , . ..:.::o:ooOoOOOO8OOOOCOCO"
                 . ..:.::o:ooOoOoOO8O8OCCCC"o
                    . ..:.::o:ooooOoCoCCC"o:o
                    . ..:.::o:o:,cooooCo"oo:o:
                 `   . . ..:.:cocoooo"'o:o:::'
                 .`   . ..::ccccoc"'o:o:o:::'
                :.:.    ,c:cccc"':.:.:.:.:.'
              ..:.:"'`::::c:"'..:.:.:.:.:.'  http://www.chris.com/ASCII/
            ...:.'.:.::::"'    . . . . .'
           .. . ....:."' `   .  . . ''
         . . . ...."'
         .. . ."'     -hrr-
        .
    
    
                                                  It's a planet!
    %strong This shouldn't be bold!
    
    -  
    - This should! - -
    -
    - 13 -
    -
    -       __     ______        __               ______
    .----.|  |--.|__    |.----.|  |--..--------.|  __  |
    |  __||     ||__    ||  __||    < |        ||  __  |
    |____||__|__||______||____||__|__||__|__|__||______|
    
    -
    -
    -foo
    
    -  bar
    -
    diff --git a/vendor/gems/haml-1.7.2/test/haml/rhtml/standard.rhtml b/vendor/gems/haml-1.7.2/test/haml/rhtml/standard.rhtml deleted file mode 100644 index ce1fcee..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/rhtml/standard.rhtml +++ /dev/null @@ -1,55 +0,0 @@ - - - - Hampton Catlin Is Totally Awesome - - - - - <% concat("Foo", Proc.new {}) %> -
    - Yes, ladies and gentileman. He is just that egotistical. - Fantastic! This should be multi-line output - The question is if this would translate! Ahah! - <%= 1 + 9 + 8 + 2 %> - <%# numbers should work and this should be ignored %> -
    - <% 120.times do |number| -%> - <%= number %> - <% end -%> -
    <%= " Quotes should be loved! Just like people!" %>
    - Wow. -

    - <%= "Holy cow " + - "multiline " + - "tags! " + - "A pipe (|) even!" %> - <%= [1, 2, 3].collect { |n| "PipesIgnored|" } %> - <%= [1, 2, 3].collect { |n| - n.to_s - }.join("|") %> -

    -
    - <% foo = String.new - foo << "this" - foo << " shouldn't" - foo << " evaluate" %> - <%= foo + "but now it should!" %> - <%# Woah crap a comment! %> -
    -
      - <% ('a'..'f').each do |a|%> -
    • <%= a %> - <% end %> -
      <%= @should_eval = "with this text" %>
      - <%= [ 104, 101, 108, 108, 111 ].map do |byte| - byte.chr - end %> - - - diff --git a/vendor/gems/haml-1.7.2/test/haml/runner.rb b/vendor/gems/haml-1.7.2/test/haml/runner.rb deleted file mode 100644 index 5567a2d..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/runner.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'rubygems' -require 'active_support' -require 'action_controller' -require 'action_view' -require '../../lib/haml/template' -require 'fileutils' - -haml_template_engine = Haml::Template.new(ActionView::Base.new) -haml_template_engine.render(File.dirname(__FILE__) + '/templates/standard.haml') - -begin - eval(File.read("template_test.rb")) -rescue StandardError => e - puts e.backtrace - puts e.inspect -end diff --git a/vendor/gems/haml-1.7.2/test/haml/template_test.rb b/vendor/gems/haml-1.7.2/test/haml/template_test.rb deleted file mode 100644 index 5ee864a..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/template_test.rb +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'rubygems' -require 'active_support' -require 'action_controller' -require 'action_view' - -require File.dirname(__FILE__) + '/../../lib/haml' -require 'haml/template' -require File.dirname(__FILE__) + '/mocks/article' - -class TestFilter - def initialize(text) - @text = text - end - - def render - "TESTING HAHAHAHA!" - end -end - -class TemplateTest < Test::Unit::TestCase - @@templates = %w{ very_basic standard helpers - whitespace_handling original_engine list helpful - silent_script tag_parsing just_stuff partials - filters } - - def setup - ActionView::Base.register_template_handler("haml", Haml::Template) - Haml::Template.options = { :filters => { 'test'=>TestFilter } } - @base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/", {'article' => Article.new, 'foo' => 'value one'}) - end - - def render(text) - Haml::Engine.new(text).to_html(@base) - end - - def load_result(name) - @result = '' - File.new(File.dirname(__FILE__) + "/results/#{name}.xhtml").each_line { |l| @result += l } - @result - end - - def assert_renders_correctly(name) - test = Proc.new do |rendered| - load_result(name).split("\n").zip(rendered.split("\n")).each_with_index do |pair, line| - message = "template: #{name}\nline: #{line}" - assert_equal(pair.first, pair.last, message) - end - end - test.call(@base.render(name)) - - # If eval's suppressed, the partial won't render anyway :p. - unless Haml::Template.options[:suppress_eval] - test.call(@base.render(:file => "partialize", :locals => { :name => name })) - end - end - - def test_empty_render_should_remain_empty - assert_equal('', render('')) - end - - def test_templates_should_render_correctly - @@templates.each do |template| - assert_renders_correctly template - end - end - - def test_action_view_templates_render_correctly - @base.instance_variable_set("@content_for_layout", 'Lorem ipsum dolor sit amet') - assert_renders_correctly 'content_for_layout' - end - - def test_instance_variables_should_work_inside_templates - @base.instance_variable_set("@content_for_layout", 'something') - assert_equal("

      something

      ", render("%p= @content_for_layout").chomp) - - @base.instance_eval("@author = 'Hampton Catlin'") - assert_equal("
      Hampton Catlin
      ", render(".author= @author").chomp) - - @base.instance_eval("@author = 'Hampton'") - assert_equal("Hampton", render("= @author").chomp) - - @base.instance_eval("@author = 'Catlin'") - assert_equal("Catlin", render("= @author").chomp) - end - - def test_instance_variables_should_work_inside_attributes - @base.instance_eval("@author = 'hcatlin'") - assert_equal("

      foo

      ", render("%p{:class => @author} foo").chomp) - end - - def test_template_renders_should_eval - assert_equal("2\n", render("= 1+1")) - end - - def test_rhtml_still_renders - # Make sure it renders normally - res = @base.render("../rhtml/standard") - assert !(res.nil? || res.empty?) - - # Register Haml stuff in @base... - @base.render("standard") - - # Does it still render? - res = @base.render("../rhtml/standard") - assert !(res.nil? || res.empty?) - end - - def test_haml_options - Haml::Template.options = { :suppress_eval => true } - assert_equal({ :suppress_eval => true }, Haml::Template.options) - assert_renders_correctly("eval_suppressed") - Haml::Template.options = {} - end - - def test_exceptions_should_work_correctly - begin - Haml::Template.new(@base).render(File.dirname(__FILE__) + '/templates/breakage.haml') - rescue Exception => e - assert_equal("./test/haml/templates/breakage.haml:4", e.backtrace[0]) - else - assert false - end - - begin - render("- raise 'oops!'") - rescue Exception => e - assert_equal("(haml):1", e.backtrace[0]) - else - assert false - end - - template = < e - assert_equal("(haml):5", e.backtrace[0]) - else - assert false - end - end -end diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/_partial.haml b/vendor/gems/haml-1.7.2/test/haml/templates/_partial.haml deleted file mode 100644 index 00e701d..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/_partial.haml +++ /dev/null @@ -1,7 +0,0 @@ -%p - @foo = - = @foo -- @foo = 'value three' -%p - @foo = - = @foo diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/_text_area.haml b/vendor/gems/haml-1.7.2/test/haml/templates/_text_area.haml deleted file mode 100644 index 896b975..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/_text_area.haml +++ /dev/null @@ -1,3 +0,0 @@ -.text_area_test_area - ~ "" -= "" diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/breakage.haml b/vendor/gems/haml-1.7.2/test/haml/templates/breakage.haml deleted file mode 100644 index 57c1734..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/breakage.haml +++ /dev/null @@ -1,8 +0,0 @@ -%p - %h1 Hello! - = "lots of lines" - - raise "Oh no!" - %p - this is after the exception - %strong yes it is! -ho ho ho. diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/content_for_layout.haml b/vendor/gems/haml-1.7.2/test/haml/templates/content_for_layout.haml deleted file mode 100644 index fda84a5..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/content_for_layout.haml +++ /dev/null @@ -1,10 +0,0 @@ -!!! -%html - %head - %body - #content - = @content_for_layout - #yieldy - = yield :layout - #nosym - = yield diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/eval_suppressed.haml b/vendor/gems/haml-1.7.2/test/haml/templates/eval_suppressed.haml deleted file mode 100644 index 9544ef7..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/eval_suppressed.haml +++ /dev/null @@ -1,10 +0,0 @@ -= "not me!" -= "nor me!" -- puts "not even me!" -%p= "NO!" -%h1 Me! -#foo - %p#bar All - %br/ - %p.baz This - Should render diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/filters.haml b/vendor/gems/haml-1.7.2/test/haml/templates/filters.haml deleted file mode 100644 index aedbb2c..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/filters.haml +++ /dev/null @@ -1,53 +0,0 @@ -%style - :sass - p - :border - :style dotted - :width 10px - :color #ff00ff - h1 - :font-weight normal - -:test - This - Should - Not - Print - -:redcloth - Foo - === - - This is preformatted! - Look at that! - Wowie-zowie! - - *boldilicious!* - -:textile - h1. Yeah - - _pretty much the same as above_ - -:plain - This - Is - Plain - Text - %strong right? - -:erb - <% 10.times do |c| %> - <%= (c+97).chr %> - <% end %> - -:markdown - * Foo - * Bar - * BAZ! - -= "Text!" - -:ruby - puts "Hello, World!" - puts "How are you doing today?" diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/helpers.haml b/vendor/gems/haml-1.7.2/test/haml/templates/helpers.haml deleted file mode 100644 index 85dd3ac..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/helpers.haml +++ /dev/null @@ -1,63 +0,0 @@ -= h("&&&&&&&&&&&") # This is an ActionView Helper... should load -- foo = capture do # This ActionView Helper is designed for ERB, but should work with haml - %div - %p.title Title - %p.text - Woah this is really crazy - I mean wow, - man. -- 3.times do - = foo -%p foo -- tab_up -%p reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong -- tab_down -.woah - #funky - = capture_haml do - %div - %h1 Big! - %p Small - / Invisible - = capture do - .dilly - %p foo - %h1 bar - = surround '(', ')' do - %strong parentheses! -= precede '*' do - %span.small Not really -click -= succeed '.' do - %a{:href=>"thing"} here -%p baz -- buffer.tabulation = 10 -%p boom -- concat "foo\n" -- buffer.tabulation = 0 -- def url_for(*stuff); stuff.join(' '); end -%p - = form_tag 'hello/world' -- form_tag 'heeheeaform' do - %div= submit_tag 'save' -- form_for :article, @article, :url => 'article_url' do |f| - Title: - = f.text_field :title - Body: - = f.text_field :body -= list_of({:google => 'http://www.google.com'}) do |name, link| - %a{ :href => link }= name -%p - - puts "foo" - %div - - puts "bar" - - puts "boom" - baz - - puts "boom, again" -- open :table do - - open :tr do - - open :td, {:class => 'cell'} do - - open :strong, "strong!" - - puts "data" - - open :td do - - puts "more_data" diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/helpful.haml b/vendor/gems/haml-1.7.2/test/haml/templates/helpful.haml deleted file mode 100644 index 3e44a50..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/helpful.haml +++ /dev/null @@ -1,11 +0,0 @@ -%div[@article] - %h1= @article.title - %div= @article.body -#id[@article] id -.class[@article] class -#id.class[@article] id class -%div{:class => "article full"}[@article]= "boo" -%div{'class' => "article full"}[@article]= "moo" -%div.articleFull[@article]= "foo" -%span[@not_a_real_variable_and_will_be_nil] - Boo diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/just_stuff.haml b/vendor/gems/haml-1.7.2/test/haml/templates/just_stuff.haml deleted file mode 100644 index 45d955b..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/just_stuff.haml +++ /dev/null @@ -1,69 +0,0 @@ -!!! XML -!!! XML ISO-8859-1 -!!! XML UtF-8 Foo bar -!!! -!!! 1.1 -!!! 1.1 Strict -!!! Strict foo bar -!!! FRAMESET -%strong{:apos => "Foo's bar!"} Boo! -== Embedded? false! -== Embedded? #{true}! -- embedded = true -== Embedded? #{embedded}! -.render= render :inline => "%em= 'wow!'", :type => :haml -= "stuff followed by whitespace" - -- if true - - %strong block with whitespace -%p - \Escape - \- character - \%p foo - \yee\ha -/ Short comment -/ This is a really long comment look how long it is it should be on a line of its own don't you think? -/ - This is a block comment - cool, huh? - %strong there can even be sub-tags! - = "Or script!" --# Haml comment --# - Nested Haml comment - - raise 'dead' -%p{ :class => "" } class attribute shouldn't appear! -/[if lte IE6] conditional comment! -/[if gte IE7] - %p Block conditional comment - %div - %h1 Cool, eh? -/[if gte IE5.2] - Woah a period. -= "test" | - "test" | --# Hard tabs shouldn't throw errors. - -- case :foo -- when :bar - %br Blah -- when :foo - %br -- case :foo - - when :bar - %meta{ :foo => 'blah'} - - when :foo - %meta{ :foo => 'bar'} -%img -%hr -%link -%script Inline content -%br - Nested content -%p.foo{:class => true ? 'bar' : 'baz'}[@article] Blah -%p.foo{:class => false ? 'bar' : ''}[@article] Blah -%p.qux{:class => 'quux'}[@article] Blump -== #{"Woah inner quotes"} -%p.dynamic_quote{:quotes => "single '", :dyn => 1 + 2} -%p.dynamic_atomic{:dyn => 1 + 2}/ diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/list.haml b/vendor/gems/haml-1.7.2/test/haml/templates/list.haml deleted file mode 100644 index 52605b1..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/list.haml +++ /dev/null @@ -1,12 +0,0 @@ -! Not a Doctype ! -%ul - %li a - %li b - %li c - %li d - %li e - %li f - %li g - %li h - %li i - diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/original_engine.haml b/vendor/gems/haml-1.7.2/test/haml/templates/original_engine.haml deleted file mode 100644 index df31a5a..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/original_engine.haml +++ /dev/null @@ -1,17 +0,0 @@ -!!! -%html - %head - %title Stop. haml time - #content - %h1 This is a title! - %p Lorem ipsum dolor sit amet, consectetur adipisicing elit - %p{:class => 'foo'} Cigarettes! - %h2 Man alive! - %ul.things - %li Slippers - %li Shoes - %li Bathrobe - %li Coffee - %pre - This is some text that's in a pre block! - Let's see what happens when it's rendered! What about now, since we're on a new line? diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/partialize.haml b/vendor/gems/haml-1.7.2/test/haml/templates/partialize.haml deleted file mode 100644 index 327d90d..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/partialize.haml +++ /dev/null @@ -1 +0,0 @@ -= render :file => "#{name}.haml" diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/partials.haml b/vendor/gems/haml-1.7.2/test/haml/templates/partials.haml deleted file mode 100644 index 3fab791..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/partials.haml +++ /dev/null @@ -1,12 +0,0 @@ -%p - @foo = - = @foo -- @foo = 'value two' -%p - @foo = - = @foo -= render :file => "_partial.haml" -%p - @foo = - = @foo -- @foo = 'value one' diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/silent_script.haml b/vendor/gems/haml-1.7.2/test/haml/templates/silent_script.haml deleted file mode 100644 index 45199f0..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/silent_script.haml +++ /dev/null @@ -1,40 +0,0 @@ -%div - %h1 I can count! - - (1..20).each do |i| - = i - %h1 I know my ABCs! - %ul - - ('a'..'z').each do |i| - %li= i - %h1 I can catch errors! - - begin - - String.silly - - rescue NameError => e - = "Oh no! \"#{e}\" happened!" - %p - "false" is: - - if false - = "true" - - else - = "false" - - if true - - 5.times do |i| - - if i % 2 == 1 - Odd! - - else - Even! - - else - = "This can't happen!" -- 13 | -.foo - %strong foobar -- 5.times | - do | - |a| | - %strong= a -.test - - "foo | - bar | - baz" | - - %p boom diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/standard.haml b/vendor/gems/haml-1.7.2/test/haml/templates/standard.haml deleted file mode 100644 index 945b814..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/standard.haml +++ /dev/null @@ -1,43 +0,0 @@ -!!! -%html{html_attrs} - %head - %title Hampton Catlin Is Totally Awesome - %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"} - %body - / You're In my house now! - - concat("foo\n") - .header - Yes, ladies and gentileman. He is just that egotistical. - Fantastic! This should be multi-line output - The question is if this would translate! Ahah! - = 1 + 9 + 8 + 2 #numbers should work and this should be ignored - #body= " Quotes should be loved! Just like people!" - - 120.times do |number| - - number - Wow.| - %p - = "Holy cow " + | - "multiline " + | - "tags! " + | - "A pipe (|) even!" | - = [1, 2, 3].collect { |n| "PipesIgnored|" } - = [1, 2, 3].collect { |n| | - n.to_s | - }.join("|") | - %div.silent - - foo = String.new - - foo << "this" - - foo << " shouldn't" - - foo << " evaluate" - = foo + " but now it should!" - -# Woah crap a comment! - - -# That was a line that shouldn't close everything. - %ul.really.cool - - ('a'..'f').each do |a| - %li= a - #combo.of_divs_with_underscore= @should_eval = "with this text" - = [ 104, 101, 108, 108, 111 ].map do |byte| - - byte.chr - .footer - %strong.shout= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid. \nSo, I'm just making it *really* long. God, I hope this works" diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/tag_parsing.haml b/vendor/gems/haml-1.7.2/test/haml/templates/tag_parsing.haml deleted file mode 100644 index 728a738..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/tag_parsing.haml +++ /dev/null @@ -1,24 +0,0 @@ -%div.tags - %foo 1 - %FOO 2 - %fooBAR 3 - %fooBar 4 - %foo_bar 5 - %foo-bar 6 - %foo:bar 7 - %foo.bar 8 - %fooBAr_baz:boom_bar 9 - %foo13 10 - %foo2u 11 -%div.classes - %p.foo.bar#baz#boom - .fooBar a - .foo-bar b - .foo_bar c - .FOOBAR d - .foo16 e - .123 f - .foo2u g -%div.broken - %foo<{ :a => :b } - .foo>{ :c => :d } diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/very_basic.haml b/vendor/gems/haml-1.7.2/test/haml/templates/very_basic.haml deleted file mode 100644 index 93396b9..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/very_basic.haml +++ /dev/null @@ -1,4 +0,0 @@ -!!! -%html - %head - %body diff --git a/vendor/gems/haml-1.7.2/test/haml/templates/whitespace_handling.haml b/vendor/gems/haml-1.7.2/test/haml/templates/whitespace_handling.haml deleted file mode 100644 index da4b3f5..0000000 --- a/vendor/gems/haml-1.7.2/test/haml/templates/whitespace_handling.haml +++ /dev/null @@ -1,87 +0,0 @@ -#whitespace_test - = render :file => "_text_area.haml", :locals => { :value => "Oneline" } - = render :file => "_text_area.haml", :locals => { :value => "Two\nlines" } - ~ render :file => "_text_area.haml", :locals => { :value => "Oneline" } - ~ render :file => "_text_area.haml", :locals => { :value => "Two\nlines" } - #flattened~ render :file => "_text_area.haml", :locals => { :value => "Two\nlines" } -.hithere - ~ "Foo bar" - ~ "
      foo bar
      " - ~ "
      foo\nbar
      " - %p~ "
      foo\nbar
      " - %p~ "foo\nbar" -.foo - ~ 13 - ~ ['a', 'b', 'c'].map do |a| - - "" -#whitespace_test - = render :file => "_text_area.haml", :locals => { :value => "Oneline" } - = render :file => "_text_area.haml", :locals => { :value => "Two\nlines" } - = find_and_preserve render(:file => "_text_area.haml", :locals => { :value => "Oneline" }) - = find_and_preserve render(:file => "_text_area.haml", :locals => { :value => "Two\nlines" }) - #flattened= find_and_preserve render(:file => "_text_area.haml", :locals => { :value => "Two\nlines" }) -.hithere - = find_and_preserve("Foo bar") - = find_and_preserve("
      foo bar
      ") - = find_and_preserve("
      foo\nbar
      ") - %p= find_and_preserve("
      foo\nbar
      ") - %p= find_and_preserve("foo\nbar") - %pre - :preserve - ___ - ,o88888 - ,o8888888' - ,:o:o:oooo. ,8O88Pd8888" - ,.::.::o:ooooOoOoO. ,oO8O8Pd888'" - ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O" - , ..:.::o:ooOoOOOO8OOOOo.FdO8O8" - , ..:.::o:ooOoOO8O888O8O,COCOO" - , . ..:.::o:ooOoOOOO8OOOOCOCO" - . ..:.::o:ooOoOoOO8O8OCCCC"o - . ..:.::o:ooooOoCoCCC"o:o - . ..:.::o:o:,cooooCo"oo:o: - ` . . ..:.:cocoooo"'o:o:::' - .` . ..::ccccoc"'o:o:o:::' - :.:. ,c:cccc"':.:.:.:.:.' - ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/ - ...:.'.:.::::"' . . . . .' - .. . ....:."' ` . . . '' - . . . ...."' - .. . ."' -hrr- - . - - - It's a planet! - %strong This shouldn't be bold! - %strong This should! - %textarea - :preserve - ___ ___ ___ ___ - /\__\ /\ \ /\__\ /\__\ - /:/ / /::\ \ /::| | /:/ / - /:/__/ /:/\:\ \ /:|:| | /:/ / - /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / - /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ - \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ - \::/ / \::/ / /:/ / \:\ \ - /:/ / /:/ / /:/ / \:\ \ - /:/ / /:/ / /:/ / \:\__\ - \/__/ \/__/ \/__/ \/__/ - - Many - thanks - to - http://www.network-science.de/ascii/ - %strong indeed! -.foo - = find_and_preserve(13) -%pre - :preserve - __ ______ __ ______ - .----.| |--.|__ |.----.| |--..--------.| __ | - | __|| ||__ || __|| < | || __ | - |____||__|__||______||____||__|__||__|__|__||______| -%pre - :preserve - foo - bar diff --git a/vendor/gems/haml-1.7.2/test/profile.rb b/vendor/gems/haml-1.7.2/test/profile.rb deleted file mode 100644 index 62969e9..0000000 --- a/vendor/gems/haml-1.7.2/test/profile.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'rubygems' -require 'active_support' -require 'action_controller' -require 'action_view' - -require File.dirname(__FILE__) + '/../lib/haml' -require 'haml/template' -require 'profiler' -require 'stringio' - -module Haml - # Used by both Haml::Profiler and Sass::Profiler. - # Encapsulates profiling behavior. - module AbstractProfiler - def self.profile(times, &block) - # Runs the profiler, collects information - Profiler__::start_profile - times.times &block - Profiler__::stop_profile - - # Outputs information to a StringIO, returns result - io = StringIO.new - Profiler__::print_profile(io) - io.pos = 0 - result = io.read - io.close - result - end - end - - # A profiler for Haml, mostly for development use. This simply implements - # the Ruby profiler for profiling haml code. - class Profiler - - # Creates a new profiler that looks for templates in the base - # directory. - def initialize(base = File.join(File.dirname(__FILE__), 'haml', 'templates')) - ActionView::Base.register_template_handler("haml", Haml::Template) - unless base.class == ActionView::Base - @base = ActionView::Base.new(base) - else - @base = base - end - end - - # Profiles haml on the given template with the given number of runs. - # The template name shouldn't have a file extension; this will - # automatically look for a haml template. - # - # Returns the results of the profiling as a string. - def profile(runs = 100, template_name = 'standard') - AbstractProfiler.profile(runs) { @base.render template_name } - end - end -end - -module Sass - class Profiler - def profile(runs = 100, template_name = 'complex') - Haml::AbstractProfiler.profile(runs) do - Sass::Engine.new("#{File.dirname(__FILE__)}/sass/templates/#{template_name}.sass").render - end - end - end -end diff --git a/vendor/gems/haml-1.7.2/test/sass/engine_test.rb b/vendor/gems/haml-1.7.2/test/sass/engine_test.rb deleted file mode 100644 index 74d3ceb..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/engine_test.rb +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require File.dirname(__FILE__) + '/../../lib/sass' -require 'sass/engine' - -class SassEngineTest < Test::Unit::TestCase - EXCEPTION_MAP = { - "!a = 1 + " => 'Constant arithmetic error: "1 +"', - "!a = 1 + 2 +" => 'Constant arithmetic error: "1 + 2 +"', - "!a = \"b" => 'Unterminated string: "\\"b"', - "!a = #aaa - a" => 'Undefined operation: "#aaaaaa minus a"', - "!a = #aaa / a" => 'Undefined operation: "#aaaaaa div a"', - "!a = #aaa * a" => 'Undefined operation: "#aaaaaa times a"', - "!a = #aaa % a" => 'Undefined operation: "#aaaaaa mod a"', - "!a = 1 - a" => 'Undefined operation: "1 minus a"', - "!a = 1 * a" => 'Undefined operation: "1 times a"', - "!a = 1 / a" => 'Undefined operation: "1 div a"', - "!a = 1 % a" => 'Undefined operation: "1 mod a"', - ":" => 'Invalid attribute: ":"', - ": a" => 'Invalid attribute: ": a"', - ":= a" => 'Invalid attribute: ":= a"', - "a\n :b" => 'Invalid attribute: ":b "', - "a\n :b: c" => 'Invalid attribute: ":b: c"', - "a\n :b:c d" => 'Invalid attribute: ":b:c d"', - "a\n :b=c d" => 'Invalid attribute: ":b=c d"', - "a\n :b c;" => 'Invalid attribute: ":b c;" (This isn\'t CSS!)', - "a\n b : c" => 'Invalid attribute: "b : c"', - "a\n b=c: d" => 'Invalid attribute: "b=c: d"', - ":a" => 'Attributes aren\'t allowed at the root of a document.', - "!" => 'Invalid constant: "!"', - "!a" => 'Invalid constant: "!a"', - "! a" => 'Invalid constant: "! a"', - "!a b" => 'Invalid constant: "!a b"', - "a\n\t:b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", - "a\n :b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", - "a\n :b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", - "a\n :b c\n !d = 3" => "Constants may only be declared at the root of a document.", - "!a = 1b + 2c" => "Incompatible units: b and c", - "& a\n :b c" => "Base-level rules cannot contain the parent-selector-referencing character '&'", - "a\n :b\n c" => "Illegal nesting: Only attributes may be nested beneath attributes.", - "!a = b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath constants.", - "@import foo.sass" => "File to import not found or unreadable: foo.sass", - "@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.", - "foo\n @import templates/basic" => "Import directives may only be used at the root of a document.", - "@foo bar boom" => "Unknown compiler directive: \"@foo bar boom\"", - } - - def test_basic_render - renders_correctly "basic", { :style => :compact } - end - - def test_alternate_styles - renders_correctly "expanded", { :style => :expanded } - renders_correctly "compact", { :style => :compact } - renders_correctly "nested", { :style => :nested } - end - - def test_exceptions - EXCEPTION_MAP.each do |key, value| - begin - Sass::Engine.new(key).render - rescue Sass::SyntaxError => err - assert_equal(value, err.message) - assert(err.sass_line, "Line: #{key}") - assert_match(/\(sass\):[0-9]+/, err.backtrace[0], "Line: #{key}") - else - assert(false, "Exception not raised for\n#{key}") - end - end - end - - def test_exception_line - to_render = "rule\n :attr val\n// comment!\n\n :broken\n" - begin - Sass::Engine.new(to_render).render - rescue Sass::SyntaxError => err - assert_equal(5, err.sass_line) - else - assert(false, "Exception not raised for '#{to_render}'!") - end - end - - def test_imported_exception - [1, 2].each do |i| - i = nil if i == 1 - begin - Sass::Engine.new("@import bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render - rescue Sass::SyntaxError => err - assert_equal(2, err.sass_line) - assert_match(/bork#{i}\.sass$/, err.sass_filename) - else - assert(false, "Exception not raised for imported template: bork#{i}") - end - end - end - - def test_empty_first_line - assert_equal("#a {\n b: c; }\n", Sass::Engine.new("#a\n\n b: c").render) - end - - private - - def renders_correctly(name, options={}) - sass_file = load_file(name, "sass") - css_file = load_file(name, "css") - css_result = Sass::Engine.new(sass_file, options).render - assert_equal css_file, css_result - end - - def load_file(name, type = "sass") - @result = '' - File.new(File.dirname(__FILE__) + "/#{type == 'sass' ? 'templates' : 'results'}/#{name}.#{type}").each_line { |l| @result += l } - @result - end -end diff --git a/vendor/gems/haml-1.7.2/test/sass/plugin_test.rb b/vendor/gems/haml-1.7.2/test/sass/plugin_test.rb deleted file mode 100644 index 0239ead..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/plugin_test.rb +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env ruby - -MERB_ENV = RAILS_ENV = 'testing' -RAILS_ROOT = '.' - -require 'test/unit' -require 'fileutils' -require File.dirname(__FILE__) + '/../../lib/sass' -require 'rubygems' - -require 'action_controller' -require 'sass/plugin' - -class SassPluginTest < Test::Unit::TestCase - @@templates = %w{ - complex constants parent_ref import alt - subdir/subdir subdir/nested_subdir/nested_subdir - } - - def setup - FileUtils.mkdir File.dirname(__FILE__) + '/tmp' - set_plugin_opts - Sass::Plugin.update_stylesheets - end - - def teardown - FileUtils.rm_r File.dirname(__FILE__) + '/tmp' - end - - def test_templates_should_render_correctly - @@templates.each { |name| assert_renders_correctly(name) } - end - - def test_no_update - File.delete(tempfile_loc('basic')) - assert Sass::Plugin.stylesheet_needs_update?('basic') - Sass::Plugin.update_stylesheets - assert !Sass::Plugin.stylesheet_needs_update?('basic') - end - - def test_full_exception_handling - File.delete(tempfile_loc('bork')) - Sass::Plugin.update_stylesheets - File.open(tempfile_loc('bork')) do |file| - assert_equal("/*\nSass::SyntaxError: Undefined constant: \"!bork\"\non line 2 of #{File.dirname(__FILE__) + '/templates/bork.sass'}\n\n1: bork\n2: :bork= !bork", file.read.split("\n")[0...6].join("\n")) - end - File.delete(tempfile_loc('bork')) - end - - def test_nonfull_exception_handling - Sass::Plugin.options[:full_exception] = false - - File.delete(tempfile_loc('bork')) - Sass::Plugin.update_stylesheets - assert_equal("/* Internal stylesheet error */", File.read(tempfile_loc('bork'))) - File.delete(tempfile_loc('bork')) - - Sass::Plugin.options[:full_exception] = true - end - - def test_rails_update - File.delete(tempfile_loc('basic')) - assert Sass::Plugin.stylesheet_needs_update?('basic') - - ActionController::Base.new.process - - assert !Sass::Plugin.stylesheet_needs_update?('basic') - end - - def test_merb_update - begin - require 'merb' - rescue LoadError - puts "\nmerb couldn't be loaded, skipping a test" - return - end - - require 'sass/plugin/merb' - MerbHandler.send(:define_method, :process_without_sass) { |*args| } - set_plugin_opts - - File.delete(tempfile_loc('basic')) - assert Sass::Plugin.stylesheet_needs_update?('basic') - - MerbHandler.new('.').process nil, nil - - assert !Sass::Plugin.stylesheet_needs_update?('basic') - end - - - private - - def assert_renders_correctly(name) - File.read(result_loc(name)).split("\n").zip(File.read(tempfile_loc(name)).split("\n")).each_with_index do |pair, line| - message = "template: #{name}\nline: #{line + 1}" - assert_equal(pair.first, pair.last, message) - end - end - - def tempfile_loc(name) - File.dirname(__FILE__) + "/tmp/#{name}.css" - end - - def result_loc(name) - File.dirname(__FILE__) + "/results/#{name}.css" - end - - def set_plugin_opts - Sass::Plugin.options = { - :template_location => File.dirname(__FILE__) + '/templates', - :css_location => File.dirname(__FILE__) + '/tmp', - :style => :compact, - :load_paths => [File.dirname(__FILE__) + '/results'], - :always_update => true, - } - end -end - -module Sass::Plugin - class << self - public :stylesheet_needs_update? - end -end - -class Sass::Engine - alias_method :old_render, :render - - def render - raise "bork bork bork!" if @template[0] == "{bork now!}" - old_render - end -end - -class ActionController::Base - def sass_old_process(*args); end -end diff --git a/vendor/gems/haml-1.7.2/test/sass/results/alt.css b/vendor/gems/haml-1.7.2/test/sass/results/alt.css deleted file mode 100644 index 8484343..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/alt.css +++ /dev/null @@ -1,4 +0,0 @@ -h1 { float: left; width: 274px; height: 75px; margin: 0; background-repeat: no-repeat; background-image: none; } -h1 a:hover, h1 a:visited { color: green; } -h1 b:hover { color: red; background-color: green; } -h1 const { nosp: 3; sp: 3; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/basic.css b/vendor/gems/haml-1.7.2/test/sass/results/basic.css deleted file mode 100644 index b0d1182..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/basic.css +++ /dev/null @@ -1,9 +0,0 @@ -body { font: Arial; background: blue; } - -#page { width: 700px; height: 100; } -#page #header { height: 300px; } -#page #header h1 { font-size: 50px; color: blue; } - -#content.user.show #container.top #column.left { width: 100px; } -#content.user.show #container.top #column.right { width: 600px; } -#content.user.show #container.bottom { background: brown; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/compact.css b/vendor/gems/haml-1.7.2/test/sass/results/compact.css deleted file mode 100644 index bd6bc91..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/compact.css +++ /dev/null @@ -1,5 +0,0 @@ -#main { width: 15em; color: #0000ff; } -#main p { border-style: dotted; border-width: 2px; } -#main .cool { width: 100px; } - -#left { font-size: 2em; font-weight: bold; float: left; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/complex.css b/vendor/gems/haml-1.7.2/test/sass/results/complex.css deleted file mode 100644 index 6b3123b..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/complex.css +++ /dev/null @@ -1,87 +0,0 @@ -body { margin: 0; font: 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; color: #fff; background: url(/images/global_bg.gif); } - -#page { width: 900px; margin: 0 auto; background: #440008; border-top-width: 5px; border-top-style: solid; border-top-color: #ff8500; } - -#header { height: 75px; padding: 0; } -#header h1 { float: left; width: 274px; height: 75px; margin: 0; background-image: url(/images/global_logo.gif); background-repeat: no-repeat; text-indent: -9999px; } -#header .status { float: right; padding-top: .5em; padding-left: .5em; padding-right: .5em; padding-bottom: 0; } -#header .status p { float: left; margin-top: 0; margin-right: 0.5em; margin-bottom: 0; margin-left: 0; } -#header .status ul { float: left; margin: 0; padding: 0; } -#header .status li { list-style-type: none; display: inline; margin: 0 5px; } -#header .status a:link, #header .status a:visited { color: #ff8500; text-decoration: none; } -#header .status a:hover { text-decoration: underline; } -#header .search { float: right; clear: right; margin: 12px 0 0 0; } -#header .search form { margin: 0; } -#header .search input { margin: 0 3px 0 0; padding: 2px; border: none; } - -#menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background: #00a4e4; } -#menu .contests ul { margin: 0 5px 0 0; padding: 0; } -#menu .contests ul li { list-style-type: none; margin: 0 5px; padding: 5px 5px 0 5px; display: inline; font-size: 1.1em; color: #fff; background: #00a4e4; } -#menu .contests ul li / This rule isn't a comment! { red: green; } -#menu .contests a:link, #menu .contests a:visited { color: #fff; text-decoration: none; font-weight: bold; } -#menu .contests a:hover { text-decoration: underline; } - -#content { clear: both; } -#content .container { clear: both; } -#content .container .column { float: left; } -#content .container .column .right { float: right; } -#content a:link, #content a:visited { color: #93d700; text-decoration: none; } -#content a:hover { text-decoration: underline; } - -#content p, #content div { width: 40em; } -#content p li, #content p dt, #content p dd, #content div li, #content div dt, #content div dd { color: #ddffdd; background-color: #4792bb; } -#content .container.video .column.left { width: 200px; } -#content .container.video .column.left .box { margin-top: 10px; } -#content .container.video .column.left .box p { margin: 0 1em auto 1em; } -#content .container.video .column.left .box.participants img { float: left; margin: 0 1em auto 1em; border: 1px solid #6e000d; border-style: solid; } -#content .container.video .column.left .box.participants h2 { margin: 0 0 10px 0; padding: 0.5em; /* The background image is a gif! */ background: #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat; /* Okay check this out Multiline comments Wow dude I mean seriously, WOW */ text-indent: -9999px; border-top-width: 5px; border-top-style: solid; border-top-color: #a20013; border-right-width: 1px; border-right-style: dotted; } -#content .container.video .column.middle { width: 500px; } -#content .container.video .column.right { width: 200px; } -#content .container.video .column.right .box { margin-top: 0; } -#content .container.video .column.right .box p { margin: 0 1em auto 1em; } -#content .container.video .column p { margin-top: 0; } - -#content.contests .container.information .column.right .box { margin: 1em 0; } -#content.contests .container.information .column.right .box.videos .thumbnail img { width: 200px; height: 150px; margin-bottom: 5px; } -#content.contests .container.information .column.right .box.videos a:link, #content.contests .container.information .column.right .box.videos a:visited { color: #93d700; text-decoration: none; } -#content.contests .container.information .column.right .box.videos a:hover { text-decoration: underline; } -#content.contests .container.information .column.right .box.votes a { display: block; width: 200px; height: 60px; margin: 15px 0; background: url(/images/btn_votenow.gif) no-repeat; text-indent: -9999px; outline: none; border: none; } -#content.contests .container.information .column.right .box.votes h2 { margin: 52px 0 10px 0; padding: 0.5em; background: #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; } - -#content.contests .container.video .box.videos h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; } -#content.contests .container.video .box.videos table { width: 100; } -#content.contests .container.video .box.videos table td { padding: 1em; width: 25; vertical-align: top; } -#content.contests .container.video .box.videos table td p { margin: 0 0 5px 0; } -#content.contests .container.video .box.videos table td a:link, #content.contests .container.video .box.videos table td a:visited { color: #93d700; text-decoration: none; } -#content.contests .container.video .box.videos table td a:hover { text-decoration: underline; } -#content.contests .container.video .box.videos .thumbnail { float: left; } -#content.contests .container.video .box.videos .thumbnail img { width: 80px; height: 60px; margin: 0 10px 0 0; border: 1px solid #6e000d; } - -#content .container.comments .column { margin-top: 15px; } -#content .container.comments .column.left { width: 600px; } -#content .container.comments .column.left .box ol { margin: 0; padding: 0; } -#content .container.comments .column.left .box li { list-style-type: none; padding: 10px; margin: 0 0 1em 0; background: #6e000d; border-top: 5px solid #a20013; } -#content .container.comments .column.left .box li div { margin-bottom: 1em; } -#content .container.comments .column.left .box li ul { text-align: right; } -#content .container.comments .column.left .box li ul li { display: inline; border: none; padding: 0; } -#content .container.comments .column.right { width: 290px; padding-left: 10px; } -#content .container.comments .column.right h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; } -#content .container.comments .column.right .box textarea { width: 290px; height: 100px; border: none; } - -#footer { margin-top: 10px; padding: 1.2em 1.5em; background: #ff8500; } -#footer ul { margin: 0; padding: 0; list-style-type: none; } -#footer ul li { display: inline; margin: 0 0.5em; color: #440008; } -#footer ul.links { float: left; } -#footer ul.links a:link, #footer ul.links a:visited { color: #440008; text-decoration: none; } -#footer ul.links a:hover { text-decoration: underline; } -#footer ul.copyright { float: right; } - -.clear { clear: both; } - -.centered { text-align: center; } - -img { border: none; } - -button.short { width: 60px; height: 22px; padding: 0 0 2px 0; color: #fff; border: none; background: url(/images/btn_short.gif) no-repeat; } - -table { border-collapse: collapse; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/constants.css b/vendor/gems/haml-1.7.2/test/sass/results/constants.css deleted file mode 100644 index d95c676..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/constants.css +++ /dev/null @@ -1,12 +0,0 @@ -#main { content: Hello!; qstr: Quo"ted"!; hstr: Hyph-en!; width: 30em; background-color: #000; color: #ffffaa; short-color: #112233; named-color: #808000; con: foo bar 9 hi there boom; con2: noquo quo; } -#main #sidebar { background-color: #00ff98; num-normal: 10; num-dec: 10.2; num-dec0: 99; num-neg: -10; esc: 10+12; many: 6; order: 7; complex: #4c9db1hi16; } - -#plus { num-num: 7; num-num-un: 25em; num-num-un2: 23em; num-num-neg: 9.87; num-str: 100px; num-col: #b7b7b7; num-perc: 31%; str-str: hi there; str-str2: hi there; str-col: 14em solid #112233; str-num: times: 13; col-num: #ff7b9d; col-col: #5173ff; } - -#minus { num-num: 900; col-num: #f9f9f4; col-col: #000035; unary-num: -1; unary-const: 10; unary-paren: -11; } - -#times { num-num: 7; num-col: #7496b8; col-num: #092345; col-col: #243648; } - -#div { num-num: 3.33333333333333; num-num2: 3; col-num: #092345; col-col: #0b0d0f; } - -#mod { num-num: 2; col-col: #0f0e05; col-num: #020001; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/expanded.css b/vendor/gems/haml-1.7.2/test/sass/results/expanded.css deleted file mode 100644 index 005586e..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/expanded.css +++ /dev/null @@ -1,18 +0,0 @@ -#main { - width: 15em; - color: #0000ff; -} -#main p { - border-style: dotted; - border-width: 2px; -} -#main .cool { - width: 100px; -} - -#left { - font-size: 2em; - font-weight: bold; - - float: left; -} diff --git a/vendor/gems/haml-1.7.2/test/sass/results/import.css b/vendor/gems/haml-1.7.2/test/sass/results/import.css deleted file mode 100644 index 1f5ebbc..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/import.css +++ /dev/null @@ -1,27 +0,0 @@ -imported { otherconst: hello; myconst: goodbye; } - -body { font: Arial; background: blue; } - -#page { width: 700px; height: 100; } -#page #header { height: 300px; } -#page #header h1 { font-size: 50px; color: blue; } - -#content.user.show #container.top #column.left { width: 100px; } -#content.user.show #container.top #column.right { width: 600px; } -#content.user.show #container.bottom { background: brown; } - -midrule { inthe: middle; } - -body { font: Arial; background: blue; } - -#page { width: 700px; height: 100; } -#page #header { height: 300px; } -#page #header h1 { font-size: 50px; color: blue; } - -#content.user.show #container.top #column.left { width: 100px; } -#content.user.show #container.top #column.right { width: 600px; } -#content.user.show #container.bottom { background: brown; } - -@import url(basic.css); -@import url(../results/complex.css); -nonimported { myconst: hello; otherconst: goodbye; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/nested.css b/vendor/gems/haml-1.7.2/test/sass/results/nested.css deleted file mode 100644 index 7f6ad82..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/nested.css +++ /dev/null @@ -1,21 +0,0 @@ -#main { - width: 15em; - color: #0000ff; } - #main p { - border-style: dotted; - border-width: 2px; } - #main .cool { - width: 100px; } - -#left { - font-size: 2em; - font-weight: bold; - - float: left; } - -#right .header { - border-style: solid; } -#right .body { - border-style: dotted; } -#right .footer { - border-style: dashed; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/parent_ref.css b/vendor/gems/haml-1.7.2/test/sass/results/parent_ref.css deleted file mode 100644 index c502a23..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/parent_ref.css +++ /dev/null @@ -1,13 +0,0 @@ -a { color: #000; } -a:hover { color: #f00; } - -p, div { width: 100em; } -p foo, div foo { width: 10em; } -p:hover, p bar, div:hover, div bar { height: 20em; } - -#cool { border-style: solid; border-width: 2em; } -.ie7 #cool, .ie6 #cool { content: string(Totally not cool.); } -.firefox #cool { content: string(Quite cool.); } - -.wow, .snazzy { font-family: fantasy; } -.wow:hover, .wow:visited, .snazzy:hover, .snazzy:visited { font-weight: bold; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/subdir/nested_subdir/nested_subdir.css b/vendor/gems/haml-1.7.2/test/sass/results/subdir/nested_subdir/nested_subdir.css deleted file mode 100644 index 7aadcfe..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/subdir/nested_subdir/nested_subdir.css +++ /dev/null @@ -1 +0,0 @@ -#pi { width: 314px; } \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/results/subdir/subdir.css b/vendor/gems/haml-1.7.2/test/sass/results/subdir/subdir.css deleted file mode 100644 index 25c5c19..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/results/subdir/subdir.css +++ /dev/null @@ -1 +0,0 @@ -#subdir { font-size: 20px; font-weight: bold; } \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/alt.sass b/vendor/gems/haml-1.7.2/test/sass/templates/alt.sass deleted file mode 100644 index f805e18..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/alt.sass +++ /dev/null @@ -1,16 +0,0 @@ -h1 - :float left - :width 274px - height: 75px - margin: 0 - background: - repeat: no-repeat - :image none - a:hover, a:visited - color: green - b:hover - color: red - :background-color green - const - nosp= 1 + 2 - sp = 1 + 2 diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/basic.sass b/vendor/gems/haml-1.7.2/test/sass/templates/basic.sass deleted file mode 100644 index 71117bf..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/basic.sass +++ /dev/null @@ -1,23 +0,0 @@ - - -body - :font Arial - :background blue - -#page - :width 700px - :height 100 - #header - :height 300px - h1 - :font-size 50px - :color blue - -#content.user.show - #container.top - #column.left - :width 100px - #column.right - :width 600px - #container.bottom - :background brown \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/bork.sass b/vendor/gems/haml-1.7.2/test/sass/templates/bork.sass deleted file mode 100644 index b0d9abe..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/bork.sass +++ /dev/null @@ -1,2 +0,0 @@ -bork - :bork= !bork diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/bork2.sass b/vendor/gems/haml-1.7.2/test/sass/templates/bork2.sass deleted file mode 100644 index 462afb5..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/bork2.sass +++ /dev/null @@ -1,2 +0,0 @@ -bork - :bork: bork; diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/compact.sass b/vendor/gems/haml-1.7.2/test/sass/templates/compact.sass deleted file mode 100644 index 675fea4..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/compact.sass +++ /dev/null @@ -1,15 +0,0 @@ -#main - :width 15em - :color #0000ff - p - :border - :style dotted - :width 2px - .cool - :width 100px - -#left - :font - :size 2em - :weight bold - :float left diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/complex.sass b/vendor/gems/haml-1.7.2/test/sass/templates/complex.sass deleted file mode 100644 index 6517815..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/complex.sass +++ /dev/null @@ -1,309 +0,0 @@ -body - :margin 0 - :font 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif - :color #fff - :background url(/images/global_bg.gif) - -#page - :width 900px - :margin 0 auto - :background #440008 - :border-top - :width 5px - :style solid - :color #ff8500 - -#header - :height 75px - :padding 0 - h1 - :float left - :width 274px - :height 75px - :margin 0 - :background - :image url(/images/global_logo.gif) - :repeat no-repeat - :text-indent -9999px - .status - :float right - :padding - :top .5em - :left .5em - :right .5em - :bottom 0 - p - :float left - :margin - :top 0 - :right 0.5em - :bottom 0 - :left 0 - ul - :float left - :margin 0 - :padding 0 - li - :list-style-type none - :display inline - :margin 0 5px - a:link, a:visited - :color #ff8500 - :text-decoration none - a:hover - :text-decoration underline - .search - :float right - :clear right - :margin 12px 0 0 0 - form - :margin 0 - input - :margin 0 3px 0 0 - :padding 2px - :border none - -#menu - :clear both - :text-align right - :height 20px - :border-bottom 5px solid #006b95 - :background #00a4e4 - .contests - ul - :margin 0 5px 0 0 - :padding 0 - li - :list-style-type none - :margin 0 5px - :padding 5px 5px 0 5px - :display inline -// This comment is in the middle of this rule - :font-size 1.1em - // This comment is properly indented - :color #fff - :background #00a4e4 - / This rule isn't a comment! - :red green - a:link, a:visited - :color #fff - :text-decoration none - :font-weight bold - a:hover - :text-decoration underline - -//General content information -#content - :clear both - .container - :clear both - .column - :float left - .left - .middle - .right - :float right - a:link, a:visited - :color #93d700 - :text-decoration none - a:hover - :text-decoration underline - -// A hard tab: - - -#content - p, div - :width 40em - li, dt, dd - :color #ddffdd - :background-color #4792bb - .container.video - .column.left - :width 200px - .box - :margin-top 10px - p - :margin 0 1em auto 1em - .box.participants - img - :float left - :margin 0 1em auto 1em - :border 1px solid #6e000d - :style solid - h2 - :margin 0 0 10px 0 - :padding 0.5em - /* The background image is a gif! - :background #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat - /* Okay check this out - Multiline comments - Wow dude - I mean seriously, WOW - :text-indent -9999px - // And also... - Multiline comments that don't output! - Snazzy, no? - :border - :top - :width 5px - :style solid - :color #a20013 - :right - :width 1px - :style dotted - .column.middle - :width 500px - .column.right - :width 200px - .box - :margin-top 0 - p - :margin 0 1em auto 1em - .column - p - :margin-top 0 - -#content.contests - .container.information - .column.right - .box - :margin 1em 0 - .box.videos - .thumbnail img - :width 200px - :height 150px - :margin-bottom 5px - a:link, a:visited - :color #93d700 - :text-decoration none - a:hover - :text-decoration underline - .box.votes - a - :display block - :width 200px - :height 60px - :margin 15px 0 - :background url(/images/btn_votenow.gif) no-repeat - :text-indent -9999px - :outline none - :border none - h2 - :margin 52px 0 10px 0 - :padding 0.5em - :background #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat - :text-indent -9999px - :border-top 5px solid #a20013 - -#content.contests - .container.video - .box.videos - h2 - :margin 0 - :padding 0.5em - :background #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat - :text-indent -9999px - :border-top 5px solid #a20013 - table - :width 100 - td - :padding 1em - :width 25 - :vertical-align top - p - :margin 0 0 5px 0 - a:link, a:visited - :color #93d700 - :text-decoration none - a:hover - :text-decoration underline - .thumbnail - :float left - img - :width 80px - :height 60px - :margin 0 10px 0 0 - :border 1px solid #6e000d - -#content - .container.comments - .column - :margin-top 15px - .column.left - :width 600px - .box - ol - :margin 0 - :padding 0 - li - :list-style-type none - :padding 10px - :margin 0 0 1em 0 - :background #6e000d - :border-top 5px solid #a20013 - div - :margin-bottom 1em - ul - :text-align right - li - :display inline - :border none - :padding 0 - .column.right - :width 290px - :padding-left 10px - h2 - :margin 0 - :padding 0.5em - :background #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat - :text-indent -9999px - :border-top 5px solid #a20013 - .box - textarea - :width 290px - :height 100px - :border none - -#footer - :margin-top 10px - :padding 1.2em 1.5em - :background #ff8500 - ul - :margin 0 - :padding 0 - :list-style-type none - li - :display inline - :margin 0 0.5em - :color #440008 - ul.links - :float left - a:link, a:visited - :color #440008 - :text-decoration none - a:hover - :text-decoration underline - ul.copyright - :float right - - -.clear - :clear both - -.centered - :text-align center - -img - :border none - -button.short - :width 60px - :height 22px - :padding 0 0 2px 0 - :color #fff - :border none - :background url(/images/btn_short.gif) no-repeat - -table - :border-collapse collapse diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/constants.sass b/vendor/gems/haml-1.7.2/test/sass/templates/constants.sass deleted file mode 100644 index 6f2eda5..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/constants.sass +++ /dev/null @@ -1,88 +0,0 @@ -!width = 10em + 20 -!color = #00ff98 -!main_text = #ffa -!num = 10 -!dec = 10.2 -!dec_0 = 99.0 -!neg = -10 -!esc= 10\+12 -!str= "Hello!" -!qstr= "Quo\"ted\"!" -!hstr= "Hyph-en!" -!concat = (5 + 4) hi there -!percent= 11% - -#main - :content = !str - :qstr = !qstr - :hstr = !hstr - :width = !width - :background-color #000 - :color= !main_text - :short-color= #123 - :named-color= olive - :con= foo bar (!concat boom) - :con2= noquo "quo" - #sidebar - :background-color= !color - :num - :normal= !num - :dec= !dec - :dec0= !dec_0 - :neg= !neg - :esc= !esc - :many= 1 + 2 + 3 - :order= 1 + 2 * 3 - :complex= ((1 + 2) + 15)+#3a8b9f + (hi+(1 +1+ 2)* 4) - -#plus - :num - :num= 5+2 - :num-un= 10em + 15em - :num-un2= 10 + 13em - :num-neg= 10 + -.13 - :str= 100 + px - :col= 13 + #aaa - :perc = !percent + 20% - :str - :str= hi + \ there - :str2= hi + " there" - :col= "14em solid " + #123 - :num= times:\ + 13 - :col - :num= #f02 + 123.5 - :col= #12A + #405162 - -#minus - :num - :num= 912 - 12 - :col - :num= #fffffa - 5.2 - :col= #abcdef - #fedcba - :unary - :num= -1 - :const= -!neg - :paren= -(5 + 6) - -#times - :num - :num= 2 * 3.5 - :col= 2 * #3a4b5c - :col - :num= #12468a * 0.5 - :col= #121212 * #020304 - -#div - :num - :num= 10 / 3.0 - :num2= 10 / 3 - :col - :num= #12468a / 2 - :col= #abcdef / #0f0f0f - -#mod - :num - :num= 17 % 3 - :col - :col= #5f6e7d % #10200a - :num= #aaabac % 3 diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/expanded.sass b/vendor/gems/haml-1.7.2/test/sass/templates/expanded.sass deleted file mode 100644 index 675fea4..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/expanded.sass +++ /dev/null @@ -1,15 +0,0 @@ -#main - :width 15em - :color #0000ff - p - :border - :style dotted - :width 2px - .cool - :width 100px - -#left - :font - :size 2em - :weight bold - :float left diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/import.sass b/vendor/gems/haml-1.7.2/test/sass/templates/import.sass deleted file mode 100644 index d286c1d..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/import.sass +++ /dev/null @@ -1,8 +0,0 @@ -!preconst = hello - -@import importee, basic, basic.css, ../results/complex.css - -nonimported - :myconst = !preconst - :otherconst = !postconst - diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/importee.sass b/vendor/gems/haml-1.7.2/test/sass/templates/importee.sass deleted file mode 100644 index 631aa25..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/importee.sass +++ /dev/null @@ -1,10 +0,0 @@ -!postconst = goodbye - -imported - :otherconst = !preconst - :myconst = !postconst - -@import basic - -midrule - :inthe middle \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/nested.sass b/vendor/gems/haml-1.7.2/test/sass/templates/nested.sass deleted file mode 100644 index 1adb4be..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/nested.sass +++ /dev/null @@ -1,23 +0,0 @@ -#main - :width 15em - :color #0000ff - p - :border - :style dotted - :width 2px - .cool - :width 100px - -#left - :font - :size 2em - :weight bold - :float left - -#right - .header - :border-style solid - .body - :border-style dotted - .footer - :border-style dashed diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/parent_ref.sass b/vendor/gems/haml-1.7.2/test/sass/templates/parent_ref.sass deleted file mode 100644 index 6b261d7..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/parent_ref.sass +++ /dev/null @@ -1,25 +0,0 @@ -a - :color #000 - &:hover - :color #f00 - -p, div - :width 100em - & foo - :width 10em - &:hover, bar - :height 20em - -#cool - :border - :style solid - :width 2em - .ie7 &, .ie6 & - :content string(Totally not cool.) - .firefox & - :content string(Quite cool.) - -.wow, .snazzy - :font-family fantasy - &:hover, &:visited - :font-weight bold diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/subdir/nested_subdir/nested_subdir.sass b/vendor/gems/haml-1.7.2/test/sass/templates/subdir/nested_subdir/nested_subdir.sass deleted file mode 100644 index aae9eeb..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +++ /dev/null @@ -1,3 +0,0 @@ -#pi - :width 314px - \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/subdir/subdir.sass b/vendor/gems/haml-1.7.2/test/sass/templates/subdir/subdir.sass deleted file mode 100644 index bbe9810..0000000 --- a/vendor/gems/haml-1.7.2/test/sass/templates/subdir/subdir.sass +++ /dev/null @@ -1,6 +0,0 @@ -#subdir - :font - :size 20px - :weight bold - - \ No newline at end of file diff --git a/vendor/gems/hpricot-0.6/CHANGELOG b/vendor/gems/hpricot-0.6/CHANGELOG deleted file mode 100644 index 2c7051b..0000000 --- a/vendor/gems/hpricot-0.6/CHANGELOG +++ /dev/null @@ -1,62 +0,0 @@ -= 0.6 -=== 15th June, 2007 -* Hpricot for JRuby -- nice work Ola Bini! -* Inline Markaby for Hpricot documents. -* XML tags and attributes are no longer downcased like HTML is. -* new syntax for grabbing everything between two elements using a Range in the search method: (doc/("font".."font/br")) or in nodes_at like so: (doc/"font").nodes_at("*".."br"). Only works with either a pair of siblings or a set of a parent and a sibling. -* Ignore self-closing endings on tags (such as form) which are containers. Treat them like open parent tags. Reported by Jonathan Nichols on the hpricot list. -* Escaping of attributes, yanked from Jim Weirich and Sam Ruby's work in Builder. -* Element#raw_attributes gives unescaped data. Element#attributes gives escaped. -* Added: Elements#attr, Elements#remove_attr, Elements#remove_class. -* Added: Traverse#preceding, Traverse#following, Traverse#previous, Traverse#next. - -= 0.5 -=== 31rd January, 2007 - -* support for a[text()="Click Me!"] and h3[text()*="space"] and the like. -* Hpricot.buffer_size accessor for increasing Hpricot's buffer if you're encountering huge ASP.NET viewstate attribs. -* some support for colons in tag names (not full namespace support yet.) -* Element.to_original_html will attempt to preserve the original HTML while merging your changes. -* Element.to_plain_text converts an element's contents to a simple text format. -* Element.inner_text removes all tags and returns text nodes concatenated into a single string. -* no @raw_string variable kept for comments, text, and cdata -- as it's redundant. -* xpath-style indices (//p/a[1]) but keep in mind that they aren't zero-based. -* node_position is the index among all sibling nodes, while position is the position among children of identical type. -* comment() and text() search criteria, like: //p/text(), which selects all text inside paragraph tags. -* every element has css_path and xpath methods which return respective absolute paths. -* more flexibility all around: in parsing attributes, tags, comments and cdata. - -= 0.4 -=== 11th August, 2006 - -* The :fixup_tags option will try to sort out the hierarchy so elements end up with the right parents. -* Elements such as *script* and *style* (identified as having CDATA contents) receive a single text node as their children now. Previously, Hpricot was parsing out tags found in scripts. -* Better scanning of partially quoted attributes (found by Brent Beardsly on http://uswebgen.com/) -* Better scanning of unquoted attributes -- thanks to Aaron Patterson for the test cases! -* Some tags were being output in the empty tag style, although browsers hated that. FIXED! -* Added Elements#at for finding single elements. -* Added Elem::Trav#[] and Elem::Trav#[]= for reading and writing attributes. - -= 0.3 -=== 7th July, 2006 - -* Fixed negative string size error on empty tokens. (news.bbc.co.uk) -* Allow the parser to accept just text nodes. (such as: Hpricot.parse('TEXT')) -* from JQuery to Hpricot::Elements: remove, empty, append, prepend, before, after, wrap, set, - html(...), to_html, to_s. -* on containers: to_html, replace_child, insert_before, insert_after, innerHTML=. -* Hpricot(...) is an alias for parse. -* open up all properties to setters, let people do as they may. -* use to_html for the full html of a node or set of elements. -* doctypes were messed. - -= 0.2 -=== 4th July, 2006 - -* Rewrote the HTree parser to be simpler, more adequate for the common man. Will add encoding back in later. - -= 0.1 -=== 3rd July, 2006 - -* For whatever reason, wrote this HTML parser in C. - I guess Ragel is addictive and I want to improve HTree. diff --git a/vendor/gems/hpricot-0.6/COPYING b/vendor/gems/hpricot-0.6/COPYING deleted file mode 100644 index 94b6b84..0000000 --- a/vendor/gems/hpricot-0.6/COPYING +++ /dev/null @@ -1,18 +0,0 @@ -Copyright (c) 2006 why the lucky stiff - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/gems/hpricot-0.6/README b/vendor/gems/hpricot-0.6/README deleted file mode 100644 index 6443214..0000000 --- a/vendor/gems/hpricot-0.6/README +++ /dev/null @@ -1,284 +0,0 @@ -= Hpricot, Read Any HTML - -Hpricot is a fast, flexible HTML parser written in C. It's designed to be very -accommodating (like Tanaka Akira's HTree) and to have a very helpful library -(like some JavaScript libs -- JQuery, Prototype -- give you.) The XPath and CSS -parser, in fact, is based on John Resig's JQuery. - -Also, Hpricot can be handy for reading broken XML files, since many of the same -techniques can be used. If a quote is missing, Hpricot tries to figure it out. -If tags overlap, Hpricot works on sorting them out. You know, that sort of -thing. - -*Please read this entire document* before making assumptions about how this -software works. - -== An Overview - -Let's clear up what Hpricot is. - -# Hpricot is *a standalone library*. It requires no other libraries. Just Ruby! -# While priding itself on speed, Hpricot *works hard to sort out bad HTML* and - pays a small penalty in order to get that right. So that's slightly more important - to me than speed. -# *If you can see it in Firefox, then Hpricot should parse it.* That's - how it should be! Let me know the minute it's otherwise. -# Primarily, Hpricot is used for reading HTML and tries to sort out troubled - HTML by having some idea of what good HTML is. Some people still like to use - Hpricot for XML reading, but *remember to use the Hpricot::XML() method* for that! - -== The Hpricot Kingdom - -First, here are all the links you need to know: - -* http://code.whytheluckystiff.net/hpricot is the Hpricot wiki and bug tracker. - Go there for news and recipes and patches. It's the center of activity. -* http://code.whytheluckystiff.net/svn/hpricot/trunk is the main Subversion - repository for Hpricot. You can get the latest code there. -* http://code.whytheluckystiff.net/doc/hpricot is the home for the latest copy of - this reference. -* See COPYING for the terms of this software. (Spoiler: it's absolutely free.) - -If you have any trouble, don't hesitate to contact the author. As always, I'm -not going to say "Use at your own risk" because I don't want this library to be -risky. If you trip on something, I'll share the liability by repairing things -as quickly as I can. Your responsibility is to report the inadequacies. - -== Installing Hpricot - -You may get the latest stable version from Rubyforge. Win32 binaries and source -gems are available. - - $ gem install hpricot - -As Hpricot is still under active development, you can also try the most recent -candidate build here: - - $ gem install hpricot --source http://code.whytheluckystiff.net - -The development gem is usually in pretty good shape actually. You can also -get the bleeding edge code or plain Ruby tarballs on the wiki. - -== An Hpricot Showcase - -We're going to run through a big pile of examples to get you jump-started. -Many of these examples are also found at -http://code.whytheluckystiff.net/hpricot/wiki/HpricotBasics, in case you -want to add some of your own. - -=== Loading Hpricot Itself - -You have probably got the gem, right? To load Hpricot: - - require 'rubygems' - require 'hpricot' - -If you've installed the plain source distribution, go ahead and just: - - require 'hpricot' - -=== Load an HTML Page - -The Hpricot() method takes a string or any IO object and loads the -contents into a document object. - - doc = Hpricot("

      A simple test string.

      ") - -To load from a file, just get the stream open: - - doc = open("index.html") { |f| Hpricot(f) } - -To load from a web URL, use open-uri, which comes with Ruby: - - require 'open-uri' - doc = open("http://qwantz.com/") { |f| Hpricot(f) } - -Hpricot uses an internal buffer to parse the file, so the IO will stream -properly and large documents won't be loaded into memory all at once. However, -the parsed document object will be present in memory, in its entirety. - -=== Search for Elements - -Use Doc.search: - - doc.search("//p[@class='posted']") - #=> # - -Doc.search can take an XPath or CSS expression. In the above example, -all paragraph

      elements are grabbed which have a class -attribute of "posted". - -A shortcut is to use the divisor: - - (doc/"p.posted") - #=> # - -=== Finding Just One Element - -If you're looking for a single element, the at method will return the -first element matched by the expression. In this case, you'll get back the -element itself rather than the Hpricot::Elements array. - - doc.at("body")['onload'] - -The above code will find the body tag and give you back the onload -attribute. This is the most common reason to use the element directly: when -reading and writing HTML attributes. - -=== Fetching the Contents of an Element - -Just as with browser scripting, the inner_html property can be used to -get the inner contents of an element. - - (doc/"#elementID").inner_html - #=> "..contents.." - -If your expression matches more than one element, you'll get back the contents -of ''all the matched elements''. So you may want to use first to be -sure you get back only one. - - (doc/"#elementID").first.inner_html - #=> "..contents.." - -=== Fetching the HTML for an Element - -If you want the HTML for the whole element (not just the contents), use -to_html: - - (doc/"#elementID").to_html - #=> "

      ...
      " - -=== Looping - -All searches return a set of Hpricot::Elements. Go ahead and loop -through them like you would an array. - - (doc/"p/a/img").each do |img| - puts img.attributes['class'] - end - -=== Continuing Searches - -Searches can be continued from a collection of elements, in order to search deeper. - - # find all paragraphs. - elements = doc.search("/html/body//p") - # continue the search by finding any images within those paragraphs. - (elements/"img") - #=> # - -Searches can also be continued by searching within container elements. - - # find all images within paragraphs. - doc.search("/html/body//p").each do |para| - puts "== Found a paragraph ==" - pp para - - imgs = para.search("img") - if imgs.any? - puts "== Found #{imgs.length} images inside ==" - end - end - -Of course, the most succinct ways to do the above are using CSS or XPath. - - # the xpath version - (doc/"/html/body//p//img") - # the css version - (doc/"html > body > p img") - # ..or symbols work, too! - (doc/:html/:body/:p/:img) - -=== Looping Edits - -You may certainly edit objects from within your search loops. Then, when you -spit out the HTML, the altered elements will show. - - (doc/"span.entryPermalink").each do |span| - span.attributes['class'] = 'newLinks' - end - puts doc - -This changes all span.entryPermalink elements to -span.newLinks. Keep in mind that there are often more convenient ways -of doing this. Such as the set method: - - (doc/"span.entryPermalink").set(:class => 'newLinks') - -=== Figuring Out Paths - -Every element can tell you its unique path (either XPath or CSS) to get to the -element from the root tag. - -The css_path method: - - doc.at("div > div:nth(1)").css_path - #=> "div > div:nth(1)" - doc.at("#header").css_path - #=> "#header" - -Or, the xpath method: - - doc.at("div > div:nth(1)").xpath - #=> "/div/div:eq(1)" - doc.at("#header").xpath - #=> "//div[@id='header']" - -== Hpricot Fixups - -When loading HTML documents, you have a few settings that can make Hpricot more -or less intense about how it gets involved. - -== :fixup_tags - -Really, there are so many ways to clean up HTML and your intentions may be to -keep the HTML as-is. So Hpricot's default behavior is to keep things flexible. -Making sure to open and close all the tags, but ignore any validation problems. - -As of Hpricot 0.4, there's a new :fixup_tags option which will attempt -to shift the document's tags to meet XHTML 1.0 Strict. - - doc = open("index.html") { |f| Hpricot f, :fixup_tags => true } - -This doesn't quite meet the XHTML 1.0 Strict standard, it just tries to follow -the rules a bit better. Like: say Hpricot finds a paragraph in a link, it's -going to move the paragraph below the link. Or up and out of other elements -where paragraphs don't belong. - -If an unknown element is found, it is ignored. Again, :fixup_tags. - -== :xhtml_strict - -So, let's go beyond just trying to fix the hierarchy. The -:xhtml_strict option really tries to force the document to be an XHTML -1.0 Strict document. Even at the cost of removing elements that get in the way. - - doc = open("index.html") { |f| Hpricot f, :xhtml_strict => true } - -What measures does :xhtml_strict take? - - 1. Shift elements into their proper containers just like :fixup_tags. - 2. Remove unknown elements. - 3. Remove unknown attributes. - 4. Remove illegal content. - 5. Alter the doctype to XHTML 1.0 Strict. - -== Hpricot.XML() - -The last option is the :xml option, which makes some slight variations -on the standard mode. The main difference is that :xml mode won't try to output -tags which are friendlier for browsers. For example, if an opening and closing -br tag is found, XML mode won't try to turn that into an empty element. - -XML mode also doesn't downcase the tags and attributes for you. So pay attention -to case, friends. - -The primary way to use Hpricot's XML mode is to call the Hpricot.XML method: - - doc = open("http://redhanded.hobix.com/index.xml") do |f| - Hpricot.XML(f) - end - -*Also, :fixup_tags is canceled out by the :xml option.* This is because -:fixup_tags makes assumptions based how HTML is structured. Specifically, how -tags are defined in the XHTML 1.0 DTD. diff --git a/vendor/gems/hpricot-0.6/Rakefile b/vendor/gems/hpricot-0.6/Rakefile deleted file mode 100644 index 9c6cb43..0000000 --- a/vendor/gems/hpricot-0.6/Rakefile +++ /dev/null @@ -1,211 +0,0 @@ -require 'rake' -require 'rake/clean' -require 'rake/gempackagetask' -require 'rake/rdoctask' -require 'rake/testtask' -require 'fileutils' -include FileUtils - -NAME = "hpricot" -REV = `svn info`[/Revision: (\d+)/, 1] rescue nil -VERS = ENV['VERSION'] || "0.6" + (REV ? ".#{REV}" : "") -PKG = "#{NAME}-#{VERS}" -BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}" -ARCHLIB = "lib/#{::Config::CONFIG['arch']}" -CLEAN.include ["ext/hpricot_scan/#{BIN}", "lib/**/#{BIN}", 'ext/hpricot_scan/Makefile', - '**/.*.sw?', '*.gem', '.config'] -RDOC_OPTS = ['--quiet', '--title', 'The Hpricot Reference', '--main', 'README', '--inline-source'] -PKG_FILES = %w(CHANGELOG COPYING README Rakefile) + - Dir.glob("{bin,doc,test,lib,extras}/**/*") + - Dir.glob("ext/**/*.{h,java,c,rb,rl}") + - %w[ext/hpricot_scan/hpricot_scan.c] # needed because it's generated later -SPEC = - Gem::Specification.new do |s| - s.name = NAME - s.version = VERS - s.platform = Gem::Platform::RUBY - s.has_rdoc = true - s.rdoc_options += RDOC_OPTS - s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"] - s.summary = "a swift, liberal HTML parser with a fantastic library" - s.description = s.summary - s.author = "why the lucky stiff" - s.email = 'why@ruby-lang.org' - s.homepage = 'http://code.whytheluckystiff.net/hpricot/' - s.files = PKG_FILES - s.require_paths = [ARCHLIB, "lib"] - s.extensions = FileList["ext/**/extconf.rb"].to_a - s.bindir = "bin" - end - -desc "Does a full compile, test run" -task :default => [:compile, :test] - -desc "Packages up Hpricot." -task :package => [:clean, :ragel] - -desc "Releases packages for all Hpricot packages and platforms." -task :release => [:package, :package_win32, :package_jruby] - -desc "Run all the tests" -Rake::TestTask.new do |t| - t.libs << "test" << ARCHLIB - t.test_files = FileList['test/test_*.rb'] - t.verbose = true -end - -Rake::RDocTask.new do |rdoc| - rdoc.rdoc_dir = 'doc/rdoc' - rdoc.options += RDOC_OPTS - rdoc.main = "README" - rdoc.rdoc_files.add ['README', 'CHANGELOG', 'COPYING', 'lib/**/*.rb'] -end - -Rake::GemPackageTask.new(SPEC) do |p| - p.need_tar = true - p.gem_spec = SPEC -end - -extension = "hpricot_scan" -ext = "ext/hpricot_scan" -ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}" -ext_files = FileList[ - "#{ext}/*.c", - "#{ext}/*.h", - "#{ext}/*.rl", - "#{ext}/extconf.rb", - "#{ext}/Makefile", - "lib" -] - -task "lib" do - directory "lib" -end - -desc "Compiles the Ruby extension" -task :compile => [:hpricot_scan] do - if Dir.glob(File.join(ARCHLIB,"hpricot_scan.*")).length == 0 - STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - STDERR.puts "Gem actually failed to build. Your system is" - STDERR.puts "NOT configured properly to build hpricot." - STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - exit(1) - end -end -task :hpricot_scan => [:ragel] - -desc "Builds just the #{extension} extension" -task extension.to_sym => ["#{ext}/Makefile", ext_so ] - -file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do - Dir.chdir(ext) do ruby "extconf.rb" end -end - -file ext_so => ext_files do - Dir.chdir(ext) do - sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') - end - mkdir_p ARCHLIB - cp ext_so, ARCHLIB -end - -desc "returns the ragel version" -task :ragel_version do - @ragel_v = `ragel -v`[/(version )(\S*)/,2].to_f -end - -desc "Generates the C scanner code with Ragel." -task :ragel => [:ragel_version] do - sh %{ragel ext/hpricot_scan/hpricot_scan.rl | #{@ragel_v >= 5.18 ? 'rlgen-cd' : 'rlcodegen'} -G2 -o ext/hpricot_scan/hpricot_scan.c} -end - -desc "Generates the Java scanner code with Ragel." -task :ragel_java => [:ragel_version] do - sh %{ragel -J ext/hpricot_scan/hpricot_scan.java.rl | #{@ragel_v >= 5.18 ? 'rlgen-java' : 'rlcodegen'} -o ext/hpricot_scan/HpricotScanService.java} -end - -### Win32 Packages ### - -Win32Spec = SPEC.dup -Win32Spec.platform = Gem::Platform::WIN32 -Win32Spec.files = PKG_FILES + ["#{ARCHLIB}/hpricot_scan.so"] -Win32Spec.extensions = [] - -WIN32_PKG_DIR = "#{PKG}-mswin32" - -desc "Package up the Win32 distribution." -file WIN32_PKG_DIR => [:package] do - sh "tar zxf pkg/#{PKG}.tgz" - mv PKG, WIN32_PKG_DIR -end - -desc "Cross-compile the hpricot_scan extension for win32" -file "hpricot_scan_win32" => [WIN32_PKG_DIR] do - cp "extras/mingw-rbconfig.rb", "#{WIN32_PKG_DIR}/ext/hpricot_scan/rbconfig.rb" - sh "cd #{WIN32_PKG_DIR}/ext/hpricot_scan/ && ruby -I. extconf.rb && make" - mv "#{WIN32_PKG_DIR}/ext/hpricot_scan/hpricot_scan.so", "#{WIN32_PKG_DIR}/#{ARCHLIB}" -end - -desc "Build the binary RubyGems package for win32" -task :package_win32 => ["hpricot_scan_win32"] do - Dir.chdir("#{WIN32_PKG_DIR}") do - Gem::Builder.new(Win32Spec).build - verbose(true) { - mv Dir["*.gem"].first, "../pkg/#{WIN32_PKG_DIR}.gem" - } - end -end - -CLEAN.include WIN32_PKG_DIR - -### JRuby Packages ### - -compile_java = proc do - sh %{javac -source 1.4 -target 1.4 -classpath $JRUBY_HOME/lib/jruby.jar HpricotScanService.java} - sh %{jar cf hpricot_scan.jar HpricotScanService.class} -end - -desc "Compiles the JRuby extension" -task :hpricot_scan_java => [:ragel_java] do - Dir.chdir("ext/hpricot_scan", &compile_java) -end - -JRubySpec = SPEC.dup -JRubySpec.platform = 'jruby' -JRubySpec.files = PKG_FILES + ["#{ARCHLIB}/hpricot_scan.jar"] -JRubySpec.extensions = [] - -JRUBY_PKG_DIR = "#{PKG}-jruby" - -desc "Package up the JRuby distribution." -file JRUBY_PKG_DIR => [:ragel_java, :package] do - sh "tar zxf pkg/#{PKG}.tgz" - mv PKG, JRUBY_PKG_DIR -end - -desc "Cross-compile the hpricot_scan extension for JRuby" -file "hpricot_scan_jruby" => [JRUBY_PKG_DIR] do - Dir.chdir("#{JRUBY_PKG_DIR}/ext/hpricot_scan", &compile_java) - mv "#{JRUBY_PKG_DIR}/ext/hpricot_scan/hpricot_scan.jar", "#{JRUBY_PKG_DIR}/#{ARCHLIB}" -end - -desc "Build the RubyGems package for JRuby" -task :package_jruby => ["hpricot_scan_jruby"] do - Dir.chdir("#{JRUBY_PKG_DIR}") do - Gem::Builder.new(JRubySpec).build - verbose(true) { - mv Dir["*.gem"].first, "../pkg/#{JRUBY_PKG_DIR}.gem" - } - end -end - -CLEAN.include JRUBY_PKG_DIR - -task :install do - sh %{rake package} - sh %{sudo gem install pkg/#{NAME}-#{VERS}} -end - -task :uninstall => [:clean] do - sh %{sudo gem uninstall #{NAME}} -end diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/HpricotScanService.java b/vendor/gems/hpricot-0.6/ext/hpricot_scan/HpricotScanService.java deleted file mode 100644 index efbc941..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/HpricotScanService.java +++ /dev/null @@ -1,1340 +0,0 @@ - -import java.io.IOException; - -import org.jruby.Ruby; -import org.jruby.RubyClass; -import org.jruby.RubyHash; -import org.jruby.RubyModule; -import org.jruby.RubyNumeric; -import org.jruby.RubyString; -import org.jruby.runtime.Block; -import org.jruby.runtime.CallbackFactory; -import org.jruby.runtime.builtin.IRubyObject; -import org.jruby.exceptions.RaiseException; -import org.jruby.runtime.load.BasicLibraryService; - -public class HpricotScanService implements BasicLibraryService { - public static String NO_WAY_SERIOUSLY="*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!"; - - public void ELE(IRubyObject N) { - if (tokend > tokstart || text) { - IRubyObject raw_string = runtime.getNil(); - ele_open = false; text = false; - if (tokstart != -1 && N != cdata && N != sym_text && N != procins && N != comment) { - raw_string = runtime.newString(new String(buf,tokstart,tokend-tokstart)); - } - rb_yield_tokens(N, tag[0], attr, raw_string, taint); - } - } - - public void SET(IRubyObject[] N, int E) { - int mark = 0; - if(N == tag) { - if(mark_tag == -1 || E == mark_tag) { - tag[0] = runtime.newString(""); - } else if(E > mark_tag) { - tag[0] = runtime.newString(new String(buf,mark_tag, E-mark_tag)); - } - } else if(N == akey) { - if(mark_akey == -1 || E == mark_akey) { - akey[0] = runtime.newString(""); - } else if(E > mark_akey) { - akey[0] = runtime.newString(new String(buf,mark_akey, E-mark_akey)); - } - } else if(N == aval) { - if(mark_aval == -1 || E == mark_aval) { - aval[0] = runtime.newString(""); - } else if(E > mark_aval) { - aval[0] = runtime.newString(new String(buf,mark_aval, E-mark_aval)); - } - } - } - - public void CAT(IRubyObject[] N, int E) { - if(N[0].isNil()) { - SET(N,E); - } else { - int mark = 0; - if(N == tag) { - mark = mark_tag; - } else if(N == akey) { - mark = mark_akey; - } else if(N == aval) { - mark = mark_aval; - } - ((RubyString)(N[0])).append(runtime.newString(new String(buf, mark, E-mark))); - } - } - - public void SLIDE(Object N) { - int mark = 0; - if(N == tag) { - mark = mark_tag; - } else if(N == akey) { - mark = mark_akey; - } else if(N == aval) { - mark = mark_aval; - } - if(mark > tokstart) { - if(N == tag) { - mark_tag -= tokstart; - } else if(N == akey) { - mark_akey -= tokstart; - } else if(N == aval) { - mark_aval -= tokstart; - } - } - } - - public void ATTR(IRubyObject K, IRubyObject V) { - if(!K.isNil()) { - if(attr.isNil()) { - attr = RubyHash.newHash(runtime); - } - ((RubyHash)attr).aset(K,V); - } - } - - public void ATTR(IRubyObject[] K, IRubyObject V) { - ATTR(K[0],V); - } - - public void ATTR(IRubyObject K, IRubyObject[] V) { - ATTR(K,V[0]); - } - - public void ATTR(IRubyObject[] K, IRubyObject[] V) { - ATTR(K[0],V[0]); - } - - public void TEXT_PASS() { - if(!text) { - if(ele_open) { - ele_open = false; - if(tokstart > -1) { - mark_tag = tokstart; - } - } else { - mark_tag = p; - } - attr = runtime.getNil(); - tag[0] = runtime.getNil(); - text = true; - } - } - - public void EBLK(IRubyObject N, int T) { - CAT(tag, p - T + 1); - ELE(N); - } - - - public void rb_raise(RubyClass error, String message) { - throw new RaiseException(runtime, error, message, true); - } - - public IRubyObject rb_str_new2(String s) { - return runtime.newString(s); - } - - - - -static final byte[] _hpricot_scan_actions = { - 0, 1, 1, 1, 2, 1, 4, 1, - 5, 1, 6, 1, 7, 1, 8, 1, - 9, 1, 10, 1, 11, 1, 12, 1, - 14, 1, 16, 1, 20, 1, 21, 1, - 22, 1, 24, 1, 25, 1, 26, 1, - 28, 1, 29, 1, 30, 1, 32, 1, - 33, 1, 38, 1, 39, 1, 40, 1, - 41, 1, 42, 1, 43, 1, 44, 1, - 45, 1, 46, 1, 47, 1, 48, 1, - 49, 1, 50, 2, 2, 5, 2, 2, - 6, 2, 2, 11, 2, 2, 12, 2, - 2, 14, 2, 4, 39, 2, 4, 40, - 2, 4, 41, 2, 5, 2, 2, 6, - 14, 2, 7, 6, 2, 7, 14, 2, - 11, 12, 2, 13, 3, 2, 14, 6, - 2, 14, 40, 2, 15, 24, 2, 15, - 28, 2, 15, 32, 2, 15, 45, 2, - 17, 23, 2, 18, 27, 2, 19, 31, - 2, 22, 34, 2, 22, 36, 3, 2, - 6, 14, 3, 2, 14, 6, 3, 6, - 7, 14, 3, 6, 14, 40, 3, 7, - 14, 40, 3, 14, 6, 40, 3, 14, - 13, 3, 3, 22, 0, 37, 3, 22, - 2, 34, 3, 22, 14, 35, 4, 2, - 14, 13, 3, 4, 6, 7, 14, 40, - 4, 22, 2, 14, 35, 4, 22, 6, - 14, 35, 4, 22, 7, 14, 35, 4, - 22, 14, 6, 35, 5, 22, 2, 6, - 14, 35, 5, 22, 2, 14, 6, 35, - 5, 22, 6, 7, 14, 35 -}; - -static final short[] _hpricot_scan_key_offsets = { - 0, 3, 4, 5, 6, 7, 8, 9, - 10, 13, 22, 37, 44, 45, 46, 47, - 48, 49, 52, 57, 69, 81, 86, 93, - 94, 95, 100, 101, 105, 106, 107, 121, - 135, 152, 169, 186, 203, 210, 212, 214, - 220, 222, 227, 232, 238, 240, 245, 251, - 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 282, 296, 300, 313, - 326, 340, 354, 355, 366, 375, 388, 405, - 423, 441, 450, 461, 480, 499, 510, 521, - 536, 538, 540, 556, 572, 575, 587, 599, - 619, 639, 658, 677, 697, 717, 728, 739, - 751, 763, 775, 791, 794, 809, 811, 813, - 829, 845, 848, 860, 871, 890, 910, 930, - 941, 952, 964, 984, 1004, 1016, 1036, 1057, - 1074, 1091, 1095, 1098, 1110, 1122, 1142, 1162, - 1182, 1194, 1206, 1226, 1242, 1258, 1270, 1291, - 1310, 1313, 1328, 1340, 1355, 1358, 1369, 1371, - 1373, 1384, 1391, 1404, 1418, 1432, 1445, 1446, - 1447, 1448, 1449, 1450, 1451, 1455, 1460, 1469, - 1479, 1484, 1491, 1492, 1493, 1494, 1495, 1496, - 1497, 1498, 1499, 1503, 1508, 1512, 1522, 1527, - 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, - 1541, 1542, 1546, 1551, 1553, 1554, 1555, 1560, - 1561, 1562, 1564, 1565, 1566, 1567, 1568, 1572, - 1582, 1591, 1601, 1602, 1603, 1605, 1614, 1615, - 1616, 1617, 1619, 1621, 1624, 1627, 1631, 1633, - 1634, 1636, 1637, 1640 -}; - -static final char[] _hpricot_scan_trans_keys = { - 45, 68, 91, 45, 79, 67, 84, 89, - 80, 69, 32, 9, 13, 32, 58, 95, - 9, 13, 65, 90, 97, 122, 32, 62, - 63, 91, 95, 9, 13, 45, 46, 48, - 58, 65, 90, 97, 122, 32, 62, 80, - 83, 91, 9, 13, 85, 66, 76, 73, - 67, 32, 9, 13, 32, 34, 39, 9, - 13, 9, 34, 61, 95, 32, 37, 39, - 59, 63, 90, 97, 122, 9, 34, 61, - 95, 32, 37, 39, 59, 63, 90, 97, - 122, 32, 62, 91, 9, 13, 32, 34, - 39, 62, 91, 9, 13, 34, 34, 32, - 62, 91, 9, 13, 93, 32, 62, 9, - 13, 39, 39, 9, 39, 61, 95, 32, - 33, 35, 37, 40, 59, 63, 90, 97, - 122, 9, 39, 61, 95, 32, 33, 35, - 37, 40, 59, 63, 90, 97, 122, 9, - 32, 33, 39, 62, 91, 95, 10, 13, - 35, 37, 40, 59, 61, 90, 97, 122, - 9, 32, 34, 39, 62, 91, 95, 10, - 13, 33, 37, 40, 59, 61, 90, 97, - 122, 9, 32, 33, 39, 62, 91, 95, - 10, 13, 35, 37, 40, 59, 61, 90, - 97, 122, 9, 32, 34, 39, 62, 91, - 95, 10, 13, 33, 37, 40, 59, 61, - 90, 97, 122, 32, 34, 39, 62, 91, - 9, 13, 34, 39, 34, 39, 32, 39, - 62, 91, 9, 13, 39, 93, 32, 62, - 93, 9, 13, 32, 39, 62, 9, 13, - 32, 34, 62, 91, 9, 13, 34, 93, - 32, 34, 62, 9, 13, 32, 39, 62, - 91, 9, 13, 9, 39, 61, 95, 32, - 33, 35, 37, 40, 59, 63, 90, 97, - 122, 89, 83, 84, 69, 77, 67, 68, - 65, 84, 65, 91, 58, 95, 65, 90, - 97, 122, 32, 62, 63, 95, 9, 13, - 45, 46, 48, 58, 65, 90, 97, 122, - 32, 62, 9, 13, 32, 47, 62, 63, - 95, 9, 13, 45, 58, 65, 90, 97, - 122, 32, 47, 62, 63, 95, 9, 13, - 45, 58, 65, 90, 97, 122, 32, 47, - 61, 62, 63, 95, 9, 13, 45, 58, - 65, 90, 97, 122, 32, 47, 61, 62, - 63, 95, 9, 13, 45, 58, 65, 90, - 97, 122, 62, 13, 32, 34, 39, 47, - 60, 62, 9, 10, 11, 12, 13, 32, - 47, 60, 62, 9, 10, 11, 12, 32, - 47, 62, 63, 95, 9, 13, 45, 58, - 65, 90, 97, 122, 13, 32, 47, 60, - 62, 63, 95, 9, 10, 11, 12, 45, - 58, 65, 90, 97, 122, 13, 32, 47, - 60, 61, 62, 63, 95, 9, 10, 11, - 12, 45, 58, 65, 90, 97, 122, 13, - 32, 47, 60, 61, 62, 63, 95, 9, - 10, 11, 12, 45, 58, 65, 90, 97, - 122, 13, 32, 47, 60, 62, 9, 10, - 11, 12, 13, 32, 34, 39, 47, 60, - 62, 9, 10, 11, 12, 13, 32, 34, - 39, 47, 60, 62, 63, 95, 9, 10, - 11, 12, 45, 58, 65, 90, 97, 122, - 13, 32, 34, 39, 47, 60, 62, 63, - 95, 9, 10, 11, 12, 45, 58, 65, - 90, 97, 122, 13, 32, 34, 47, 60, - 62, 92, 9, 10, 11, 12, 13, 32, - 34, 47, 60, 62, 92, 9, 10, 11, - 12, 32, 34, 47, 62, 63, 92, 95, - 9, 13, 45, 58, 65, 90, 97, 122, - 34, 92, 34, 92, 32, 34, 47, 61, - 62, 63, 92, 95, 9, 13, 45, 58, - 65, 90, 97, 122, 32, 34, 47, 61, - 62, 63, 92, 95, 9, 13, 45, 58, - 65, 90, 97, 122, 34, 62, 92, 13, - 32, 34, 39, 47, 60, 62, 92, 9, - 10, 11, 12, 13, 32, 34, 39, 47, - 60, 62, 92, 9, 10, 11, 12, 13, - 32, 34, 39, 47, 60, 62, 63, 92, - 95, 9, 10, 11, 12, 45, 58, 65, - 90, 97, 122, 13, 32, 34, 39, 47, - 60, 62, 63, 92, 95, 9, 10, 11, - 12, 45, 58, 65, 90, 97, 122, 13, - 32, 34, 47, 60, 62, 63, 92, 95, - 9, 10, 11, 12, 45, 58, 65, 90, - 97, 122, 13, 32, 34, 47, 60, 62, - 63, 92, 95, 9, 10, 11, 12, 45, - 58, 65, 90, 97, 122, 13, 32, 34, - 47, 60, 61, 62, 63, 92, 95, 9, - 10, 11, 12, 45, 58, 65, 90, 97, - 122, 13, 32, 34, 47, 60, 61, 62, - 63, 92, 95, 9, 10, 11, 12, 45, - 58, 65, 90, 97, 122, 13, 32, 34, - 47, 60, 62, 92, 9, 10, 11, 12, - 13, 32, 34, 47, 60, 62, 92, 9, - 10, 11, 12, 13, 32, 34, 39, 47, - 60, 62, 92, 9, 10, 11, 12, 13, - 32, 34, 39, 47, 60, 62, 92, 9, - 10, 11, 12, 13, 32, 34, 39, 47, - 60, 62, 92, 9, 10, 11, 12, 32, - 34, 39, 47, 62, 63, 92, 95, 9, - 13, 45, 58, 65, 90, 97, 122, 34, - 39, 92, 32, 39, 47, 62, 63, 92, - 95, 9, 13, 45, 58, 65, 90, 97, - 122, 39, 92, 39, 92, 32, 39, 47, - 61, 62, 63, 92, 95, 9, 13, 45, - 58, 65, 90, 97, 122, 32, 39, 47, - 61, 62, 63, 92, 95, 9, 13, 45, - 58, 65, 90, 97, 122, 39, 62, 92, - 13, 32, 34, 39, 47, 60, 62, 92, - 9, 10, 11, 12, 13, 32, 39, 47, - 60, 62, 92, 9, 10, 11, 12, 13, - 32, 39, 47, 60, 62, 63, 92, 95, - 9, 10, 11, 12, 45, 58, 65, 90, - 97, 122, 13, 32, 39, 47, 60, 61, - 62, 63, 92, 95, 9, 10, 11, 12, - 45, 58, 65, 90, 97, 122, 13, 32, - 39, 47, 60, 61, 62, 63, 92, 95, - 9, 10, 11, 12, 45, 58, 65, 90, - 97, 122, 13, 32, 39, 47, 60, 62, - 92, 9, 10, 11, 12, 13, 32, 39, - 47, 60, 62, 92, 9, 10, 11, 12, - 13, 32, 34, 39, 47, 60, 62, 92, - 9, 10, 11, 12, 13, 32, 34, 39, - 47, 60, 62, 63, 92, 95, 9, 10, - 11, 12, 45, 58, 65, 90, 97, 122, - 13, 32, 34, 39, 47, 60, 62, 63, - 92, 95, 9, 10, 11, 12, 45, 58, - 65, 90, 97, 122, 13, 32, 34, 39, - 47, 60, 62, 92, 9, 10, 11, 12, - 13, 32, 34, 39, 47, 60, 62, 63, - 92, 95, 9, 10, 11, 12, 45, 58, - 65, 90, 97, 122, 13, 32, 34, 39, - 47, 60, 61, 62, 63, 92, 95, 9, - 10, 11, 12, 45, 58, 65, 90, 97, - 122, 32, 34, 39, 47, 61, 62, 63, - 92, 95, 9, 13, 45, 58, 65, 90, - 97, 122, 32, 34, 39, 47, 61, 62, - 63, 92, 95, 9, 13, 45, 58, 65, - 90, 97, 122, 34, 39, 62, 92, 34, - 39, 92, 13, 32, 34, 39, 47, 60, - 62, 92, 9, 10, 11, 12, 13, 32, - 34, 39, 47, 60, 62, 92, 9, 10, - 11, 12, 13, 32, 34, 39, 47, 60, - 62, 63, 92, 95, 9, 10, 11, 12, - 45, 58, 65, 90, 97, 122, 13, 32, - 34, 39, 47, 60, 62, 63, 92, 95, - 9, 10, 11, 12, 45, 58, 65, 90, - 97, 122, 13, 32, 34, 39, 47, 60, - 62, 63, 92, 95, 9, 10, 11, 12, - 45, 58, 65, 90, 97, 122, 13, 32, - 34, 39, 47, 60, 62, 92, 9, 10, - 11, 12, 13, 32, 34, 39, 47, 60, - 62, 92, 9, 10, 11, 12, 13, 32, - 34, 39, 47, 60, 62, 63, 92, 95, - 9, 10, 11, 12, 45, 58, 65, 90, - 97, 122, 32, 34, 39, 47, 62, 63, - 92, 95, 9, 13, 45, 58, 65, 90, - 97, 122, 32, 34, 39, 47, 62, 63, - 92, 95, 9, 13, 45, 58, 65, 90, - 97, 122, 13, 32, 34, 39, 47, 60, - 62, 92, 9, 10, 11, 12, 13, 32, - 34, 39, 47, 60, 61, 62, 63, 92, - 95, 9, 10, 11, 12, 45, 58, 65, - 90, 97, 122, 13, 32, 39, 47, 60, - 62, 63, 92, 95, 9, 10, 11, 12, - 45, 58, 65, 90, 97, 122, 34, 39, - 92, 32, 39, 47, 62, 63, 92, 95, - 9, 13, 45, 58, 65, 90, 97, 122, - 13, 32, 34, 39, 47, 60, 62, 92, - 9, 10, 11, 12, 32, 34, 47, 62, - 63, 92, 95, 9, 13, 45, 58, 65, - 90, 97, 122, 34, 39, 92, 13, 32, - 39, 47, 60, 62, 92, 9, 10, 11, - 12, 34, 92, 39, 92, 13, 32, 34, - 39, 47, 60, 62, 9, 10, 11, 12, - 58, 95, 120, 65, 90, 97, 122, 32, - 63, 95, 9, 13, 45, 46, 48, 58, - 65, 90, 97, 122, 32, 63, 95, 109, - 9, 13, 45, 46, 48, 58, 65, 90, - 97, 122, 32, 63, 95, 108, 9, 13, - 45, 46, 48, 58, 65, 90, 97, 122, - 32, 63, 95, 9, 13, 45, 46, 48, - 58, 65, 90, 97, 122, 101, 114, 115, - 105, 111, 110, 32, 61, 9, 13, 32, - 34, 39, 9, 13, 95, 45, 46, 48, - 58, 65, 90, 97, 122, 34, 95, 45, - 46, 48, 58, 65, 90, 97, 122, 32, - 62, 63, 9, 13, 32, 62, 63, 101, - 115, 9, 13, 62, 110, 99, 111, 100, - 105, 110, 103, 32, 61, 9, 13, 32, - 34, 39, 9, 13, 65, 90, 97, 122, - 34, 95, 45, 46, 48, 57, 65, 90, - 97, 122, 32, 62, 63, 9, 13, 32, - 62, 63, 115, 9, 13, 116, 97, 110, - 100, 97, 108, 111, 110, 101, 32, 61, - 9, 13, 32, 34, 39, 9, 13, 110, - 121, 111, 34, 32, 62, 63, 9, 13, - 101, 115, 110, 121, 111, 39, 101, 115, - 65, 90, 97, 122, 39, 95, 45, 46, - 48, 57, 65, 90, 97, 122, 95, 45, - 46, 48, 58, 65, 90, 97, 122, 39, - 95, 45, 46, 48, 58, 65, 90, 97, - 122, 62, 62, 10, 60, 33, 47, 58, - 63, 95, 65, 90, 97, 122, 39, 93, - 34, 34, 92, 39, 92, 34, 39, 92, - 32, 9, 13, 32, 118, 9, 13, 10, - 45, 45, 10, 93, 93, 10, 62, 63, - 62, 0 -}; - -static final byte[] _hpricot_scan_single_lengths = { - 3, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 5, 5, 1, 1, 1, 1, - 1, 1, 3, 4, 4, 3, 5, 1, - 1, 3, 1, 2, 1, 1, 4, 4, - 7, 7, 7, 7, 5, 2, 2, 4, - 2, 3, 3, 4, 2, 3, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 4, 2, 5, 5, - 6, 6, 1, 7, 5, 5, 7, 8, - 8, 5, 7, 9, 9, 7, 7, 7, - 2, 2, 8, 8, 3, 8, 8, 10, - 10, 9, 9, 10, 10, 7, 7, 8, - 8, 8, 8, 3, 7, 2, 2, 8, - 8, 3, 8, 7, 9, 10, 10, 7, - 7, 8, 10, 10, 8, 10, 11, 9, - 9, 4, 3, 8, 8, 10, 10, 10, - 8, 8, 10, 8, 8, 8, 11, 9, - 3, 7, 8, 7, 3, 7, 2, 2, - 7, 3, 3, 4, 4, 3, 1, 1, - 1, 1, 1, 1, 2, 3, 1, 2, - 3, 5, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 3, 0, 2, 3, 4, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 3, 2, 1, 1, 3, 1, - 1, 2, 1, 1, 1, 1, 0, 2, - 1, 2, 1, 1, 2, 5, 1, 1, - 1, 2, 2, 3, 1, 2, 2, 1, - 2, 1, 3, 1 -}; - -static final byte[] _hpricot_scan_range_lengths = { - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 3, 5, 1, 0, 0, 0, 0, - 0, 1, 1, 4, 4, 1, 1, 0, - 0, 1, 0, 1, 0, 0, 5, 5, - 5, 5, 5, 5, 1, 0, 0, 1, - 0, 1, 1, 1, 0, 1, 1, 5, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 5, 1, 4, 4, - 4, 4, 0, 2, 2, 4, 5, 5, - 5, 2, 2, 5, 5, 2, 2, 4, - 0, 0, 4, 4, 0, 2, 2, 5, - 5, 5, 5, 5, 5, 2, 2, 2, - 2, 2, 4, 0, 4, 0, 0, 4, - 4, 0, 2, 2, 5, 5, 5, 2, - 2, 2, 5, 5, 2, 5, 5, 4, - 4, 0, 0, 2, 2, 5, 5, 5, - 2, 2, 5, 4, 4, 2, 5, 5, - 0, 4, 2, 4, 0, 2, 0, 0, - 2, 2, 5, 5, 5, 5, 0, 0, - 0, 0, 0, 0, 1, 1, 4, 4, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 2, 4, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 2, 4, - 4, 4, 0, 0, 0, 2, 0, 0, - 0, 0, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 0 -}; - -static final short[] _hpricot_scan_index_offsets = { - 0, 4, 6, 8, 10, 12, 14, 16, - 18, 21, 28, 39, 46, 48, 50, 52, - 54, 56, 59, 64, 73, 82, 87, 94, - 96, 98, 103, 105, 109, 111, 113, 123, - 133, 146, 159, 172, 185, 192, 195, 198, - 204, 207, 212, 217, 223, 226, 231, 237, - 247, 249, 251, 253, 255, 257, 259, 261, - 263, 265, 267, 269, 274, 284, 288, 298, - 308, 319, 330, 332, 342, 350, 360, 373, - 387, 401, 409, 419, 434, 449, 459, 469, - 481, 484, 487, 500, 513, 517, 528, 539, - 555, 571, 586, 601, 617, 633, 643, 653, - 664, 675, 686, 699, 703, 715, 718, 721, - 734, 747, 751, 762, 772, 787, 803, 819, - 829, 839, 850, 866, 882, 893, 909, 926, - 940, 954, 959, 963, 974, 985, 1001, 1017, - 1033, 1044, 1055, 1071, 1084, 1097, 1108, 1125, - 1140, 1144, 1156, 1167, 1179, 1183, 1193, 1196, - 1199, 1209, 1215, 1224, 1234, 1244, 1253, 1255, - 1257, 1259, 1261, 1263, 1265, 1269, 1274, 1280, - 1287, 1292, 1299, 1301, 1303, 1305, 1307, 1309, - 1311, 1313, 1315, 1319, 1324, 1327, 1334, 1339, - 1345, 1347, 1349, 1351, 1353, 1355, 1357, 1359, - 1361, 1363, 1367, 1372, 1375, 1377, 1379, 1384, - 1386, 1388, 1391, 1393, 1395, 1397, 1399, 1402, - 1409, 1415, 1422, 1424, 1426, 1429, 1437, 1439, - 1441, 1443, 1446, 1449, 1453, 1456, 1460, 1463, - 1465, 1468, 1470, 1474 -}; - -static final short[] _hpricot_scan_indicies = { - 335, 336, 337, 296, 356, 296, 349, 296, - 399, 296, 401, 296, 354, 296, 350, 296, - 400, 296, 308, 308, 296, 308, 309, 309, - 308, 309, 309, 296, 328, 330, 329, 331, - 329, 328, 329, 329, 329, 329, 296, 310, - 302, 311, 312, 0, 310, 296, 353, 296, - 342, 296, 347, 296, 346, 296, 343, 296, - 304, 304, 296, 304, 305, 306, 304, 296, - 321, 320, 321, 321, 321, 321, 321, 321, - 296, 319, 320, 319, 319, 319, 319, 319, - 319, 296, 298, 302, 0, 298, 296, 298, - 300, 307, 302, 0, 298, 296, 6, 222, - 6, 13, 358, 302, 0, 358, 69, 1, - 0, 1, 302, 1, 69, 6, 182, 6, - 5, 322, 323, 322, 322, 322, 322, 322, - 322, 322, 296, 299, 303, 299, 299, 299, - 299, 299, 299, 299, 296, 297, 297, 299, - 303, 302, 0, 299, 298, 299, 299, 299, - 299, 296, 297, 297, 300, 301, 302, 0, - 299, 298, 299, 299, 299, 299, 296, 186, - 186, 188, 42, 184, 185, 188, 187, 188, - 188, 188, 188, 182, 43, 43, 38, 44, - 40, 34, 41, 37, 41, 41, 41, 41, - 5, 37, 38, 39, 40, 34, 37, 5, - 63, 224, 223, 63, 64, 62, 371, 6, - 40, 34, 371, 5, 35, 36, 34, 26, - 27, 1, 26, 0, 36, 6, 40, 36, - 5, 60, 6, 61, 58, 60, 13, 35, - 59, 58, 59, 6, 61, 59, 13, 183, - 6, 184, 185, 183, 182, 41, 42, 41, - 41, 41, 41, 41, 41, 41, 5, 403, - 296, 351, 296, 352, 296, 345, 296, 348, - 296, 398, 296, 344, 296, 341, 296, 402, - 296, 397, 296, 355, 296, 338, 338, 338, - 338, 296, 332, 334, 333, 333, 332, 333, - 333, 333, 333, 296, 313, 314, 313, 296, - 324, 326, 327, 325, 325, 324, 325, 325, - 325, 296, 315, 317, 318, 316, 316, 315, - 316, 316, 316, 296, 364, 366, 367, 368, - 365, 365, 364, 365, 365, 365, 69, 359, - 361, 362, 162, 360, 360, 359, 360, 360, - 360, 69, 369, 69, 157, 157, 159, 160, - 161, 69, 162, 157, 158, 156, 66, 66, - 68, 69, 70, 66, 67, 65, 363, 361, - 162, 360, 360, 363, 360, 360, 360, 69, - 66, 66, 74, 69, 76, 73, 73, 66, - 67, 73, 73, 73, 65, 132, 132, 135, - 69, 136, 137, 134, 134, 132, 133, 134, - 134, 134, 65, 71, 71, 74, 69, 75, - 76, 73, 73, 71, 72, 73, 73, 73, - 65, 66, 66, 68, 69, 70, 66, 67, - 65, 226, 226, 228, 229, 230, 69, 70, - 226, 227, 156, 163, 163, 159, 160, 161, - 69, 162, 165, 165, 163, 164, 165, 165, - 165, 156, 226, 226, 228, 229, 231, 69, - 76, 165, 165, 226, 227, 165, 165, 165, - 156, 248, 248, 84, 246, 199, 250, 195, - 248, 249, 189, 92, 92, 84, 95, 7, - 96, 97, 92, 93, 91, 372, 3, 48, - 50, 47, 8, 47, 372, 47, 47, 47, - 7, 3, 8, 7, 11, 8, 7, 122, - 3, 124, 125, 126, 123, 8, 123, 122, - 123, 123, 123, 7, 46, 3, 48, 49, - 50, 47, 8, 47, 46, 47, 47, 47, - 7, 3, 45, 8, 7, 190, 190, 192, - 193, 194, 7, 50, 195, 190, 191, 189, - 196, 196, 192, 193, 194, 7, 50, 195, - 196, 197, 189, 196, 196, 192, 193, 194, - 7, 50, 198, 195, 198, 196, 197, 198, - 198, 198, 189, 242, 242, 244, 245, 247, - 7, 103, 198, 195, 198, 242, 243, 198, - 198, 198, 189, 248, 248, 84, 247, 199, - 251, 198, 195, 198, 248, 249, 198, 198, - 198, 189, 92, 92, 84, 101, 7, 103, - 100, 97, 100, 92, 93, 100, 100, 100, - 91, 144, 144, 84, 147, 7, 148, 149, - 146, 97, 146, 144, 145, 146, 146, 146, - 91, 98, 98, 84, 101, 7, 102, 103, - 100, 97, 100, 98, 99, 100, 100, 100, - 91, 92, 92, 84, 95, 7, 96, 97, - 92, 93, 91, 92, 92, 94, 95, 7, - 96, 97, 92, 93, 91, 242, 242, 244, - 245, 246, 7, 96, 195, 242, 243, 189, - 258, 258, 263, 94, 256, 215, 261, 211, - 258, 259, 205, 105, 105, 80, 94, 108, - 9, 109, 110, 105, 106, 104, 373, 10, - 11, 55, 57, 54, 12, 54, 373, 54, - 54, 54, 9, 10, 11, 12, 9, 370, - 3, 31, 33, 30, 4, 30, 370, 30, - 30, 30, 2, 3, 4, 2, 10, 4, - 2, 117, 3, 119, 120, 121, 118, 4, - 118, 117, 118, 118, 118, 2, 29, 3, - 31, 32, 33, 30, 4, 30, 29, 30, - 30, 30, 2, 3, 28, 4, 2, 167, - 167, 169, 170, 171, 2, 33, 172, 167, - 168, 166, 78, 78, 84, 81, 2, 82, - 83, 78, 79, 77, 78, 78, 84, 88, - 2, 90, 87, 83, 87, 78, 79, 87, - 87, 87, 77, 138, 138, 84, 141, 2, - 142, 143, 140, 83, 140, 138, 139, 140, - 140, 140, 77, 85, 85, 84, 88, 2, - 89, 90, 87, 83, 87, 85, 86, 87, - 87, 87, 77, 78, 78, 84, 81, 2, - 82, 83, 78, 79, 77, 78, 78, 80, - 81, 2, 82, 83, 78, 79, 77, 232, - 232, 234, 235, 236, 2, 82, 172, 232, - 233, 166, 173, 173, 169, 170, 171, 2, - 33, 175, 172, 175, 173, 174, 175, 175, - 175, 166, 232, 232, 234, 235, 237, 2, - 90, 175, 172, 175, 232, 233, 175, 175, - 175, 166, 258, 258, 80, 260, 256, 215, - 261, 211, 258, 259, 205, 105, 105, 80, - 94, 114, 9, 116, 113, 110, 113, 105, - 106, 113, 113, 113, 104, 150, 150, 80, - 94, 153, 9, 154, 155, 152, 110, 152, - 150, 151, 152, 152, 152, 104, 53, 10, - 11, 55, 56, 57, 54, 12, 54, 53, - 54, 54, 54, 9, 127, 10, 11, 129, - 130, 131, 128, 12, 128, 127, 128, 128, - 128, 9, 10, 11, 52, 12, 9, 51, - 51, 12, 9, 206, 206, 208, 209, 210, - 9, 57, 211, 206, 207, 205, 212, 212, - 208, 209, 210, 9, 57, 211, 212, 213, - 205, 212, 212, 208, 209, 210, 9, 57, - 214, 211, 214, 212, 213, 214, 214, 214, - 205, 252, 252, 254, 255, 257, 9, 116, - 214, 211, 214, 252, 253, 214, 214, 214, - 205, 258, 258, 80, 260, 257, 215, 262, - 214, 211, 214, 258, 259, 214, 214, 214, - 205, 105, 105, 80, 94, 108, 9, 109, - 110, 105, 106, 104, 105, 105, 107, 107, - 108, 9, 109, 110, 105, 106, 104, 258, - 258, 263, 94, 257, 215, 262, 214, 211, - 214, 258, 259, 214, 214, 214, 205, 218, - 10, 216, 220, 221, 219, 217, 219, 218, - 219, 219, 219, 215, 218, 225, 11, 220, - 221, 219, 217, 219, 218, 219, 219, 219, - 215, 252, 252, 254, 255, 256, 9, 109, - 211, 252, 253, 205, 111, 111, 80, 94, - 114, 9, 115, 116, 113, 110, 113, 111, - 112, 113, 113, 113, 104, 238, 238, 84, - 237, 176, 241, 175, 172, 175, 238, 239, - 175, 175, 175, 166, 10, 216, 217, 215, - 178, 3, 180, 181, 179, 177, 179, 178, - 179, 179, 179, 176, 173, 173, 169, 170, - 171, 2, 33, 172, 173, 174, 166, 201, - 3, 203, 204, 202, 200, 202, 201, 202, - 202, 202, 199, 225, 11, 217, 215, 238, - 238, 84, 236, 176, 240, 172, 238, 239, - 166, 3, 200, 199, 3, 177, 176, 163, - 163, 159, 160, 161, 69, 162, 163, 164, - 156, 339, 339, 340, 339, 339, 296, 15, - 357, 357, 15, 357, 357, 357, 357, 296, - 15, 357, 357, 408, 15, 357, 357, 357, - 357, 296, 15, 357, 357, 404, 15, 357, - 357, 357, 357, 296, 16, 357, 357, 16, - 357, 357, 357, 357, 296, 287, 264, 294, - 264, 396, 264, 387, 264, 393, 264, 268, - 264, 268, 265, 268, 264, 265, 266, 267, - 265, 264, 282, 282, 282, 282, 282, 264, - 275, 276, 276, 276, 276, 276, 264, 269, - 270, 271, 269, 264, 269, 270, 271, 272, - 273, 269, 264, 270, 264, 388, 264, 285, - 264, 394, 264, 385, 264, 289, 264, 390, - 264, 288, 264, 288, 374, 288, 264, 374, - 375, 376, 374, 264, 283, 283, 264, 277, - 278, 278, 278, 278, 278, 264, 274, 270, - 271, 274, 264, 274, 270, 271, 273, 274, - 264, 295, 264, 384, 264, 389, 264, 286, - 264, 284, 264, 290, 264, 395, 264, 391, - 264, 380, 264, 380, 377, 380, 264, 377, - 378, 379, 377, 264, 291, 292, 264, 293, - 264, 279, 264, 381, 270, 271, 381, 264, - 386, 264, 293, 264, 405, 406, 264, 392, - 264, 279, 264, 407, 264, 392, 264, 383, - 383, 264, 277, 281, 281, 281, 281, 281, - 264, 382, 382, 382, 382, 382, 264, 275, - 280, 280, 280, 280, 280, 264, 415, 414, - 422, 421, 24, 25, 23, 19, 20, 21, - 22, 21, 21, 21, 18, 6, 5, 1, - 0, 6, 13, 3, 8, 7, 3, 4, - 2, 10, 11, 12, 9, 15, 15, 14, - 16, 17, 16, 14, 412, 413, 411, 410, - 409, 419, 420, 418, 417, 416, 426, 424, - 427, 425, 424, 423, 0 -}; - -static final short[] _hpricot_scan_trans_targs_wi = { - 26, 27, 101, 69, 102, 29, 25, 80, - 81, 99, 100, 79, 122, 24, 204, 212, - 213, 150, 204, 0, 59, 62, 145, 204, - 204, 205, 41, 207, 210, 104, 103, 105, - 106, 210, 40, 41, 42, 36, 37, 46, - 206, 47, 32, 35, 34, 209, 83, 82, - 84, 85, 209, 98, 211, 119, 120, 121, - 123, 211, 44, 45, 43, 208, 38, 39, - 43, 68, 69, 70, 73, 204, 204, 65, - 72, 71, 73, 74, 204, 107, 100, 108, - 108, 111, 210, 112, 70, 104, 110, 109, - 111, 113, 210, 78, 79, 90, 90, 93, - 209, 94, 83, 92, 91, 93, 95, 209, - 97, 98, 117, 117, 128, 211, 129, 119, - 134, 118, 128, 133, 211, 104, 103, 105, - 106, 210, 83, 82, 84, 85, 209, 119, - 120, 121, 123, 211, 65, 72, 71, 73, - 74, 204, 104, 110, 109, 111, 113, 210, - 83, 92, 91, 93, 95, 209, 119, 134, - 118, 128, 133, 211, 68, 144, 74, 142, - 143, 73, 204, 75, 76, 71, 107, 138, - 113, 136, 137, 111, 112, 114, 115, 109, - 101, 102, 100, 103, 105, 210, 29, 39, - 206, 40, 35, 36, 47, 78, 86, 95, - 139, 140, 93, 94, 87, 88, 91, 80, - 81, 79, 82, 84, 209, 97, 124, 133, - 131, 132, 128, 129, 125, 126, 118, 99, - 79, 122, 98, 120, 121, 211, 24, 38, - 43, 100, 75, 76, 77, 141, 73, 73, - 114, 115, 116, 135, 111, 111, 100, 108, - 210, 210, 87, 88, 89, 96, 93, 93, - 79, 90, 209, 209, 125, 126, 127, 130, - 128, 128, 98, 117, 90, 211, 211, 108, - 204, 157, 158, 200, 156, 161, 204, 162, - 163, 176, 175, 160, 159, 174, 173, 190, - 201, 199, 159, 173, 181, 165, 180, 151, - 170, 168, 182, 188, 191, 189, 152, 177, - 204, 33, 22, 31, 23, 34, 204, 32, - 18, 19, 30, 28, 9, 10, 11, 12, - 48, 61, 204, 63, 64, 66, 204, 20, - 21, 20, 31, 32, 63, 62, 66, 204, - 11, 10, 204, 26, 61, 60, 204, 1, - 2, 53, 60, 146, 147, 56, 14, 17, - 55, 52, 16, 15, 21, 3, 7, 50, - 51, 13, 6, 204, 204, 146, 25, 65, - 64, 66, 67, 69, 65, 64, 66, 67, - 204, 204, 100, 39, 79, 98, 171, 172, - 198, 186, 187, 193, 185, 190, 201, 199, - 178, 167, 192, 154, 164, 179, 169, 184, - 195, 155, 166, 183, 153, 58, 54, 4, - 8, 5, 57, 49, 149, 194, 196, 197, - 148, 214, 202, 214, 214, 215, 214, 214, - 216, 203, 216, 216, 217, 216, 216, 218, - 218, 218, 218, 219 -}; - -static final short[] _hpricot_scan_trans_actions_wi = { - 0, 0, 0, 7, 0, 0, 21, 0, - 0, 0, 7, 7, 0, 0, 65, 0, - 31, 0, 67, 0, 0, 1, 0, 63, - 132, 178, 0, 144, 147, 0, 174, 23, - 0, 186, 0, 21, 0, 0, 0, 21, - 144, 0, 111, 0, 111, 147, 0, 174, - 23, 0, 186, 7, 147, 0, 174, 23, - 0, 186, 0, 0, 0, 144, 0, 21, - 21, 0, 9, 9, 102, 73, 162, 9, - 9, 174, 117, 0, 170, 0, 9, 9, - 7, 102, 205, 0, 7, 9, 9, 174, - 117, 0, 215, 0, 9, 9, 7, 102, - 205, 0, 9, 9, 174, 117, 0, 215, - 0, 9, 9, 7, 102, 205, 0, 9, - 9, 174, 117, 0, 215, 11, 0, 108, - 11, 210, 11, 0, 108, 11, 210, 11, - 0, 108, 11, 210, 105, 105, 0, 158, - 11, 195, 105, 105, 0, 158, 11, 232, - 105, 105, 0, 158, 11, 232, 105, 105, - 0, 158, 11, 232, 3, 3, 3, 0, - 0, 87, 120, 3, 3, 190, 3, 3, - 3, 0, 7, 87, 3, 3, 3, 190, - 3, 3, 3, 190, 87, 200, 3, 3, - 182, 3, 3, 3, 3, 3, 3, 3, - 7, 0, 87, 3, 3, 3, 190, 3, - 3, 3, 190, 87, 200, 3, 3, 3, - 7, 7, 87, 3, 3, 3, 190, 3, - 75, 3, 3, 190, 87, 200, 3, 3, - 84, 99, 78, 78, 0, 0, 150, 154, - 78, 78, 0, 7, 150, 154, 78, 78, - 220, 226, 78, 78, 7, 0, 150, 154, - 78, 78, 220, 226, 78, 78, 7, 7, - 150, 154, 78, 78, 75, 220, 226, 99, - 69, 0, 0, 0, 0, 0, 49, 0, - 0, 0, 0, 13, 0, 15, 0, 17, - 0, 0, 3, 3, 0, 0, 0, 0, - 0, 0, 0, 3, 3, 0, 0, 0, - 71, 0, 0, 0, 0, 19, 51, 19, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 55, 0, 114, 0, 53, 0, - 19, 3, 3, 81, 5, 0, 5, 93, - 5, 0, 90, 5, 5, 0, 96, 0, - 0, 0, 1, 25, 25, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 61, 59, 0, 0, 0, - 174, 23, 0, 0, 11, 0, 108, 11, - 166, 57, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 3, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 3, 0, - 0, 35, 0, 33, 123, 31, 37, 135, - 41, 0, 39, 126, 31, 43, 138, 47, - 141, 45, 129, 0 -}; - -static final short[] _hpricot_scan_to_state_actions = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 27, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 27, 0, - 27, 0, 27, 0 -}; - -static final short[] _hpricot_scan_from_state_actions = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 29, 0, - 29, 0, 29, 0 -}; - -static final int hpricot_scan_start = 204; - -static final int hpricot_scan_error = -1; - - -public final static int BUFSIZE=16384; - -private void rb_yield_tokens(IRubyObject sym, IRubyObject tag, IRubyObject attr, IRubyObject raw, boolean taint) { - IRubyObject ary; - if (sym == runtime.newSymbol("text")) { - raw = tag; - } - ary = runtime.newArray(new IRubyObject[]{sym, tag, attr, raw}); - if (taint) { - ary.setTaint(true); - tag.setTaint(true); - attr.setTaint(true); - raw.setTaint(true); - } - block.yield(runtime.getCurrentContext(), ary, null, null, false); -} - - -int cs, act, have = 0, nread = 0, curline = 1, p=-1; -boolean text = false; -int tokstart=-1, tokend; -char[] buf; -Ruby runtime; -IRubyObject attr, bufsize; -IRubyObject[] tag, akey, aval; -int mark_tag, mark_akey, mark_aval; -boolean done = false, ele_open = false; -int buffer_size = 0; -boolean taint = false; -Block block = null; - - -IRubyObject xmldecl, doctype, procins, stag, etag, emptytag, comment, - cdata, sym_text; - -IRubyObject hpricot_scan(IRubyObject recv, IRubyObject port) { - attr = bufsize = runtime.getNil(); - tag = new IRubyObject[]{runtime.getNil()}; - akey = new IRubyObject[]{runtime.getNil()}; - aval = new IRubyObject[]{runtime.getNil()}; - - RubyClass rb_eHpricotParseError = runtime.getModule("Hpricot").getClass("ParseError"); - - taint = port.isTaint(); - if ( !port.respondsTo("read")) { - if ( port.respondsTo("to_str")) { - port = port.callMethod(runtime.getCurrentContext(),"to_str"); - } else { - throw runtime.newArgumentError("bad Hpricot argument, String or IO only please."); - } - } - - buffer_size = BUFSIZE; - if (recv.getInstanceVariable("@buffer_size") != null) { - bufsize = recv.getInstanceVariable("@buffer_size"); - if (!bufsize.isNil()) { - buffer_size = RubyNumeric.fix2int(bufsize); - } - } - buf = new char[buffer_size]; - - - { - cs = hpricot_scan_start; - tokstart = -1; - tokend = -1; - act = 0; - } - - while( !done ) { - IRubyObject str; - p = have; - int pe; - int len, space = buffer_size - have; - - if ( space == 0 ) { - /* We've used up the entire buffer storing an already-parsed token - * prefix that must be preserved. Likely caused by super-long attributes. - * See ticket #13. */ - rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <" + tag.toString() + ">, starting on line "+curline+"."); - } - - if (port.respondsTo("read")) { - str = port.callMethod(runtime.getCurrentContext(),"read",runtime.newFixnum(space)); - } else { - str = ((RubyString)port).substr(nread,space); - } - - str = str.convertToString(); - String sss = str.toString(); - char[] chars = sss.toCharArray(); - System.arraycopy(chars,0,buf,p,chars.length); - - len = sss.length(); - nread += len; - - if ( len < space ) { - len++; - done = true; - } - - pe = p + len; - char[] data = buf; - - - { - int _klen; - int _trans; - int _acts; - int _nacts; - int _keys; - - if ( p != pe ) { - _resume: while ( true ) { - _again: do { - _acts = _hpricot_scan_from_state_actions[cs]; - _nacts = (int) _hpricot_scan_actions[_acts++]; - while ( _nacts-- > 0 ) { - switch ( _hpricot_scan_actions[_acts++] ) { - case 21: - {tokstart = p;} - break; - } - } - - _match: do { - _keys = _hpricot_scan_key_offsets[cs]; - _trans = _hpricot_scan_index_offsets[cs]; - _klen = _hpricot_scan_single_lengths[cs]; - if ( _klen > 0 ) { - int _lower = _keys; - int _mid; - int _upper = _keys + _klen - 1; - while (true) { - if ( _upper < _lower ) - break; - - _mid = _lower + ((_upper-_lower) >> 1); - if ( data[p] < _hpricot_scan_trans_keys[_mid] ) - _upper = _mid - 1; - else if ( data[p] > _hpricot_scan_trans_keys[_mid] ) - _lower = _mid + 1; - else { - _trans += (_mid - _keys); - break _match; - } - } - _keys += _klen; - _trans += _klen; - } - - _klen = _hpricot_scan_range_lengths[cs]; - if ( _klen > 0 ) { - int _lower = _keys; - int _mid; - int _upper = _keys + (_klen<<1) - 2; - while (true) { - if ( _upper < _lower ) - break; - - _mid = _lower + (((_upper-_lower) >> 1) & ~1); - if ( data[p] < _hpricot_scan_trans_keys[_mid] ) - _upper = _mid - 2; - else if ( data[p] > _hpricot_scan_trans_keys[_mid+1] ) - _lower = _mid + 2; - else { - _trans += ((_mid - _keys)>>1); - break _match; - } - } - _trans += _klen; - } - } while (false); - - _trans = _hpricot_scan_indicies[_trans]; - cs = _hpricot_scan_trans_targs_wi[_trans]; - - if ( _hpricot_scan_trans_actions_wi[_trans] == 0 ) - break _again; - - _acts = _hpricot_scan_trans_actions_wi[_trans]; - _nacts = (int) _hpricot_scan_actions[_acts++]; - while ( _nacts-- > 0 ) - { - switch ( _hpricot_scan_actions[_acts++] ) - { - case 0: - { - if (text) { - CAT(tag, p); - ELE(sym_text); - text = false; - } - attr = runtime.getNil(); - tag[0] = runtime.getNil(); - mark_tag = -1; - ele_open = true; - } - break; - case 1: - { mark_tag = p; } - break; - case 2: - { mark_aval = p; } - break; - case 3: - { mark_akey = p; } - break; - case 4: - { SET(tag, p); } - break; - case 5: - { SET(aval, p); } - break; - case 6: - { - if (buf[p-1] == '"' || buf[p-1] == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - break; - case 7: - { SET(akey, p); } - break; - case 8: - { SET(aval, p); ATTR(rb_str_new2("version"), aval); } - break; - case 9: - { SET(aval, p); ATTR(rb_str_new2("encoding"), aval); } - break; - case 10: - { SET(aval, p); ATTR(rb_str_new2("standalone"), aval); } - break; - case 11: - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - break; - case 12: - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - break; - case 13: - { - akey[0] = runtime.getNil(); - aval[0] = runtime.getNil(); - mark_akey = -1; - mark_aval = -1; - } - break; - case 14: - { - ATTR(akey, aval); - } - break; - case 15: - {curline += 1;} - break; - case 16: - { TEXT_PASS(); } - break; - case 17: - { EBLK(comment, 3); {cs = 204; if (true) break _again;} } - break; - case 18: - { EBLK(cdata, 3); {cs = 204; if (true) break _again;} } - break; - case 19: - { EBLK(procins, 2); {cs = 204; if (true) break _again;} } - break; - case 22: - {tokend = p+1;} - break; - case 23: - {tokend = p+1;{p = ((tokend))-1;}} - break; - case 24: - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 25: - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 26: - {{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 27: - {tokend = p+1;{p = ((tokend))-1;}} - break; - case 28: - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 29: - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 30: - {{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 31: - {tokend = p+1;{p = ((tokend))-1;}} - break; - case 32: - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 33: - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 34: - {act = 8;} - break; - case 35: - {act = 10;} - break; - case 36: - {act = 12;} - break; - case 37: - {act = 15;} - break; - case 38: - {tokend = p+1;{ ELE(xmldecl); }{p = ((tokend))-1;}} - break; - case 39: - {tokend = p+1;{ ELE(doctype); }{p = ((tokend))-1;}} - break; - case 40: - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - break; - case 41: - {tokend = p+1;{ ELE(etag); }{p = ((tokend))-1;}} - break; - case 42: - {tokend = p+1;{ ELE(emptytag); }{p = ((tokend))-1;}} - break; - case 43: - {tokend = p+1;{ {{p = ((tokend))-1;}{cs = 214; if (true) break _again;}} }{p = ((tokend))-1;}} - break; - case 44: - {tokend = p+1;{ {{p = ((tokend))-1;}{cs = 216; if (true) break _again;}} }{p = ((tokend))-1;}} - break; - case 45: - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 46: - {tokend = p;{ {{p = ((tokend))-1;}{cs = 218; if (true) break _again;}} }{p = ((tokend))-1;}} - break; - case 47: - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 48: - {{ {{p = ((tokend))-1;}{cs = 218; if (true) break _again;}} }{p = ((tokend))-1;}} - break; - case 49: - {{ TEXT_PASS(); }{p = ((tokend))-1;}} - break; - case 50: - { switch( act ) { - case 8: - { ELE(doctype); } - break; - case 10: - { ELE(stag); } - break; - case 12: - { ELE(emptytag); } - break; - case 15: - { TEXT_PASS(); } - break; - default: break; - } - {p = ((tokend))-1;}} - break; - } - } - - } while (false); - _acts = _hpricot_scan_to_state_actions[cs]; - _nacts = (int) _hpricot_scan_actions[_acts++]; - while ( _nacts-- > 0 ) { - switch ( _hpricot_scan_actions[_acts++] ) { - case 20: - {tokstart = -1;} - break; - } - } - - if ( ++p == pe ) - break _resume; - } - } - } - - if ( cs == hpricot_scan_error ) { - if(!tag[0].isNil()) { - rb_raise(rb_eHpricotParseError, "parse error on element <"+tag.toString()+">, starting on line "+curline+".\n" + NO_WAY_SERIOUSLY); - } else { - rb_raise(rb_eHpricotParseError, "parse error on line "+curline+".\n" + NO_WAY_SERIOUSLY); - } - } - - if ( done && ele_open ) { - ele_open = false; - if(tokstart > -1) { - mark_tag = tokstart; - tokstart = -1; - text = true; - } - } - - if(tokstart == -1) { - have = 0; - /* text nodes have no tokstart because each byte is parsed alone */ - if(mark_tag != -1 && text) { - if (done) { - if(mark_tag < p-1) { - CAT(tag, p-1); - ELE(sym_text); - } - } else { - CAT(tag, p); - } - } - mark_tag = 0; - } else { - have = pe - tokstart; - System.arraycopy(buf,tokstart,buf,0,have); - SLIDE(tag); - SLIDE(akey); - SLIDE(aval); - tokend = (tokend - tokstart); - tokstart = 0; - } - } - return runtime.getNil(); -} - -public static IRubyObject __hpricot_scan(IRubyObject recv, IRubyObject port, Block block) { - Ruby runtime = recv.getRuntime(); - HpricotScanService service = new HpricotScanService(); - service.runtime = runtime; - service.xmldecl = runtime.newSymbol("xmldecl"); - service.doctype = runtime.newSymbol("doctype"); - service.procins = runtime.newSymbol("procins"); - service.stag = runtime.newSymbol("stag"); - service.etag = runtime.newSymbol("etag"); - service.emptytag = runtime.newSymbol("emptytag"); - service.comment = runtime.newSymbol("comment"); - service.cdata = runtime.newSymbol("cdata"); - service.sym_text = runtime.newSymbol("text"); - service.block = block; - return service.hpricot_scan(recv, port); -} - - -public boolean basicLoad(final Ruby runtime) throws IOException { - Init_hpricot_scan(runtime); - return true; -} - -public static void Init_hpricot_scan(Ruby runtime) { - RubyModule mHpricot = runtime.defineModule("Hpricot"); - mHpricot.getMetaClass().attr_accessor(new IRubyObject[]{runtime.newSymbol("buffer_size")}); - CallbackFactory fact = runtime.callbackFactory(HpricotScanService.class); - mHpricot.getMetaClass().defineMethod("scan",fact.getSingletonMethod("__hpricot_scan",IRubyObject.class)); - mHpricot.defineClassUnder("ParseError",runtime.getClass("Exception"),runtime.getClass("Exception").getAllocator()); -} -} diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/extconf.rb b/vendor/gems/hpricot-0.6/ext/hpricot_scan/extconf.rb deleted file mode 100644 index c7542eb..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/extconf.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'mkmf' - -dir_config("hpricot_scan") -have_library("c", "main") - -create_makefile("hpricot_scan") diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_common.rl b/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_common.rl deleted file mode 100644 index 52d3764..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_common.rl +++ /dev/null @@ -1,76 +0,0 @@ -%%{ - - machine hpricot_common; - - # - # HTML tokens - # (a blatant rip from HTree) - # - newline = '\n' @{curline += 1;} ; - NameChar = [\-A-Za-z0-9._:?] ; - Name = [A-Za-z_:] NameChar* ; - StartComment = "" ; - StartCdata = "" ; - - NameCap = Name >_tag %tag; - NameAttr = NameChar+ >_akey %akey ; - Q1Char = ( "\\\'" | [^'] ) ; - Q1Attr = Q1Char* >_aval %aval ; - Q2Char = ( "\\\"" | [^"] ) ; - Q2Attr = Q2Char* >_aval %aval ; - UnqAttr = ( space >_aval | [^ \t\r\n<>"'] >_aval [^ \t\r\n<>]* %aunq ) ; - Nmtoken = NameChar+ >_akey %akey ; - - Attr = NameAttr space* "=" space* ('"' Q2Attr '"' | "'" Q1Attr "'" | UnqAttr space+ ) space* ; - AttrEnd = ( NameAttr space* "=" space* UnqAttr? | Nmtoken >new_attr %save_attr ) ; - AttrSet = ( Attr >new_attr %save_attr | Nmtoken >new_attr space+ %save_attr ) ; - StartTag = "<" NameCap space+ AttrSet* (AttrEnd >new_attr %save_attr)? ">" | "<" NameCap ">"; - EmptyTag = "<" NameCap space+ AttrSet* (AttrEnd >new_attr %save_attr)? "/>" | "<" NameCap "/>" ; - - EndTag = "" ; - XmlVersionNum = [a-zA-Z0-9_.:\-]+ >_aval %xmlver ; - XmlVersionInfo = space+ "version" space* "=" space* ("'" XmlVersionNum "'" | '"' XmlVersionNum '"' ) ; - XmlEncName = [A-Za-z] >_aval [A-Za-z0-9._\-]* %xmlenc ; - XmlEncodingDecl = space+ "encoding" space* "=" space* ("'" XmlEncName "'" | '"' XmlEncName '"' ) ; - XmlYesNo = ("yes" | "no") >_aval %xmlsd ; - XmlSDDecl = space+ "standalone" space* "=" space* ("'" XmlYesNo "'" | '"' XmlYesNo '"') ; - XmlDecl = "" ; - - SystemLiteral = '"' [^"]* >_aval %sysid '"' | "'" [^']* >_aval %sysid "'" ; - PubidLiteral = '"' [\t a-zA-Z0-9\-'()+,./:=?;!*\#@$_%]* >_aval %pubid '"' | - "'" [\t a-zA-Z0-9\-'()+,./:=?;!*\#@$_%]* >_aval %pubid "'" ; - ExternalID = ( "SYSTEM" | "PUBLIC" space+ PubidLiteral ) (space+ SystemLiteral)? ; - DocType = "" ; - StartXmlProcIns = "{ TEXT_PASS(); } space+ ; - EndXmlProcIns = "?"? ">" ; - - html_comment := |* - EndComment @{ EBLK(comment, 3); fgoto main; }; - any | newline { TEXT_PASS(); }; - *|; - - html_cdata := |* - EndCdata @{ EBLK(cdata, 3); fgoto main; }; - any | newline { TEXT_PASS(); }; - *|; - - html_procins := |* - EndXmlProcIns @{ EBLK(procins, 2); fgoto main; }; - any | newline { TEXT_PASS(); }; - *|; - - main := |* - XmlDecl >newEle { ELE(xmldecl); }; - DocType >newEle { ELE(doctype); }; - StartXmlProcIns >newEle { fgoto html_procins; }; - StartTag >newEle { ELE(stag); }; - EndTag >newEle { ELE(etag); }; - EmptyTag >newEle { ELE(emptytag); }; - StartComment >newEle { fgoto html_comment; }; - StartCdata >newEle { fgoto html_cdata; }; - any | newline { TEXT_PASS(); }; - *|; - -}%%; diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.c b/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.c deleted file mode 100644 index 15db082..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.c +++ /dev/null @@ -1,5976 +0,0 @@ -#line 1 "ext/hpricot_scan/hpricot_scan.rl" -/* - * hpricot_scan.rl - * - * $Author: why $ - * $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $ - * - * Copyright (C) 2006 why the lucky stiff - */ -#include - -#define NO_WAY_SERIOUSLY "*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!" - -static VALUE sym_xmldecl, sym_doctype, sym_procins, sym_stag, sym_etag, sym_emptytag, sym_comment, - sym_cdata, sym_text; -static VALUE rb_eHpricotParseError; -static ID s_read, s_to_str; - -#define ELE(N) \ - if (tokend > tokstart || text == 1) { \ - VALUE raw_string = Qnil; \ - ele_open = 0; text = 0; \ - if (tokstart != 0 && sym_##N != sym_cdata && sym_##N != sym_text && sym_##N != sym_procins && sym_##N != sym_comment) { \ - raw_string = rb_str_new(tokstart, tokend-tokstart); \ - } \ - rb_yield_tokens(sym_##N, tag, attr, raw_string, taint); \ - } - -#define SET(N, E) \ - if (mark_##N == NULL || E == mark_##N) \ - N = rb_str_new2(""); \ - else if (E > mark_##N) \ - N = rb_str_new(mark_##N, E - mark_##N); - -#define CAT(N, E) if (NIL_P(N)) { SET(N, E); } else { rb_str_cat(N, mark_##N, E - mark_##N); } - -#define SLIDE(N) if ( mark_##N > tokstart ) mark_##N = buf + (mark_##N - tokstart); - -#define ATTR(K, V) \ - if (!NIL_P(K)) { \ - if (NIL_P(attr)) attr = rb_hash_new(); \ - rb_hash_aset(attr, K, V); \ - } - -#define TEXT_PASS() \ - if (text == 0) \ - { \ - if (ele_open == 1) { \ - ele_open = 0; \ - if (tokstart > 0) { \ - mark_tag = tokstart; \ - } \ - } else { \ - mark_tag = p; \ - } \ - attr = Qnil; \ - tag = Qnil; \ - text = 1; \ - } - -#define EBLK(N, T) CAT(tag, p - T + 1); ELE(N); - -#line 107 "ext/hpricot_scan/hpricot_scan.rl" - - - -#line 68 "ext/hpricot_scan/hpricot_scan.c" -static const int hpricot_scan_start = 204; - -static const int hpricot_scan_error = -1; - -#line 110 "ext/hpricot_scan/hpricot_scan.rl" - -#define BUFSIZE 16384 - -void rb_yield_tokens(VALUE sym, VALUE tag, VALUE attr, VALUE raw, int taint) -{ - VALUE ary; - if (sym == sym_text) { - raw = tag; - } - ary = rb_ary_new3(4, sym, tag, attr, raw); - if (taint) { - OBJ_TAINT(ary); - OBJ_TAINT(tag); - OBJ_TAINT(attr); - OBJ_TAINT(raw); - } - rb_yield(ary); -} - -VALUE hpricot_scan(VALUE self, VALUE port) -{ - int cs, act, have = 0, nread = 0, curline = 1, text = 0; - char *tokstart = 0, *tokend = 0, *buf = NULL; - - VALUE attr = Qnil, tag = Qnil, akey = Qnil, aval = Qnil, bufsize = Qnil; - char *mark_tag = 0, *mark_akey = 0, *mark_aval = 0; - int done = 0, ele_open = 0, buffer_size = 0; - - int taint = OBJ_TAINTED( port ); - if ( !rb_respond_to( port, s_read ) ) - { - if ( rb_respond_to( port, s_to_str ) ) - { - port = rb_funcall( port, s_to_str, 0 ); - StringValue(port); - } - else - { - rb_raise( rb_eArgError, "bad Hpricot argument, String or IO only please." ); - } - } - - buffer_size = BUFSIZE; - if (rb_ivar_defined(self, rb_intern("@buffer_size")) == Qtrue) { - bufsize = rb_ivar_get(self, rb_intern("@buffer_size")); - if (!NIL_P(bufsize)) { - buffer_size = NUM2INT(bufsize); - } - } - buf = ALLOC_N(char, buffer_size); - - -#line 126 "ext/hpricot_scan/hpricot_scan.c" - { - cs = hpricot_scan_start; - tokstart = 0; - tokend = 0; - act = 0; - } -#line 162 "ext/hpricot_scan/hpricot_scan.rl" - - while ( !done ) { - VALUE str; - char *p = buf + have, *pe; - int len, space = buffer_size - have; - - if ( space == 0 ) { - /* We've used up the entire buffer storing an already-parsed token - * prefix that must be preserved. Likely caused by super-long attributes. - * See ticket #13. */ - rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <%s>, starting on line %d.", RSTRING(tag)->ptr, curline); - } - - if ( rb_respond_to( port, s_read ) ) - { - str = rb_funcall( port, s_read, 1, INT2FIX(space) ); - } - else - { - str = rb_str_substr( port, nread, space ); - } - - StringValue(str); - memcpy( p, RSTRING(str)->ptr, RSTRING(str)->len ); - len = RSTRING(str)->len; - nread += len; - - /* If this is the last buffer, tack on an EOF. */ - if ( len < space ) { - p[len++] = 0; - done = 1; - } - - pe = p + len; - -#line 169 "ext/hpricot_scan/hpricot_scan.c" - { - if ( p == pe ) - goto _out; - switch ( cs ) - { -tr14: -#line 67 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p;{ {{p = ((tokend))-1;}{goto st218;}} }{p = ((tokend))-1;}} - goto st204; -tr18: -#line 73 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st204; -tr23: -#line 73 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st204; -tr24: -#line 9 "ext/hpricot_scan/hpricot_scan.rl" - {curline += 1;} -#line 73 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st204; -tr69: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - { switch( act ) { - case 8: - { ELE(doctype); } - break; - case 10: - { ELE(stag); } - break; - case 12: - { ELE(emptytag); } - break; - case 15: - { TEXT_PASS(); } - break; - default: break; - } - {p = ((tokend))-1;}} - goto st204; -tr70: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr76: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr137: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr162: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr264: -#line 67 "ext/hpricot_scan/hpricot_scan.rl" - {{ {{p = ((tokend))-1;}{goto st218;}} }{p = ((tokend))-1;}} - goto st204; -tr270: -#line 65 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(xmldecl); }{p = ((tokend))-1;}} - goto st204; -tr296: -#line 73 "ext/hpricot_scan/hpricot_scan.rl" - {{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st204; -tr302: -#line 66 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(doctype); }{p = ((tokend))-1;}} - goto st204; -tr314: -#line 69 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(etag); }{p = ((tokend))-1;}} - goto st204; -tr318: -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr327: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr330: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } -#line 66 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(doctype); }{p = ((tokend))-1;}} - goto st204; -tr334: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } -#line 69 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(etag); }{p = ((tokend))-1;}} - goto st204; -tr355: -#line 72 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ {{p = ((tokend))-1;}{goto st216;}} }{p = ((tokend))-1;}} - goto st204; -tr356: -#line 71 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ {{p = ((tokend))-1;}{goto st214;}} }{p = ((tokend))-1;}} - goto st204; -tr368: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(stag); }{p = ((tokend))-1;}} - goto st204; -tr369: -#line 70 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ ELE(emptytag); }{p = ((tokend))-1;}} - goto st204; -st204: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = 0;} - if ( ++p == pe ) - goto _out204; -case 204: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = p;} -#line 333 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 10: goto tr24; - case 60: goto tr25; - } - goto tr23; -tr25: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 65 "ext/hpricot_scan/hpricot_scan.rl" - { - if (text == 1) { - CAT(tag, p); - ELE(text); - text = 0; - } - attr = Qnil; - tag = Qnil; - mark_tag = NULL; - ele_open = 1; - } -#line 73 "ext/hpricot_scan/hpricot_scan.rl" - {act = 15;} - goto st205; -st205: - if ( ++p == pe ) - goto _out205; -case 205: -#line 361 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 33: goto st0; - case 47: goto st59; - case 58: goto tr21; - case 63: goto st145; - case 95: goto tr21; - } - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr21; - } else if ( (*p) >= 65 ) - goto tr21; - goto tr18; -st0: - if ( ++p == pe ) - goto _out0; -case 0: - switch( (*p) ) { - case 45: goto st1; - case 68: goto st2; - case 91: goto st53; - } - goto tr296; -st1: - if ( ++p == pe ) - goto _out1; -case 1: - if ( (*p) == 45 ) - goto tr356; - goto tr296; -st2: - if ( ++p == pe ) - goto _out2; -case 2: - if ( (*p) == 79 ) - goto st3; - goto tr296; -st3: - if ( ++p == pe ) - goto _out3; -case 3: - if ( (*p) == 67 ) - goto st4; - goto tr296; -st4: - if ( ++p == pe ) - goto _out4; -case 4: - if ( (*p) == 84 ) - goto st5; - goto tr296; -st5: - if ( ++p == pe ) - goto _out5; -case 5: - if ( (*p) == 89 ) - goto st6; - goto tr296; -st6: - if ( ++p == pe ) - goto _out6; -case 6: - if ( (*p) == 80 ) - goto st7; - goto tr296; -st7: - if ( ++p == pe ) - goto _out7; -case 7: - if ( (*p) == 69 ) - goto st8; - goto tr296; -st8: - if ( ++p == pe ) - goto _out8; -case 8: - if ( (*p) == 32 ) - goto st9; - if ( 9 <= (*p) && (*p) <= 13 ) - goto st9; - goto tr296; -st9: - if ( ++p == pe ) - goto _out9; -case 9: - switch( (*p) ) { - case 32: goto st9; - case 58: goto tr309; - case 95: goto tr309; - } - if ( (*p) < 65 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st9; - } else if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr309; - } else - goto tr309; - goto tr296; -tr309: -#line 77 "ext/hpricot_scan/hpricot_scan.rl" - { mark_tag = p; } - goto st10; -st10: - if ( ++p == pe ) - goto _out10; -case 10: -#line 469 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr328; - case 62: goto tr330; - case 63: goto st10; - case 91: goto tr331; - case 95: goto st10; - } - if ( (*p) < 48 ) { - if ( (*p) > 13 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st10; - } else if ( (*p) >= 9 ) - goto tr328; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st10; - } else if ( (*p) >= 65 ) - goto st10; - } else - goto st10; - goto tr296; -tr328: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } - goto st11; -st11: - if ( ++p == pe ) - goto _out11; -case 11: -#line 500 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st11; - case 62: goto tr302; - case 80: goto st12; - case 83: goto st48; - case 91: goto st26; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st11; - goto tr296; -st12: - if ( ++p == pe ) - goto _out12; -case 12: - if ( (*p) == 85 ) - goto st13; - goto tr296; -st13: - if ( ++p == pe ) - goto _out13; -case 13: - if ( (*p) == 66 ) - goto st14; - goto tr296; -st14: - if ( ++p == pe ) - goto _out14; -case 14: - if ( (*p) == 76 ) - goto st15; - goto tr296; -st15: - if ( ++p == pe ) - goto _out15; -case 15: - if ( (*p) == 73 ) - goto st16; - goto tr296; -st16: - if ( ++p == pe ) - goto _out16; -case 16: - if ( (*p) == 67 ) - goto st17; - goto tr296; -st17: - if ( ++p == pe ) - goto _out17; -case 17: - if ( (*p) == 32 ) - goto st18; - if ( 9 <= (*p) && (*p) <= 13 ) - goto st18; - goto tr296; -st18: - if ( ++p == pe ) - goto _out18; -case 18: - switch( (*p) ) { - case 32: goto st18; - case 34: goto st19; - case 39: goto st30; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st18; - goto tr296; -st19: - if ( ++p == pe ) - goto _out19; -case 19: - switch( (*p) ) { - case 9: goto tr321; - case 34: goto tr320; - case 61: goto tr321; - case 95: goto tr321; - } - if ( (*p) < 39 ) { - if ( 32 <= (*p) && (*p) <= 37 ) - goto tr321; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr321; - } else if ( (*p) >= 63 ) - goto tr321; - } else - goto tr321; - goto tr296; -tr321: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st20; -st20: - if ( ++p == pe ) - goto _out20; -case 20: -#line 597 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 9: goto st20; - case 34: goto tr320; - case 61: goto st20; - case 95: goto st20; - } - if ( (*p) < 39 ) { - if ( 32 <= (*p) && (*p) <= 37 ) - goto st20; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st20; - } else if ( (*p) >= 63 ) - goto st20; - } else - goto st20; - goto tr296; -tr320: -#line 91 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - goto st21; -st21: - if ( ++p == pe ) - goto _out21; -case 21: -#line 624 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st22; - case 62: goto tr302; - case 91: goto st26; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st22; - goto tr296; -st22: - if ( ++p == pe ) - goto _out22; -case 22: - switch( (*p) ) { - case 32: goto st22; - case 34: goto st23; - case 39: goto st28; - case 62: goto tr302; - case 91: goto st26; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st22; - goto tr296; -st23: - if ( ++p == pe ) - goto _out23; -case 23: - if ( (*p) == 34 ) - goto tr6; - goto tr222; -tr222: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st24; -st24: - if ( ++p == pe ) - goto _out24; -case 24: -#line 662 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 34 ) - goto tr6; - goto st24; -tr6: -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st25; -st25: - if ( ++p == pe ) - goto _out25; -case 25: -#line 674 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st25; - case 62: goto tr302; - case 91: goto st26; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st25; - goto tr69; -tr331: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } - goto st26; -st26: - if ( ++p == pe ) - goto _out26; -case 26: -#line 691 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 93 ) - goto st27; - goto st26; -st27: - if ( ++p == pe ) - goto _out27; -case 27: - switch( (*p) ) { - case 32: goto st27; - case 62: goto tr302; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st27; - goto tr69; -st28: - if ( ++p == pe ) - goto _out28; -case 28: - if ( (*p) == 39 ) - goto tr6; - goto tr182; -tr182: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st29; -st29: - if ( ++p == pe ) - goto _out29; -case 29: -#line 721 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 39 ) - goto tr6; - goto st29; -st30: - if ( ++p == pe ) - goto _out30; -case 30: - switch( (*p) ) { - case 9: goto tr322; - case 39: goto tr323; - case 61: goto tr322; - case 95: goto tr322; - } - if ( (*p) < 40 ) { - if ( (*p) > 33 ) { - if ( 35 <= (*p) && (*p) <= 37 ) - goto tr322; - } else if ( (*p) >= 32 ) - goto tr322; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr322; - } else if ( (*p) >= 63 ) - goto tr322; - } else - goto tr322; - goto tr296; -tr322: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st31; -st31: - if ( ++p == pe ) - goto _out31; -case 31: -#line 758 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 9: goto st31; - case 39: goto tr303; - case 61: goto st31; - case 95: goto st31; - } - if ( (*p) < 40 ) { - if ( (*p) > 33 ) { - if ( 35 <= (*p) && (*p) <= 37 ) - goto st31; - } else if ( (*p) >= 32 ) - goto st31; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st31; - } else if ( (*p) >= 63 ) - goto st31; - } else - goto st31; - goto tr296; -tr42: -#line 91 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st32; -tr303: -#line 91 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - goto st32; -tr323: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 91 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - goto st32; -st32: - if ( ++p == pe ) - goto _out32; -case 32: -#line 800 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 9: goto st33; - case 32: goto st33; - case 33: goto st31; - case 39: goto tr303; - case 62: goto tr302; - case 91: goto st26; - case 95: goto st31; - } - if ( (*p) < 40 ) { - if ( (*p) > 13 ) { - if ( 35 <= (*p) && (*p) <= 37 ) - goto st31; - } else if ( (*p) >= 10 ) - goto st22; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st31; - } else if ( (*p) >= 61 ) - goto st31; - } else - goto st31; - goto tr296; -st33: - if ( ++p == pe ) - goto _out33; -case 33: - switch( (*p) ) { - case 9: goto st33; - case 32: goto st33; - case 34: goto st23; - case 39: goto tr301; - case 62: goto tr302; - case 91: goto st26; - case 95: goto st31; - } - if ( (*p) < 40 ) { - if ( (*p) > 13 ) { - if ( 33 <= (*p) && (*p) <= 37 ) - goto st31; - } else if ( (*p) >= 10 ) - goto st22; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st31; - } else if ( (*p) >= 61 ) - goto st31; - } else - goto st31; - goto tr296; -tr44: -#line 91 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st34; -tr301: -#line 91 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - goto st34; -st34: - if ( ++p == pe ) - goto _out34; -case 34: -#line 867 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 9: goto tr186; - case 32: goto tr186; - case 33: goto tr188; - case 39: goto tr42; - case 62: goto tr184; - case 91: goto tr185; - case 95: goto tr188; - } - if ( (*p) < 40 ) { - if ( (*p) > 13 ) { - if ( 35 <= (*p) && (*p) <= 37 ) - goto tr188; - } else if ( (*p) >= 10 ) - goto tr187; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr188; - } else if ( (*p) >= 61 ) - goto tr188; - } else - goto tr188; - goto tr182; -tr186: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st35; -st35: - if ( ++p == pe ) - goto _out35; -case 35: -#line 900 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 9: goto st35; - case 32: goto st35; - case 34: goto st37; - case 39: goto tr44; - case 62: goto tr40; - case 91: goto st40; - case 95: goto st47; - } - if ( (*p) < 40 ) { - if ( (*p) > 13 ) { - if ( 33 <= (*p) && (*p) <= 37 ) - goto st47; - } else if ( (*p) >= 10 ) - goto st36; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st47; - } else if ( (*p) >= 61 ) - goto st47; - } else - goto st47; - goto st29; -tr187: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st36; -st36: - if ( ++p == pe ) - goto _out36; -case 36: -#line 933 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st36; - case 34: goto st37; - case 39: goto tr39; - case 62: goto tr40; - case 91: goto st40; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st36; - goto st29; -st37: - if ( ++p == pe ) - goto _out37; -case 37: - switch( (*p) ) { - case 34: goto tr63; - case 39: goto tr224; - } - goto tr223; -tr223: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st38; -st38: - if ( ++p == pe ) - goto _out38; -case 38: -#line 961 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr63; - case 39: goto tr64; - } - goto st38; -tr63: -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st39; -tr183: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st39; -st39: - if ( ++p == pe ) - goto _out39; -case 39: -#line 979 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st39; - case 39: goto tr6; - case 62: goto tr40; - case 91: goto st40; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st39; - goto st29; -tr40: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 66 "ext/hpricot_scan/hpricot_scan.rl" - {act = 8;} - goto st206; -tr184: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 66 "ext/hpricot_scan/hpricot_scan.rl" - {act = 8;} - goto st206; -st206: - if ( ++p == pe ) - goto _out206; -case 206: -#line 1007 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 39 ) - goto tr6; - goto st29; -tr185: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st40; -st40: - if ( ++p == pe ) - goto _out40; -case 40: -#line 1019 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr35; - case 93: goto st42; - } - goto st40; -tr35: -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st41; -st41: - if ( ++p == pe ) - goto _out41; -case 41: -#line 1033 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st41; - case 62: goto tr27; - case 93: goto st27; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st41; - goto st26; -tr27: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 66 "ext/hpricot_scan/hpricot_scan.rl" - {act = 8;} - goto st207; -st207: - if ( ++p == pe ) - goto _out207; -case 207: -#line 1052 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 93 ) - goto st27; - goto st26; -st42: - if ( ++p == pe ) - goto _out42; -case 42: - switch( (*p) ) { - case 32: goto st42; - case 39: goto tr6; - case 62: goto tr40; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st42; - goto st29; -tr64: -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st43; -tr224: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st43; -st43: - if ( ++p == pe ) - goto _out43; -case 43: -#line 1082 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st43; - case 34: goto tr6; - case 62: goto tr61; - case 91: goto st44; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st43; - goto st24; -tr61: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 66 "ext/hpricot_scan/hpricot_scan.rl" - {act = 8;} - goto st208; -st208: - if ( ++p == pe ) - goto _out208; -case 208: -#line 1102 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 34 ) - goto tr6; - goto st24; -st44: - if ( ++p == pe ) - goto _out44; -case 44: - switch( (*p) ) { - case 34: goto tr35; - case 93: goto st45; - } - goto st44; -st45: - if ( ++p == pe ) - goto _out45; -case 45: - switch( (*p) ) { - case 32: goto st45; - case 34: goto tr6; - case 62: goto tr61; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st45; - goto st24; -tr39: -#line 92 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - goto st46; -st46: - if ( ++p == pe ) - goto _out46; -case 46: -#line 1135 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr183; - case 39: goto tr6; - case 62: goto tr184; - case 91: goto tr185; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr183; - goto tr182; -tr188: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st47; -st47: - if ( ++p == pe ) - goto _out47; -case 47: -#line 1153 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 9: goto st47; - case 39: goto tr42; - case 61: goto st47; - case 95: goto st47; - } - if ( (*p) < 40 ) { - if ( (*p) > 33 ) { - if ( 35 <= (*p) && (*p) <= 37 ) - goto st47; - } else if ( (*p) >= 32 ) - goto st47; - } else if ( (*p) > 59 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st47; - } else if ( (*p) >= 63 ) - goto st47; - } else - goto st47; - goto st29; -st48: - if ( ++p == pe ) - goto _out48; -case 48: - if ( (*p) == 89 ) - goto st49; - goto tr296; -st49: - if ( ++p == pe ) - goto _out49; -case 49: - if ( (*p) == 83 ) - goto st50; - goto tr296; -st50: - if ( ++p == pe ) - goto _out50; -case 50: - if ( (*p) == 84 ) - goto st51; - goto tr296; -st51: - if ( ++p == pe ) - goto _out51; -case 51: - if ( (*p) == 69 ) - goto st52; - goto tr296; -st52: - if ( ++p == pe ) - goto _out52; -case 52: - if ( (*p) == 77 ) - goto st21; - goto tr296; -st53: - if ( ++p == pe ) - goto _out53; -case 53: - if ( (*p) == 67 ) - goto st54; - goto tr296; -st54: - if ( ++p == pe ) - goto _out54; -case 54: - if ( (*p) == 68 ) - goto st55; - goto tr296; -st55: - if ( ++p == pe ) - goto _out55; -case 55: - if ( (*p) == 65 ) - goto st56; - goto tr296; -st56: - if ( ++p == pe ) - goto _out56; -case 56: - if ( (*p) == 84 ) - goto st57; - goto tr296; -st57: - if ( ++p == pe ) - goto _out57; -case 57: - if ( (*p) == 65 ) - goto st58; - goto tr296; -st58: - if ( ++p == pe ) - goto _out58; -case 58: - if ( (*p) == 91 ) - goto tr355; - goto tr296; -st59: - if ( ++p == pe ) - goto _out59; -case 59: - switch( (*p) ) { - case 58: goto tr338; - case 95: goto tr338; - } - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr338; - } else if ( (*p) >= 65 ) - goto tr338; - goto tr296; -tr338: -#line 77 "ext/hpricot_scan/hpricot_scan.rl" - { mark_tag = p; } - goto st60; -st60: - if ( ++p == pe ) - goto _out60; -case 60: -#line 1274 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr332; - case 62: goto tr334; - case 63: goto st60; - case 95: goto st60; - } - if ( (*p) < 48 ) { - if ( (*p) > 13 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st60; - } else if ( (*p) >= 9 ) - goto tr332; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st60; - } else if ( (*p) >= 65 ) - goto st60; - } else - goto st60; - goto tr296; -tr332: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } - goto st61; -st61: - if ( ++p == pe ) - goto _out61; -case 61: -#line 1304 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st61; - case 62: goto tr314; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st61; - goto tr296; -tr21: -#line 77 "ext/hpricot_scan/hpricot_scan.rl" - { mark_tag = p; } - goto st62; -st62: - if ( ++p == pe ) - goto _out62; -case 62: -#line 1320 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr324; - case 47: goto tr326; - case 62: goto tr327; - case 63: goto st62; - case 95: goto st62; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr324; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st62; - } else if ( (*p) >= 65 ) - goto st62; - } else - goto st62; - goto tr296; -tr324: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } - goto st63; -st63: - if ( ++p == pe ) - goto _out63; -case 63: -#line 1348 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st63; - case 47: goto st66; - case 62: goto tr318; - case 63: goto tr316; - case 95: goto tr316; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st63; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr316; - } else if ( (*p) >= 65 ) - goto tr316; - } else - goto tr316; - goto tr296; -tr360: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st64; -tr316: -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st64; -st64: - if ( ++p == pe ) - goto _out64; -case 64: -#line 1398 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr364; - case 47: goto tr366; - case 61: goto tr367; - case 62: goto tr368; - case 63: goto st64; - case 95: goto st64; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr364; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st64; - } else if ( (*p) >= 65 ) - goto st64; - } else - goto st64; - goto tr69; -tr71: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st65; -tr364: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st65; -tr132: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st65; -st65: - if ( ++p == pe ) - goto _out65; -case 65: -#line 1443 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st65; - case 47: goto tr361; - case 61: goto st67; - case 62: goto tr162; - case 63: goto tr360; - case 95: goto tr360; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st65; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr360; - } else if ( (*p) >= 65 ) - goto tr360; - } else - goto tr360; - goto tr69; -tr361: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st66; -tr366: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st66; -tr326: -#line 80 "ext/hpricot_scan/hpricot_scan.rl" - { SET(tag, p); } - goto st66; -st66: - if ( ++p == pe ) - goto _out66; -case 66: -#line 1486 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 62 ) - goto tr369; - goto tr69; -tr367: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st67; -st67: - if ( ++p == pe ) - goto _out67; -case 67: -#line 1498 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr157; - case 32: goto tr157; - case 34: goto st142; - case 39: goto st143; - case 47: goto tr161; - case 60: goto tr69; - case 62: goto tr162; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr158; - } else if ( (*p) >= 9 ) - goto tr157; - goto tr156; -tr156: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st68; -st68: - if ( ++p == pe ) - goto _out68; -case 68: -#line 1522 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr66; - case 32: goto tr66; - case 47: goto tr68; - case 60: goto tr69; - case 62: goto tr70; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr67; - } else if ( (*p) >= 9 ) - goto tr66; - goto st68; -tr3: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st69; -tr66: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st69; -st69: - if ( ++p == pe ) - goto _out69; -case 69: -#line 1551 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st69; - case 47: goto tr361; - case 62: goto tr162; - case 63: goto tr360; - case 95: goto tr360; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st69; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr360; - } else if ( (*p) >= 65 ) - goto tr360; - } else - goto tr360; - goto tr69; -tr84: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st70; -tr67: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st70; -st70: - if ( ++p == pe ) - goto _out70; -case 70: -#line 1586 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr66; - case 32: goto tr66; - case 47: goto tr74; - case 60: goto tr69; - case 62: goto tr76; - case 63: goto tr73; - case 95: goto tr73; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr67; - } else if ( (*p) >= 9 ) - goto tr66; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr73; - } else if ( (*p) >= 65 ) - goto tr73; - } else - goto tr73; - goto st68; -tr73: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st71; -tr165: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st71; -st71: - if ( ++p == pe ) - goto _out71; -case 71: -#line 1647 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr132; - case 32: goto tr132; - case 47: goto tr135; - case 60: goto tr69; - case 61: goto tr136; - case 62: goto tr137; - case 63: goto st71; - case 95: goto st71; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr133; - } else if ( (*p) >= 9 ) - goto tr132; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st71; - } else if ( (*p) >= 65 ) - goto st71; - } else - goto st71; - goto st68; -tr72: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st72; -tr133: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st72; -st72: - if ( ++p == pe ) - goto _out72; -case 72: -#line 1693 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr71; - case 32: goto tr71; - case 47: goto tr74; - case 60: goto tr69; - case 61: goto st74; - case 62: goto tr76; - case 63: goto tr73; - case 95: goto tr73; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr72; - } else if ( (*p) >= 9 ) - goto tr71; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr73; - } else if ( (*p) >= 65 ) - goto tr73; - } else - goto tr73; - goto st68; -tr68: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st73; -tr74: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st73; -tr135: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st73; -tr161: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st73; -tr230: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st73; -tr231: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st73; -st73: - if ( ++p == pe ) - goto _out73; -case 73: -#line 1792 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr66; - case 32: goto tr66; - case 47: goto tr68; - case 60: goto tr69; - case 62: goto tr70; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr67; - } else if ( (*p) >= 9 ) - goto tr66; - goto st68; -tr136: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st74; -tr158: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st74; -st74: - if ( ++p == pe ) - goto _out74; -case 74: -#line 1818 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr226; - case 32: goto tr226; - case 34: goto st77; - case 39: goto st141; - case 47: goto tr230; - case 60: goto tr69; - case 62: goto tr70; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr227; - } else if ( (*p) >= 9 ) - goto tr226; - goto tr156; -tr163: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st75; -tr226: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st75; -st75: - if ( ++p == pe ) - goto _out75; -case 75: -#line 1851 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr163; - case 32: goto tr163; - case 34: goto st142; - case 39: goto st143; - case 47: goto tr161; - case 60: goto tr69; - case 62: goto tr162; - case 63: goto tr165; - case 95: goto tr165; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr164; - } else if ( (*p) >= 9 ) - goto tr163; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr165; - } else if ( (*p) >= 65 ) - goto tr165; - } else - goto tr165; - goto tr156; -tr164: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st76; -tr227: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st76; -st76: - if ( ++p == pe ) - goto _out76; -case 76: -#line 1895 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr226; - case 32: goto tr226; - case 34: goto st77; - case 39: goto st141; - case 47: goto tr231; - case 60: goto tr69; - case 62: goto tr76; - case 63: goto tr165; - case 95: goto tr165; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr227; - } else if ( (*p) >= 9 ) - goto tr226; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr165; - } else if ( (*p) >= 65 ) - goto tr165; - } else - goto tr165; - goto tr156; -st77: - if ( ++p == pe ) - goto _out77; -case 77: - switch( (*p) ) { - case 13: goto tr248; - case 32: goto tr248; - case 34: goto tr84; - case 47: goto tr246; - case 60: goto tr199; - case 62: goto tr250; - case 92: goto tr195; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr249; - } else if ( (*p) >= 9 ) - goto tr248; - goto tr189; -tr189: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st78; -st78: - if ( ++p == pe ) - goto _out78; -case 78: -#line 1949 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr92; - case 32: goto tr92; - case 34: goto tr84; - case 47: goto tr95; - case 60: goto st80; - case 62: goto tr96; - case 92: goto st94; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr93; - } else if ( (*p) >= 9 ) - goto tr92; - goto st78; -tr11: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st79; -tr92: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st79; -tr201: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st79; -tr216: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st79; -tr248: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st79; -st79: - if ( ++p == pe ) - goto _out79; -case 79: -#line 1999 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st79; - case 34: goto tr3; - case 47: goto tr48; - case 62: goto tr50; - case 63: goto tr47; - case 92: goto st81; - case 95: goto tr47; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st79; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr47; - } else if ( (*p) >= 65 ) - goto tr47; - } else - goto tr47; - goto st80; -tr199: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st80; -st80: - if ( ++p == pe ) - goto _out80; -case 80: -#line 2029 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr3; - case 92: goto st81; - } - goto st80; -tr200: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st81; -st81: - if ( ++p == pe ) - goto _out81; -case 81: -#line 2043 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr11; - case 92: goto st81; - } - goto st80; -tr47: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st82; -tr202: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st82; -st82: - if ( ++p == pe ) - goto _out82; -case 82: -#line 2085 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr122; - case 34: goto tr3; - case 47: goto tr124; - case 61: goto tr125; - case 62: goto tr126; - case 63: goto st82; - case 92: goto st81; - case 95: goto st82; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr122; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st82; - } else if ( (*p) >= 65 ) - goto st82; - } else - goto st82; - goto st80; -tr98: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st83; -tr122: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st83; -tr144: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st83; -st83: - if ( ++p == pe ) - goto _out83; -case 83: -#line 2132 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st83; - case 34: goto tr3; - case 47: goto tr48; - case 61: goto st85; - case 62: goto tr50; - case 63: goto tr47; - case 92: goto st81; - case 95: goto tr47; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st83; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr47; - } else if ( (*p) >= 65 ) - goto tr47; - } else - goto tr47; - goto st80; -tr48: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st84; -tr124: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st84; -tr203: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st84; -st84: - if ( ++p == pe ) - goto _out84; -case 84: -#line 2181 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr3; - case 62: goto tr45; - case 92: goto st81; - } - goto st80; -tr45: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 70 "ext/hpricot_scan/hpricot_scan.rl" - {act = 12;} - goto st209; -tr50: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr96: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr103: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr126: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr149: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr204: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr250: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -tr251: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st209; -st209: - if ( ++p == pe ) - goto _out209; -case 209: -#line 2313 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr3; - case 92: goto st81; - } - goto st80; -tr125: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st85; -st85: - if ( ++p == pe ) - goto _out85; -case 85: -#line 2327 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr190; - case 32: goto tr190; - case 34: goto tr192; - case 39: goto st140; - case 47: goto tr194; - case 60: goto st80; - case 62: goto tr50; - case 92: goto tr195; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr191; - } else if ( (*p) >= 9 ) - goto tr190; - goto tr189; -tr190: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st86; -st86: - if ( ++p == pe ) - goto _out86; -case 86: -#line 2352 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr196; - case 32: goto tr196; - case 34: goto tr192; - case 39: goto st140; - case 47: goto tr194; - case 60: goto st80; - case 62: goto tr50; - case 92: goto tr195; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr197; - } else if ( (*p) >= 9 ) - goto tr196; - goto tr189; -tr196: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st87; -tr242: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st87; -st87: - if ( ++p == pe ) - goto _out87; -case 87: -#line 2386 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr196; - case 32: goto tr196; - case 34: goto tr192; - case 39: goto st140; - case 47: goto tr194; - case 60: goto st80; - case 62: goto tr50; - case 63: goto tr198; - case 92: goto tr195; - case 95: goto tr198; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr197; - } else if ( (*p) >= 9 ) - goto tr196; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr198; - } else if ( (*p) >= 65 ) - goto tr198; - } else - goto tr198; - goto tr189; -tr197: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st88; -tr243: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st88; -st88: - if ( ++p == pe ) - goto _out88; -case 88: -#line 2431 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr242; - case 32: goto tr242; - case 34: goto tr244; - case 39: goto st96; - case 47: goto tr247; - case 60: goto st80; - case 62: goto tr103; - case 63: goto tr198; - case 92: goto tr195; - case 95: goto tr198; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr243; - } else if ( (*p) >= 9 ) - goto tr242; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr198; - } else if ( (*p) >= 65 ) - goto tr198; - } else - goto tr198; - goto tr189; -tr244: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st89; -st89: - if ( ++p == pe ) - goto _out89; -case 89: -#line 2467 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr248; - case 32: goto tr248; - case 34: goto tr84; - case 47: goto tr247; - case 60: goto tr199; - case 62: goto tr251; - case 63: goto tr198; - case 92: goto tr195; - case 95: goto tr198; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr249; - } else if ( (*p) >= 9 ) - goto tr248; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr198; - } else if ( (*p) >= 65 ) - goto tr198; - } else - goto tr198; - goto tr189; -tr94: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st90; -tr93: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st90; -tr260: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st90; -tr249: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st90; -st90: - if ( ++p == pe ) - goto _out90; -case 90: -#line 2524 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr92; - case 32: goto tr92; - case 34: goto tr84; - case 47: goto tr101; - case 60: goto st80; - case 62: goto tr103; - case 63: goto tr100; - case 92: goto st94; - case 95: goto tr100; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr93; - } else if ( (*p) >= 9 ) - goto tr92; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr100; - } else if ( (*p) >= 65 ) - goto tr100; - } else - goto tr100; - goto st78; -tr100: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st91; -tr198: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st91; -st91: - if ( ++p == pe ) - goto _out91; -case 91: -#line 2587 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr144; - case 32: goto tr144; - case 34: goto tr84; - case 47: goto tr147; - case 60: goto st80; - case 61: goto tr148; - case 62: goto tr149; - case 63: goto st91; - case 92: goto st94; - case 95: goto st91; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr145; - } else if ( (*p) >= 9 ) - goto tr144; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st91; - } else if ( (*p) >= 65 ) - goto st91; - } else - goto st91; - goto st78; -tr99: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st92; -tr145: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st92; -st92: - if ( ++p == pe ) - goto _out92; -case 92: -#line 2635 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr98; - case 32: goto tr98; - case 34: goto tr84; - case 47: goto tr101; - case 60: goto st80; - case 61: goto st95; - case 62: goto tr103; - case 63: goto tr100; - case 92: goto st94; - case 95: goto tr100; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr99; - } else if ( (*p) >= 9 ) - goto tr98; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr100; - } else if ( (*p) >= 65 ) - goto tr100; - } else - goto tr100; - goto st78; -tr95: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st93; -tr101: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st93; -tr147: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st93; -tr194: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st93; -tr246: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st93; -tr247: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st93; -st93: - if ( ++p == pe ) - goto _out93; -case 93: -#line 2736 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr92; - case 32: goto tr92; - case 34: goto tr84; - case 47: goto tr95; - case 60: goto st80; - case 62: goto tr96; - case 92: goto st94; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr93; - } else if ( (*p) >= 9 ) - goto tr92; - goto st78; -tr195: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st94; -st94: - if ( ++p == pe ) - goto _out94; -case 94: -#line 2760 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr92; - case 32: goto tr92; - case 34: goto tr94; - case 47: goto tr95; - case 60: goto st80; - case 62: goto tr96; - case 92: goto st94; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr93; - } else if ( (*p) >= 9 ) - goto tr92; - goto st78; -tr148: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st95; -tr191: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st95; -st95: - if ( ++p == pe ) - goto _out95; -case 95: -#line 2788 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr242; - case 32: goto tr242; - case 34: goto tr244; - case 39: goto st96; - case 47: goto tr246; - case 60: goto st80; - case 62: goto tr96; - case 92: goto tr195; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr243; - } else if ( (*p) >= 9 ) - goto tr242; - goto tr189; -st96: - if ( ++p == pe ) - goto _out96; -case 96: - switch( (*p) ) { - case 13: goto tr258; - case 32: goto tr258; - case 34: goto tr263; - case 39: goto tr94; - case 47: goto tr256; - case 60: goto tr215; - case 62: goto tr261; - case 92: goto tr211; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr259; - } else if ( (*p) >= 9 ) - goto tr258; - goto tr205; -tr205: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st97; -st97: - if ( ++p == pe ) - goto _out97; -case 97: -#line 2833 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr105; - case 32: goto tr105; - case 34: goto tr80; - case 39: goto tr94; - case 47: goto tr108; - case 60: goto st99; - case 62: goto tr109; - case 92: goto st129; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr106; - } else if ( (*p) >= 9 ) - goto tr105; - goto st97; -tr51: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st98; -tr105: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st98; -tr218: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st98; -tr258: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st98; -st98: - if ( ++p == pe ) - goto _out98; -case 98: -#line 2878 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st98; - case 34: goto tr10; - case 39: goto tr11; - case 47: goto tr55; - case 62: goto tr57; - case 63: goto tr54; - case 92: goto st122; - case 95: goto tr54; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st98; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr54; - } else if ( (*p) >= 65 ) - goto tr54; - } else - goto tr54; - goto st99; -tr215: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st99; -st99: - if ( ++p == pe ) - goto _out99; -case 99: -#line 2909 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr10; - case 39: goto tr11; - case 92: goto st122; - } - goto st99; -tr10: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st100; -tr78: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st100; -tr178: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st100; -tr225: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st100; -tr238: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st100; -st100: - if ( ++p == pe ) - goto _out100; -case 100: -#line 2950 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st100; - case 39: goto tr3; - case 47: goto tr31; - case 62: goto tr33; - case 63: goto tr30; - case 92: goto st102; - case 95: goto tr30; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st100; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr30; - } else if ( (*p) >= 65 ) - goto tr30; - } else - goto tr30; - goto st101; -tr176: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st101; -st101: - if ( ++p == pe ) - goto _out101; -case 101: -#line 2980 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr3; - case 92: goto st102; - } - goto st101; -tr177: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st102; -st102: - if ( ++p == pe ) - goto _out102; -case 102: -#line 2994 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr10; - case 92: goto st102; - } - goto st101; -tr30: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st103; -tr179: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st103; -st103: - if ( ++p == pe ) - goto _out103; -case 103: -#line 3036 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr117; - case 39: goto tr3; - case 47: goto tr119; - case 61: goto tr120; - case 62: goto tr121; - case 63: goto st103; - case 92: goto st102; - case 95: goto st103; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr117; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st103; - } else if ( (*p) >= 65 ) - goto st103; - } else - goto st103; - goto st101; -tr85: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st104; -tr117: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st104; -tr138: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st104; -st104: - if ( ++p == pe ) - goto _out104; -case 104: -#line 3083 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st104; - case 39: goto tr3; - case 47: goto tr31; - case 61: goto st106; - case 62: goto tr33; - case 63: goto tr30; - case 92: goto st102; - case 95: goto tr30; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st104; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr30; - } else if ( (*p) >= 65 ) - goto tr30; - } else - goto tr30; - goto st101; -tr31: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st105; -tr119: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st105; -tr180: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st105; -st105: - if ( ++p == pe ) - goto _out105; -case 105: -#line 3132 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr3; - case 62: goto tr28; - case 92: goto st102; - } - goto st101; -tr28: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 70 "ext/hpricot_scan/hpricot_scan.rl" - {act = 12;} - goto st210; -tr33: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr82: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr90: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr121: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr143: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr181: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr240: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -tr241: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st210; -st210: - if ( ++p == pe ) - goto _out210; -case 210: -#line 3264 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr3; - case 92: goto st102; - } - goto st101; -tr120: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st106; -st106: - if ( ++p == pe ) - goto _out106; -case 106: -#line 3278 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr167; - case 32: goto tr167; - case 34: goto st136; - case 39: goto tr170; - case 47: goto tr171; - case 60: goto st101; - case 62: goto tr33; - case 92: goto tr172; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr168; - } else if ( (*p) >= 9 ) - goto tr167; - goto tr166; -tr166: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st107; -st107: - if ( ++p == pe ) - goto _out107; -case 107: -#line 3303 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr78; - case 32: goto tr78; - case 39: goto tr84; - case 47: goto tr81; - case 60: goto st101; - case 62: goto tr82; - case 92: goto st112; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr79; - } else if ( (*p) >= 9 ) - goto tr78; - goto st107; -tr80: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st108; -tr79: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st108; -tr263: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st108; -tr239: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st108; -st108: - if ( ++p == pe ) - goto _out108; -case 108: -#line 3349 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr78; - case 32: goto tr78; - case 39: goto tr84; - case 47: goto tr88; - case 60: goto st101; - case 62: goto tr90; - case 63: goto tr87; - case 92: goto st112; - case 95: goto tr87; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr79; - } else if ( (*p) >= 9 ) - goto tr78; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr87; - } else if ( (*p) >= 65 ) - goto tr87; - } else - goto tr87; - goto st107; -tr87: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st109; -tr175: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st109; -st109: - if ( ++p == pe ) - goto _out109; -case 109: -#line 3412 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr138; - case 32: goto tr138; - case 39: goto tr84; - case 47: goto tr141; - case 60: goto st101; - case 61: goto tr142; - case 62: goto tr143; - case 63: goto st109; - case 92: goto st112; - case 95: goto st109; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr139; - } else if ( (*p) >= 9 ) - goto tr138; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st109; - } else if ( (*p) >= 65 ) - goto st109; - } else - goto st109; - goto st107; -tr86: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st110; -tr139: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st110; -st110: - if ( ++p == pe ) - goto _out110; -case 110: -#line 3460 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr85; - case 32: goto tr85; - case 39: goto tr84; - case 47: goto tr88; - case 60: goto st101; - case 61: goto st113; - case 62: goto tr90; - case 63: goto tr87; - case 92: goto st112; - case 95: goto tr87; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr86; - } else if ( (*p) >= 9 ) - goto tr85; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr87; - } else if ( (*p) >= 65 ) - goto tr87; - } else - goto tr87; - goto st107; -tr81: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st111; -tr88: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st111; -tr141: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st111; -tr171: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st111; -tr236: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st111; -tr237: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st111; -st111: - if ( ++p == pe ) - goto _out111; -case 111: -#line 3561 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr78; - case 32: goto tr78; - case 39: goto tr84; - case 47: goto tr81; - case 60: goto st101; - case 62: goto tr82; - case 92: goto st112; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr79; - } else if ( (*p) >= 9 ) - goto tr78; - goto st107; -tr172: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st112; -st112: - if ( ++p == pe ) - goto _out112; -case 112: -#line 3585 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr78; - case 32: goto tr78; - case 39: goto tr80; - case 47: goto tr81; - case 60: goto st101; - case 62: goto tr82; - case 92: goto st112; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr79; - } else if ( (*p) >= 9 ) - goto tr78; - goto st107; -tr142: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st113; -tr168: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st113; -st113: - if ( ++p == pe ) - goto _out113; -case 113: -#line 3613 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr232; - case 32: goto tr232; - case 34: goto st116; - case 39: goto tr235; - case 47: goto tr236; - case 60: goto st101; - case 62: goto tr82; - case 92: goto tr172; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr233; - } else if ( (*p) >= 9 ) - goto tr232; - goto tr166; -tr173: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st114; -tr232: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st114; -st114: - if ( ++p == pe ) - goto _out114; -case 114: -#line 3647 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr173; - case 32: goto tr173; - case 34: goto st136; - case 39: goto tr170; - case 47: goto tr171; - case 60: goto st101; - case 62: goto tr33; - case 63: goto tr175; - case 92: goto tr172; - case 95: goto tr175; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr174; - } else if ( (*p) >= 9 ) - goto tr173; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr175; - } else if ( (*p) >= 65 ) - goto tr175; - } else - goto tr175; - goto tr166; -tr174: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st115; -tr233: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st115; -st115: - if ( ++p == pe ) - goto _out115; -case 115: -#line 3692 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr232; - case 32: goto tr232; - case 34: goto st116; - case 39: goto tr235; - case 47: goto tr237; - case 60: goto st101; - case 62: goto tr90; - case 63: goto tr175; - case 92: goto tr172; - case 95: goto tr175; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr233; - } else if ( (*p) >= 9 ) - goto tr232; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr175; - } else if ( (*p) >= 65 ) - goto tr175; - } else - goto tr175; - goto tr166; -st116: - if ( ++p == pe ) - goto _out116; -case 116: - switch( (*p) ) { - case 13: goto tr258; - case 32: goto tr258; - case 34: goto tr80; - case 39: goto tr260; - case 47: goto tr256; - case 60: goto tr215; - case 62: goto tr261; - case 92: goto tr211; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr259; - } else if ( (*p) >= 9 ) - goto tr258; - goto tr205; -tr107: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st117; -tr106: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st117; -tr259: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st117; -st117: - if ( ++p == pe ) - goto _out117; -case 117: -#line 3764 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr105; - case 32: goto tr105; - case 34: goto tr80; - case 39: goto tr94; - case 47: goto tr114; - case 60: goto st99; - case 62: goto tr116; - case 63: goto tr113; - case 92: goto st129; - case 95: goto tr113; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr106; - } else if ( (*p) >= 9 ) - goto tr105; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr113; - } else if ( (*p) >= 65 ) - goto tr113; - } else - goto tr113; - goto st97; -tr113: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st118; -tr214: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st118; -st118: - if ( ++p == pe ) - goto _out118; -case 118: -#line 3828 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr150; - case 32: goto tr150; - case 34: goto tr80; - case 39: goto tr94; - case 47: goto tr153; - case 60: goto st99; - case 61: goto tr154; - case 62: goto tr155; - case 63: goto st118; - case 92: goto st129; - case 95: goto st118; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr151; - } else if ( (*p) >= 9 ) - goto tr150; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st118; - } else if ( (*p) >= 65 ) - goto st118; - } else - goto st118; - goto st97; -tr111: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st119; -tr127: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st119; -tr150: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st119; -st119: - if ( ++p == pe ) - goto _out119; -case 119: -#line 3881 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st119; - case 34: goto tr10; - case 39: goto tr11; - case 47: goto tr55; - case 61: goto st123; - case 62: goto tr57; - case 63: goto tr54; - case 92: goto st122; - case 95: goto tr54; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto st119; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr54; - } else if ( (*p) >= 65 ) - goto tr54; - } else - goto tr54; - goto st99; -tr54: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st120; -tr219: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 94 "ext/hpricot_scan/hpricot_scan.rl" - { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } -#line 79 "ext/hpricot_scan/hpricot_scan.rl" - { mark_akey = p; } - goto st120; -st120: - if ( ++p == pe ) - goto _out120; -case 120: -#line 3941 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr127; - case 34: goto tr10; - case 39: goto tr11; - case 47: goto tr129; - case 61: goto tr130; - case 62: goto tr131; - case 63: goto st120; - case 92: goto st122; - case 95: goto st120; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr127; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st120; - } else if ( (*p) >= 65 ) - goto st120; - } else - goto st120; - goto st99; -tr55: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st121; -tr129: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st121; -tr220: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st121; -st121: - if ( ++p == pe ) - goto _out121; -case 121: -#line 3991 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr10; - case 39: goto tr11; - case 62: goto tr52; - case 92: goto st122; - } - goto st99; -tr52: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 70 "ext/hpricot_scan/hpricot_scan.rl" - {act = 12;} - goto st211; -tr57: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr109: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr116: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr131: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr155: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr221: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr261: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -tr262: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 68 "ext/hpricot_scan/hpricot_scan.rl" - {act = 10;} - goto st211; -st211: - if ( ++p == pe ) - goto _out211; -case 211: -#line 4124 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr10; - case 39: goto tr11; - case 92: goto st122; - } - goto st99; -tr217: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st122; -st122: - if ( ++p == pe ) - goto _out122; -case 122: -#line 4139 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr51; - case 39: goto tr51; - case 92: goto st122; - } - goto st99; -tr130: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st123; -st123: - if ( ++p == pe ) - goto _out123; -case 123: -#line 4154 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr206; - case 32: goto tr206; - case 34: goto tr208; - case 39: goto tr209; - case 47: goto tr210; - case 60: goto st99; - case 62: goto tr57; - case 92: goto tr211; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr207; - } else if ( (*p) >= 9 ) - goto tr206; - goto tr205; -tr206: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st124; -st124: - if ( ++p == pe ) - goto _out124; -case 124: -#line 4179 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr212; - case 32: goto tr212; - case 34: goto tr208; - case 39: goto tr209; - case 47: goto tr210; - case 60: goto st99; - case 62: goto tr57; - case 92: goto tr211; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr213; - } else if ( (*p) >= 9 ) - goto tr212; - goto tr205; -tr212: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st125; -tr252: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st125; -st125: - if ( ++p == pe ) - goto _out125; -case 125: -#line 4213 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr212; - case 32: goto tr212; - case 34: goto tr208; - case 39: goto tr209; - case 47: goto tr210; - case 60: goto st99; - case 62: goto tr57; - case 63: goto tr214; - case 92: goto tr211; - case 95: goto tr214; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr213; - } else if ( (*p) >= 9 ) - goto tr212; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr214; - } else if ( (*p) >= 65 ) - goto tr214; - } else - goto tr214; - goto tr205; -tr213: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st126; -tr253: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st126; -st126: - if ( ++p == pe ) - goto _out126; -case 126: -#line 4258 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr252; - case 32: goto tr252; - case 34: goto tr254; - case 39: goto tr255; - case 47: goto tr257; - case 60: goto st99; - case 62: goto tr116; - case 63: goto tr214; - case 92: goto tr211; - case 95: goto tr214; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr253; - } else if ( (*p) >= 9 ) - goto tr252; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr214; - } else if ( (*p) >= 65 ) - goto tr214; - } else - goto tr214; - goto tr205; -tr254: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st127; -st127: - if ( ++p == pe ) - goto _out127; -case 127: -#line 4294 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr258; - case 32: goto tr258; - case 34: goto tr80; - case 39: goto tr260; - case 47: goto tr257; - case 60: goto tr215; - case 62: goto tr262; - case 63: goto tr214; - case 92: goto tr211; - case 95: goto tr214; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr259; - } else if ( (*p) >= 9 ) - goto tr258; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr214; - } else if ( (*p) >= 65 ) - goto tr214; - } else - goto tr214; - goto tr205; -tr108: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st128; -tr114: -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st128; -tr153: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st128; -tr210: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st128; -tr256: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } - goto st128; -tr257: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } -#line 101 "ext/hpricot_scan/hpricot_scan.rl" - { - ATTR(akey, aval); - } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st128; -st128: - if ( ++p == pe ) - goto _out128; -case 128: -#line 4395 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr105; - case 32: goto tr105; - case 34: goto tr80; - case 39: goto tr94; - case 47: goto tr108; - case 60: goto st99; - case 62: goto tr109; - case 92: goto st129; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr106; - } else if ( (*p) >= 9 ) - goto tr105; - goto st97; -tr211: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st129; -st129: - if ( ++p == pe ) - goto _out129; -case 129: -#line 4420 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr105; - case 32: goto tr105; - case 34: goto tr107; - case 39: goto tr107; - case 47: goto tr108; - case 60: goto st99; - case 62: goto tr109; - case 92: goto st129; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr106; - } else if ( (*p) >= 9 ) - goto tr105; - goto st97; -tr255: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st130; -st130: - if ( ++p == pe ) - goto _out130; -case 130: -#line 4445 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr258; - case 32: goto tr258; - case 34: goto tr263; - case 39: goto tr94; - case 47: goto tr257; - case 60: goto tr215; - case 62: goto tr262; - case 63: goto tr214; - case 92: goto tr211; - case 95: goto tr214; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr259; - } else if ( (*p) >= 9 ) - goto tr258; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr214; - } else if ( (*p) >= 65 ) - goto tr214; - } else - goto tr214; - goto tr205; -tr208: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st131; -st131: - if ( ++p == pe ) - goto _out131; -case 131: -#line 4481 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr218; - case 34: goto tr10; - case 39: goto tr216; - case 47: goto tr220; - case 62: goto tr221; - case 63: goto tr219; - case 92: goto tr217; - case 95: goto tr219; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr218; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr219; - } else if ( (*p) >= 65 ) - goto tr219; - } else - goto tr219; - goto tr215; -tr209: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st132; -st132: - if ( ++p == pe ) - goto _out132; -case 132: -#line 4512 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr218; - case 34: goto tr225; - case 39: goto tr11; - case 47: goto tr220; - case 62: goto tr221; - case 63: goto tr219; - case 92: goto tr217; - case 95: goto tr219; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr218; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr219; - } else if ( (*p) >= 65 ) - goto tr219; - } else - goto tr219; - goto tr215; -tr154: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } - goto st133; -tr207: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st133; -st133: - if ( ++p == pe ) - goto _out133; -case 133: -#line 4547 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr252; - case 32: goto tr252; - case 34: goto tr254; - case 39: goto tr255; - case 47: goto tr256; - case 60: goto st99; - case 62: goto tr109; - case 92: goto tr211; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr253; - } else if ( (*p) >= 9 ) - goto tr252; - goto tr205; -tr112: -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st134; -tr151: -#line 87 "ext/hpricot_scan/hpricot_scan.rl" - { SET(akey, p); } -#line 83 "ext/hpricot_scan/hpricot_scan.rl" - { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - goto st134; -st134: - if ( ++p == pe ) - goto _out134; -case 134: -#line 4584 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr111; - case 32: goto tr111; - case 34: goto tr80; - case 39: goto tr94; - case 47: goto tr114; - case 60: goto st99; - case 61: goto st133; - case 62: goto tr116; - case 63: goto tr113; - case 92: goto st129; - case 95: goto tr113; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr112; - } else if ( (*p) >= 9 ) - goto tr111; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr113; - } else if ( (*p) >= 65 ) - goto tr113; - } else - goto tr113; - goto st97; -tr235: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st135; -st135: - if ( ++p == pe ) - goto _out135; -case 135: -#line 4621 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr238; - case 32: goto tr238; - case 39: goto tr84; - case 47: goto tr237; - case 60: goto tr176; - case 62: goto tr241; - case 63: goto tr175; - case 92: goto tr172; - case 95: goto tr175; - } - if ( (*p) < 45 ) { - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr239; - } else if ( (*p) >= 9 ) - goto tr238; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr175; - } else if ( (*p) >= 65 ) - goto tr175; - } else - goto tr175; - goto tr166; -st136: - if ( ++p == pe ) - goto _out136; -case 136: - switch( (*p) ) { - case 34: goto tr10; - case 39: goto tr216; - case 92: goto tr217; - } - goto tr215; -tr170: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st137; -st137: - if ( ++p == pe ) - goto _out137; -case 137: -#line 4666 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr178; - case 39: goto tr3; - case 47: goto tr180; - case 62: goto tr181; - case 63: goto tr179; - case 92: goto tr177; - case 95: goto tr179; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr178; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr179; - } else if ( (*p) >= 65 ) - goto tr179; - } else - goto tr179; - goto tr176; -tr167: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st138; -st138: - if ( ++p == pe ) - goto _out138; -case 138: -#line 4696 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr173; - case 32: goto tr173; - case 34: goto st136; - case 39: goto tr170; - case 47: goto tr171; - case 60: goto st101; - case 62: goto tr33; - case 92: goto tr172; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr174; - } else if ( (*p) >= 9 ) - goto tr173; - goto tr166; -tr192: -#line 82 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); } - goto st139; -st139: - if ( ++p == pe ) - goto _out139; -case 139: -#line 4721 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr201; - case 34: goto tr3; - case 47: goto tr203; - case 62: goto tr204; - case 63: goto tr202; - case 92: goto tr200; - case 95: goto tr202; - } - if ( (*p) < 45 ) { - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr201; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr202; - } else if ( (*p) >= 65 ) - goto tr202; - } else - goto tr202; - goto tr199; -st140: - if ( ++p == pe ) - goto _out140; -case 140: - switch( (*p) ) { - case 34: goto tr225; - case 39: goto tr11; - case 92: goto tr217; - } - goto tr215; -st141: - if ( ++p == pe ) - goto _out141; -case 141: - switch( (*p) ) { - case 13: goto tr238; - case 32: goto tr238; - case 39: goto tr84; - case 47: goto tr236; - case 60: goto tr176; - case 62: goto tr240; - case 92: goto tr172; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr239; - } else if ( (*p) >= 9 ) - goto tr238; - goto tr166; -st142: - if ( ++p == pe ) - goto _out142; -case 142: - switch( (*p) ) { - case 34: goto tr3; - case 92: goto tr200; - } - goto tr199; -st143: - if ( ++p == pe ) - goto _out143; -case 143: - switch( (*p) ) { - case 39: goto tr3; - case 92: goto tr177; - } - goto tr176; -tr157: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st144; -st144: - if ( ++p == pe ) - goto _out144; -case 144: -#line 4798 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 13: goto tr163; - case 32: goto tr163; - case 34: goto st142; - case 39: goto st143; - case 47: goto tr161; - case 60: goto tr69; - case 62: goto tr162; - } - if ( (*p) > 10 ) { - if ( 11 <= (*p) && (*p) <= 12 ) - goto tr164; - } else if ( (*p) >= 9 ) - goto tr163; - goto tr156; -st145: - if ( ++p == pe ) - goto _out145; -case 145: - switch( (*p) ) { - case 58: goto tr339; - case 95: goto tr339; - case 120: goto tr340; - } - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr339; - } else if ( (*p) >= 65 ) - goto tr339; - goto tr296; -tr339: -#line 46 "ext/hpricot_scan/hpricot_scan.rl" - { TEXT_PASS(); } - goto st146; -st146: - if ( ++p == pe ) - goto _out146; -case 146: -#line 4837 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st212; - case 63: goto st146; - case 95: goto st146; - } - if ( (*p) < 48 ) { - if ( (*p) > 13 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st146; - } else if ( (*p) >= 9 ) - goto st212; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st146; - } else if ( (*p) >= 65 ) - goto st146; - } else - goto st146; - goto tr296; -st212: - if ( ++p == pe ) - goto _out212; -case 212: - if ( (*p) == 32 ) - goto st212; - if ( 9 <= (*p) && (*p) <= 13 ) - goto st212; - goto tr14; -tr340: -#line 46 "ext/hpricot_scan/hpricot_scan.rl" - { TEXT_PASS(); } - goto st147; -st147: - if ( ++p == pe ) - goto _out147; -case 147: -#line 4875 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st212; - case 63: goto st146; - case 95: goto st146; - case 109: goto st148; - } - if ( (*p) < 48 ) { - if ( (*p) > 13 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st146; - } else if ( (*p) >= 9 ) - goto st212; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st146; - } else if ( (*p) >= 65 ) - goto st146; - } else - goto st146; - goto tr296; -st148: - if ( ++p == pe ) - goto _out148; -case 148: - switch( (*p) ) { - case 32: goto st212; - case 63: goto st146; - case 95: goto st146; - case 108: goto st149; - } - if ( (*p) < 48 ) { - if ( (*p) > 13 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st146; - } else if ( (*p) >= 9 ) - goto st212; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st146; - } else if ( (*p) >= 65 ) - goto st146; - } else - goto st146; - goto tr296; -st149: - if ( ++p == pe ) - goto _out149; -case 149: - switch( (*p) ) { - case 32: goto tr16; - case 63: goto st146; - case 95: goto st146; - } - if ( (*p) < 48 ) { - if ( (*p) > 13 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st146; - } else if ( (*p) >= 9 ) - goto tr16; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st146; - } else if ( (*p) >= 65 ) - goto st146; - } else - goto st146; - goto tr296; -tr16: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} - goto st213; -st213: - if ( ++p == pe ) - goto _out213; -case 213: -#line 4954 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto tr16; - case 118: goto st150; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto tr16; - goto tr14; -st150: - if ( ++p == pe ) - goto _out150; -case 150: - if ( (*p) == 101 ) - goto st151; - goto tr264; -st151: - if ( ++p == pe ) - goto _out151; -case 151: - if ( (*p) == 114 ) - goto st152; - goto tr264; -st152: - if ( ++p == pe ) - goto _out152; -case 152: - if ( (*p) == 115 ) - goto st153; - goto tr264; -st153: - if ( ++p == pe ) - goto _out153; -case 153: - if ( (*p) == 105 ) - goto st154; - goto tr264; -st154: - if ( ++p == pe ) - goto _out154; -case 154: - if ( (*p) == 111 ) - goto st155; - goto tr264; -st155: - if ( ++p == pe ) - goto _out155; -case 155: - if ( (*p) == 110 ) - goto st156; - goto tr264; -st156: - if ( ++p == pe ) - goto _out156; -case 156: - switch( (*p) ) { - case 32: goto st156; - case 61: goto st157; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st156; - goto tr264; -st157: - if ( ++p == pe ) - goto _out157; -case 157: - switch( (*p) ) { - case 32: goto st157; - case 34: goto st158; - case 39: goto st200; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st157; - goto tr264; -st158: - if ( ++p == pe ) - goto _out158; -case 158: - if ( (*p) == 95 ) - goto tr282; - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto tr282; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr282; - } else if ( (*p) >= 65 ) - goto tr282; - } else - goto tr282; - goto tr264; -tr282: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st159; -st159: - if ( ++p == pe ) - goto _out159; -case 159: -#line 5053 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr275; - case 95: goto st159; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st159; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st159; - } else if ( (*p) >= 65 ) - goto st159; - } else - goto st159; - goto tr264; -tr275: -#line 88 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("version"), aval); } - goto st160; -st160: - if ( ++p == pe ) - goto _out160; -case 160: -#line 5078 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st161; - case 62: goto tr270; - case 63: goto st162; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st161; - goto tr264; -st161: - if ( ++p == pe ) - goto _out161; -case 161: - switch( (*p) ) { - case 32: goto st161; - case 62: goto tr270; - case 63: goto st162; - case 101: goto st163; - case 115: goto st176; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st161; - goto tr264; -st162: - if ( ++p == pe ) - goto _out162; -case 162: - if ( (*p) == 62 ) - goto tr270; - goto tr264; -st163: - if ( ++p == pe ) - goto _out163; -case 163: - if ( (*p) == 110 ) - goto st164; - goto tr264; -st164: - if ( ++p == pe ) - goto _out164; -case 164: - if ( (*p) == 99 ) - goto st165; - goto tr264; -st165: - if ( ++p == pe ) - goto _out165; -case 165: - if ( (*p) == 111 ) - goto st166; - goto tr264; -st166: - if ( ++p == pe ) - goto _out166; -case 166: - if ( (*p) == 100 ) - goto st167; - goto tr264; -st167: - if ( ++p == pe ) - goto _out167; -case 167: - if ( (*p) == 105 ) - goto st168; - goto tr264; -st168: - if ( ++p == pe ) - goto _out168; -case 168: - if ( (*p) == 110 ) - goto st169; - goto tr264; -st169: - if ( ++p == pe ) - goto _out169; -case 169: - if ( (*p) == 103 ) - goto st170; - goto tr264; -st170: - if ( ++p == pe ) - goto _out170; -case 170: - switch( (*p) ) { - case 32: goto st170; - case 61: goto st171; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st170; - goto tr264; -st171: - if ( ++p == pe ) - goto _out171; -case 171: - switch( (*p) ) { - case 32: goto st171; - case 34: goto st172; - case 39: goto st198; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st171; - goto tr264; -st172: - if ( ++p == pe ) - goto _out172; -case 172: - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr283; - } else if ( (*p) >= 65 ) - goto tr283; - goto tr264; -tr283: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st173; -st173: - if ( ++p == pe ) - goto _out173; -case 173: -#line 5198 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 34: goto tr277; - case 95: goto st173; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st173; - } else if ( (*p) > 57 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st173; - } else if ( (*p) >= 65 ) - goto st173; - } else - goto st173; - goto tr264; -tr277: -#line 89 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("encoding"), aval); } - goto st174; -st174: - if ( ++p == pe ) - goto _out174; -case 174: -#line 5223 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st175; - case 62: goto tr270; - case 63: goto st162; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st175; - goto tr264; -st175: - if ( ++p == pe ) - goto _out175; -case 175: - switch( (*p) ) { - case 32: goto st175; - case 62: goto tr270; - case 63: goto st162; - case 115: goto st176; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st175; - goto tr264; -st176: - if ( ++p == pe ) - goto _out176; -case 176: - if ( (*p) == 116 ) - goto st177; - goto tr264; -st177: - if ( ++p == pe ) - goto _out177; -case 177: - if ( (*p) == 97 ) - goto st178; - goto tr264; -st178: - if ( ++p == pe ) - goto _out178; -case 178: - if ( (*p) == 110 ) - goto st179; - goto tr264; -st179: - if ( ++p == pe ) - goto _out179; -case 179: - if ( (*p) == 100 ) - goto st180; - goto tr264; -st180: - if ( ++p == pe ) - goto _out180; -case 180: - if ( (*p) == 97 ) - goto st181; - goto tr264; -st181: - if ( ++p == pe ) - goto _out181; -case 181: - if ( (*p) == 108 ) - goto st182; - goto tr264; -st182: - if ( ++p == pe ) - goto _out182; -case 182: - if ( (*p) == 111 ) - goto st183; - goto tr264; -st183: - if ( ++p == pe ) - goto _out183; -case 183: - if ( (*p) == 110 ) - goto st184; - goto tr264; -st184: - if ( ++p == pe ) - goto _out184; -case 184: - if ( (*p) == 101 ) - goto st185; - goto tr264; -st185: - if ( ++p == pe ) - goto _out185; -case 185: - switch( (*p) ) { - case 32: goto st185; - case 61: goto st186; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st185; - goto tr264; -st186: - if ( ++p == pe ) - goto _out186; -case 186: - switch( (*p) ) { - case 32: goto st186; - case 34: goto st187; - case 39: goto st193; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st186; - goto tr264; -st187: - if ( ++p == pe ) - goto _out187; -case 187: - switch( (*p) ) { - case 110: goto tr291; - case 121: goto tr292; - } - goto tr264; -tr291: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st188; -st188: - if ( ++p == pe ) - goto _out188; -case 188: -#line 5348 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 111 ) - goto st189; - goto tr264; -st189: - if ( ++p == pe ) - goto _out189; -case 189: - if ( (*p) == 34 ) - goto tr279; - goto tr264; -tr279: -#line 90 "ext/hpricot_scan/hpricot_scan.rl" - { SET(aval, p); ATTR(rb_str_new2("standalone"), aval); } - goto st190; -st190: - if ( ++p == pe ) - goto _out190; -case 190: -#line 5367 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 32: goto st190; - case 62: goto tr270; - case 63: goto st162; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st190; - goto tr264; -tr292: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st191; -st191: - if ( ++p == pe ) - goto _out191; -case 191: -#line 5384 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 101 ) - goto st192; - goto tr264; -st192: - if ( ++p == pe ) - goto _out192; -case 192: - if ( (*p) == 115 ) - goto st189; - goto tr264; -st193: - if ( ++p == pe ) - goto _out193; -case 193: - switch( (*p) ) { - case 110: goto tr405; - case 121: goto tr406; - } - goto tr264; -tr405: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st194; -st194: - if ( ++p == pe ) - goto _out194; -case 194: -#line 5412 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 111 ) - goto st195; - goto tr264; -st195: - if ( ++p == pe ) - goto _out195; -case 195: - if ( (*p) == 39 ) - goto tr279; - goto tr264; -tr406: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st196; -st196: - if ( ++p == pe ) - goto _out196; -case 196: -#line 5431 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 101 ) - goto st197; - goto tr264; -st197: - if ( ++p == pe ) - goto _out197; -case 197: - if ( (*p) == 115 ) - goto st195; - goto tr264; -st198: - if ( ++p == pe ) - goto _out198; -case 198: - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr383; - } else if ( (*p) >= 65 ) - goto tr383; - goto tr264; -tr383: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st199; -st199: - if ( ++p == pe ) - goto _out199; -case 199: -#line 5460 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr277; - case 95: goto st199; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st199; - } else if ( (*p) > 57 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st199; - } else if ( (*p) >= 65 ) - goto st199; - } else - goto st199; - goto tr264; -st200: - if ( ++p == pe ) - goto _out200; -case 200: - if ( (*p) == 95 ) - goto tr382; - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto tr382; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr382; - } else if ( (*p) >= 65 ) - goto tr382; - } else - goto tr382; - goto tr264; -tr382: -#line 78 "ext/hpricot_scan/hpricot_scan.rl" - { mark_aval = p; } - goto st201; -st201: - if ( ++p == pe ) - goto _out201; -case 201: -#line 5503 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 39: goto tr275; - case 95: goto st201; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st201; - } else if ( (*p) > 58 ) { - if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st201; - } else if ( (*p) >= 65 ) - goto st201; - } else - goto st201; - goto tr264; -tr409: -#line 51 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st214; -tr411: -#line 51 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st214; -tr412: -#line 9 "ext/hpricot_scan/hpricot_scan.rl" - {curline += 1;} -#line 51 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st214; -tr414: -#line 51 "ext/hpricot_scan/hpricot_scan.rl" - {{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st214; -tr415: -#line 50 "ext/hpricot_scan/hpricot_scan.rl" - { EBLK(comment, 3); {goto st204;} } -#line 50 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{p = ((tokend))-1;}} - goto st214; -st214: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = 0;} - if ( ++p == pe ) - goto _out214; -case 214: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = p;} -#line 5552 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 10: goto tr412; - case 45: goto tr413; - } - goto tr411; -tr413: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} - goto st215; -st215: - if ( ++p == pe ) - goto _out215; -case 215: -#line 5566 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 45 ) - goto st202; - goto tr409; -st202: - if ( ++p == pe ) - goto _out202; -case 202: - if ( (*p) == 62 ) - goto tr415; - goto tr414; -tr416: -#line 56 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st216; -tr418: -#line 56 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st216; -tr419: -#line 9 "ext/hpricot_scan/hpricot_scan.rl" - {curline += 1;} -#line 56 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st216; -tr421: -#line 56 "ext/hpricot_scan/hpricot_scan.rl" - {{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st216; -tr422: -#line 55 "ext/hpricot_scan/hpricot_scan.rl" - { EBLK(cdata, 3); {goto st204;} } -#line 55 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{p = ((tokend))-1;}} - goto st216; -st216: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = 0;} - if ( ++p == pe ) - goto _out216; -case 216: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = p;} -#line 5609 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 10: goto tr419; - case 93: goto tr420; - } - goto tr418; -tr420: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;} - goto st217; -st217: - if ( ++p == pe ) - goto _out217; -case 217: -#line 5623 "ext/hpricot_scan/hpricot_scan.c" - if ( (*p) == 93 ) - goto st203; - goto tr416; -st203: - if ( ++p == pe ) - goto _out203; -case 203: - if ( (*p) == 62 ) - goto tr422; - goto tr421; -tr423: -#line 61 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st218; -tr424: -#line 60 "ext/hpricot_scan/hpricot_scan.rl" - { EBLK(procins, 2); {goto st204;} } -#line 60 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{p = ((tokend))-1;}} - goto st218; -tr425: -#line 61 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st218; -tr426: -#line 9 "ext/hpricot_scan/hpricot_scan.rl" - {curline += 1;} -#line 61 "ext/hpricot_scan/hpricot_scan.rl" - {tokend = p+1;{ TEXT_PASS(); }{p = ((tokend))-1;}} - goto st218; -st218: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = 0;} - if ( ++p == pe ) - goto _out218; -case 218: -#line 1 "ext/hpricot_scan/hpricot_scan.rl" - {tokstart = p;} -#line 5662 "ext/hpricot_scan/hpricot_scan.c" - switch( (*p) ) { - case 10: goto tr426; - case 62: goto tr424; - case 63: goto st219; - } - goto tr425; -st219: - if ( ++p == pe ) - goto _out219; -case 219: - if ( (*p) == 62 ) - goto tr424; - goto tr423; - } - _out204: cs = 204; goto _out; - _out205: cs = 205; goto _out; - _out0: cs = 0; goto _out; - _out1: cs = 1; goto _out; - _out2: cs = 2; goto _out; - _out3: cs = 3; goto _out; - _out4: cs = 4; goto _out; - _out5: cs = 5; goto _out; - _out6: cs = 6; goto _out; - _out7: cs = 7; goto _out; - _out8: cs = 8; goto _out; - _out9: cs = 9; goto _out; - _out10: cs = 10; goto _out; - _out11: cs = 11; goto _out; - _out12: cs = 12; goto _out; - _out13: cs = 13; goto _out; - _out14: cs = 14; goto _out; - _out15: cs = 15; goto _out; - _out16: cs = 16; goto _out; - _out17: cs = 17; goto _out; - _out18: cs = 18; goto _out; - _out19: cs = 19; goto _out; - _out20: cs = 20; goto _out; - _out21: cs = 21; goto _out; - _out22: cs = 22; goto _out; - _out23: cs = 23; goto _out; - _out24: cs = 24; goto _out; - _out25: cs = 25; goto _out; - _out26: cs = 26; goto _out; - _out27: cs = 27; goto _out; - _out28: cs = 28; goto _out; - _out29: cs = 29; goto _out; - _out30: cs = 30; goto _out; - _out31: cs = 31; goto _out; - _out32: cs = 32; goto _out; - _out33: cs = 33; goto _out; - _out34: cs = 34; goto _out; - _out35: cs = 35; goto _out; - _out36: cs = 36; goto _out; - _out37: cs = 37; goto _out; - _out38: cs = 38; goto _out; - _out39: cs = 39; goto _out; - _out206: cs = 206; goto _out; - _out40: cs = 40; goto _out; - _out41: cs = 41; goto _out; - _out207: cs = 207; goto _out; - _out42: cs = 42; goto _out; - _out43: cs = 43; goto _out; - _out208: cs = 208; goto _out; - _out44: cs = 44; goto _out; - _out45: cs = 45; goto _out; - _out46: cs = 46; goto _out; - _out47: cs = 47; goto _out; - _out48: cs = 48; goto _out; - _out49: cs = 49; goto _out; - _out50: cs = 50; goto _out; - _out51: cs = 51; goto _out; - _out52: cs = 52; goto _out; - _out53: cs = 53; goto _out; - _out54: cs = 54; goto _out; - _out55: cs = 55; goto _out; - _out56: cs = 56; goto _out; - _out57: cs = 57; goto _out; - _out58: cs = 58; goto _out; - _out59: cs = 59; goto _out; - _out60: cs = 60; goto _out; - _out61: cs = 61; goto _out; - _out62: cs = 62; goto _out; - _out63: cs = 63; goto _out; - _out64: cs = 64; goto _out; - _out65: cs = 65; goto _out; - _out66: cs = 66; goto _out; - _out67: cs = 67; goto _out; - _out68: cs = 68; goto _out; - _out69: cs = 69; goto _out; - _out70: cs = 70; goto _out; - _out71: cs = 71; goto _out; - _out72: cs = 72; goto _out; - _out73: cs = 73; goto _out; - _out74: cs = 74; goto _out; - _out75: cs = 75; goto _out; - _out76: cs = 76; goto _out; - _out77: cs = 77; goto _out; - _out78: cs = 78; goto _out; - _out79: cs = 79; goto _out; - _out80: cs = 80; goto _out; - _out81: cs = 81; goto _out; - _out82: cs = 82; goto _out; - _out83: cs = 83; goto _out; - _out84: cs = 84; goto _out; - _out209: cs = 209; goto _out; - _out85: cs = 85; goto _out; - _out86: cs = 86; goto _out; - _out87: cs = 87; goto _out; - _out88: cs = 88; goto _out; - _out89: cs = 89; goto _out; - _out90: cs = 90; goto _out; - _out91: cs = 91; goto _out; - _out92: cs = 92; goto _out; - _out93: cs = 93; goto _out; - _out94: cs = 94; goto _out; - _out95: cs = 95; goto _out; - _out96: cs = 96; goto _out; - _out97: cs = 97; goto _out; - _out98: cs = 98; goto _out; - _out99: cs = 99; goto _out; - _out100: cs = 100; goto _out; - _out101: cs = 101; goto _out; - _out102: cs = 102; goto _out; - _out103: cs = 103; goto _out; - _out104: cs = 104; goto _out; - _out105: cs = 105; goto _out; - _out210: cs = 210; goto _out; - _out106: cs = 106; goto _out; - _out107: cs = 107; goto _out; - _out108: cs = 108; goto _out; - _out109: cs = 109; goto _out; - _out110: cs = 110; goto _out; - _out111: cs = 111; goto _out; - _out112: cs = 112; goto _out; - _out113: cs = 113; goto _out; - _out114: cs = 114; goto _out; - _out115: cs = 115; goto _out; - _out116: cs = 116; goto _out; - _out117: cs = 117; goto _out; - _out118: cs = 118; goto _out; - _out119: cs = 119; goto _out; - _out120: cs = 120; goto _out; - _out121: cs = 121; goto _out; - _out211: cs = 211; goto _out; - _out122: cs = 122; goto _out; - _out123: cs = 123; goto _out; - _out124: cs = 124; goto _out; - _out125: cs = 125; goto _out; - _out126: cs = 126; goto _out; - _out127: cs = 127; goto _out; - _out128: cs = 128; goto _out; - _out129: cs = 129; goto _out; - _out130: cs = 130; goto _out; - _out131: cs = 131; goto _out; - _out132: cs = 132; goto _out; - _out133: cs = 133; goto _out; - _out134: cs = 134; goto _out; - _out135: cs = 135; goto _out; - _out136: cs = 136; goto _out; - _out137: cs = 137; goto _out; - _out138: cs = 138; goto _out; - _out139: cs = 139; goto _out; - _out140: cs = 140; goto _out; - _out141: cs = 141; goto _out; - _out142: cs = 142; goto _out; - _out143: cs = 143; goto _out; - _out144: cs = 144; goto _out; - _out145: cs = 145; goto _out; - _out146: cs = 146; goto _out; - _out212: cs = 212; goto _out; - _out147: cs = 147; goto _out; - _out148: cs = 148; goto _out; - _out149: cs = 149; goto _out; - _out213: cs = 213; goto _out; - _out150: cs = 150; goto _out; - _out151: cs = 151; goto _out; - _out152: cs = 152; goto _out; - _out153: cs = 153; goto _out; - _out154: cs = 154; goto _out; - _out155: cs = 155; goto _out; - _out156: cs = 156; goto _out; - _out157: cs = 157; goto _out; - _out158: cs = 158; goto _out; - _out159: cs = 159; goto _out; - _out160: cs = 160; goto _out; - _out161: cs = 161; goto _out; - _out162: cs = 162; goto _out; - _out163: cs = 163; goto _out; - _out164: cs = 164; goto _out; - _out165: cs = 165; goto _out; - _out166: cs = 166; goto _out; - _out167: cs = 167; goto _out; - _out168: cs = 168; goto _out; - _out169: cs = 169; goto _out; - _out170: cs = 170; goto _out; - _out171: cs = 171; goto _out; - _out172: cs = 172; goto _out; - _out173: cs = 173; goto _out; - _out174: cs = 174; goto _out; - _out175: cs = 175; goto _out; - _out176: cs = 176; goto _out; - _out177: cs = 177; goto _out; - _out178: cs = 178; goto _out; - _out179: cs = 179; goto _out; - _out180: cs = 180; goto _out; - _out181: cs = 181; goto _out; - _out182: cs = 182; goto _out; - _out183: cs = 183; goto _out; - _out184: cs = 184; goto _out; - _out185: cs = 185; goto _out; - _out186: cs = 186; goto _out; - _out187: cs = 187; goto _out; - _out188: cs = 188; goto _out; - _out189: cs = 189; goto _out; - _out190: cs = 190; goto _out; - _out191: cs = 191; goto _out; - _out192: cs = 192; goto _out; - _out193: cs = 193; goto _out; - _out194: cs = 194; goto _out; - _out195: cs = 195; goto _out; - _out196: cs = 196; goto _out; - _out197: cs = 197; goto _out; - _out198: cs = 198; goto _out; - _out199: cs = 199; goto _out; - _out200: cs = 200; goto _out; - _out201: cs = 201; goto _out; - _out214: cs = 214; goto _out; - _out215: cs = 215; goto _out; - _out202: cs = 202; goto _out; - _out216: cs = 216; goto _out; - _out217: cs = 217; goto _out; - _out203: cs = 203; goto _out; - _out218: cs = 218; goto _out; - _out219: cs = 219; goto _out; - - _out: {} - } -#line 197 "ext/hpricot_scan/hpricot_scan.rl" - - if ( cs == hpricot_scan_error ) { - free(buf); - if ( !NIL_P(tag) ) - { - rb_raise(rb_eHpricotParseError, "parse error on element <%s>, starting on line %d.\n" NO_WAY_SERIOUSLY, RSTRING(tag)->ptr, curline); - } - else - { - rb_raise(rb_eHpricotParseError, "parse error on line %d.\n" NO_WAY_SERIOUSLY, curline); - } - } - - if ( done && ele_open ) - { - ele_open = 0; - if (tokstart > 0) { - mark_tag = tokstart; - tokstart = 0; - text = 1; - } - } - - if ( tokstart == 0 ) - { - have = 0; - /* text nodes have no tokstart because each byte is parsed alone */ - if ( mark_tag != NULL && text == 1 ) - { - if (done) - { - if (mark_tag < p-1) - { - CAT(tag, p-1); - ELE(text); - } - } - else - { - CAT(tag, p); - } - } - mark_tag = buf; - } - else - { - have = pe - tokstart; - memmove( buf, tokstart, have ); - SLIDE(tag); - SLIDE(akey); - SLIDE(aval); - tokend = buf + (tokend - tokstart); - tokstart = buf; - } - } - free(buf); -} - -void Init_hpricot_scan() -{ - VALUE mHpricot = rb_define_module("Hpricot"); - rb_define_attr(rb_singleton_class(mHpricot), "buffer_size", 1, 1); - rb_define_singleton_method(mHpricot, "scan", hpricot_scan, 1); - rb_eHpricotParseError = rb_define_class_under(mHpricot, "ParseError", rb_eException); - - s_read = rb_intern("read"); - s_to_str = rb_intern("to_str"); - sym_xmldecl = ID2SYM(rb_intern("xmldecl")); - sym_doctype = ID2SYM(rb_intern("doctype")); - sym_procins = ID2SYM(rb_intern("procins")); - sym_stag = ID2SYM(rb_intern("stag")); - sym_etag = ID2SYM(rb_intern("etag")); - sym_emptytag = ID2SYM(rb_intern("emptytag")); - sym_comment = ID2SYM(rb_intern("comment")); - sym_cdata = ID2SYM(rb_intern("cdata")); - sym_text = ID2SYM(rb_intern("text")); -} diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.h b/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.h deleted file mode 100644 index ecbe3b1..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * hpricot_scan.h - * - * $Author: why $ - * $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $ - * - * Copyright (C) 2006 why the lucky stiff - * You can redistribute it and/or modify it under the same terms as Ruby. - */ - -#ifndef hpricot_scan_h -#define hpricot_scan_h - -#include - -#if defined(_WIN32) -#include -#endif - -/* - * Memory Allocation - */ -#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__) -#include -#endif - -#ifndef NULL -# define NULL (void *)0 -#endif - -#define BUFSIZE 16384 - -#define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n)) -#define S_ALLOC(type) (type*)malloc(sizeof(type)) -#define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n)) -#define S_FREE(n) free(n); n = NULL; - -#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n)) - -#define S_MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n)) -#define S_MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n)) -#define S_MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n)) -#define S_MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n)) - -typedef struct { - void *name; - void *attributes; -} hpricot_element; - -typedef void (*hpricot_element_cb)(void *data, hpricot_element *token); - -typedef struct hpricot_scan { - int lineno; - int cs; - size_t nread; - size_t mark; - - void *data; - - hpricot_element_cb xmldecl; - hpricot_element_cb doctype; - hpricot_element_cb xmlprocins; - hpricot_element_cb starttag; - hpricot_element_cb endtag; - hpricot_element_cb emptytag; - hpricot_element_cb comment; - hpricot_element_cb cdata; - -} http_scan; - -// int hpricot_scan_init(hpricot_scan *scan); -// int hpricot_scan_finish(hpricot_scan *scan); -// size_t hpricot_scan_execute(hpricot_scan *scan, const char *data, size_t len, size_t off); -// int hpricot_scan_has_error(hpricot_scan *scan); -// int hpricot_scan_is_finished(hpricot_scan *scan); -// -// #define hpricot_scan_nread(scan) (scan)->nread - -#endif diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.java.rl b/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.java.rl deleted file mode 100644 index b5860a8..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.java.rl +++ /dev/null @@ -1,363 +0,0 @@ - -import java.io.IOException; - -import org.jruby.Ruby; -import org.jruby.RubyClass; -import org.jruby.RubyHash; -import org.jruby.RubyModule; -import org.jruby.RubyNumeric; -import org.jruby.RubyString; -import org.jruby.runtime.Block; -import org.jruby.runtime.CallbackFactory; -import org.jruby.runtime.builtin.IRubyObject; -import org.jruby.exceptions.RaiseException; -import org.jruby.runtime.load.BasicLibraryService; - -public class HpricotScanService implements BasicLibraryService { - public static String NO_WAY_SERIOUSLY="*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!"; - - public void ELE(IRubyObject N) { - if (tokend > tokstart || text) { - IRubyObject raw_string = runtime.getNil(); - ele_open = false; text = false; - if (tokstart != -1 && N != cdata && N != sym_text && N != procins && N != comment) { - raw_string = runtime.newString(new String(buf,tokstart,tokend-tokstart)); - } - rb_yield_tokens(N, tag[0], attr, raw_string, taint); - } - } - - public void SET(IRubyObject[] N, int E) { - int mark = 0; - if(N == tag) { - if(mark_tag == -1 || E == mark_tag) { - tag[0] = runtime.newString(""); - } else if(E > mark_tag) { - tag[0] = runtime.newString(new String(buf,mark_tag, E-mark_tag)); - } - } else if(N == akey) { - if(mark_akey == -1 || E == mark_akey) { - akey[0] = runtime.newString(""); - } else if(E > mark_akey) { - akey[0] = runtime.newString(new String(buf,mark_akey, E-mark_akey)); - } - } else if(N == aval) { - if(mark_aval == -1 || E == mark_aval) { - aval[0] = runtime.newString(""); - } else if(E > mark_aval) { - aval[0] = runtime.newString(new String(buf,mark_aval, E-mark_aval)); - } - } - } - - public void CAT(IRubyObject[] N, int E) { - if(N[0].isNil()) { - SET(N,E); - } else { - int mark = 0; - if(N == tag) { - mark = mark_tag; - } else if(N == akey) { - mark = mark_akey; - } else if(N == aval) { - mark = mark_aval; - } - ((RubyString)(N[0])).append(runtime.newString(new String(buf, mark, E-mark))); - } - } - - public void SLIDE(Object N) { - int mark = 0; - if(N == tag) { - mark = mark_tag; - } else if(N == akey) { - mark = mark_akey; - } else if(N == aval) { - mark = mark_aval; - } - if(mark > tokstart) { - if(N == tag) { - mark_tag -= tokstart; - } else if(N == akey) { - mark_akey -= tokstart; - } else if(N == aval) { - mark_aval -= tokstart; - } - } - } - - public void ATTR(IRubyObject K, IRubyObject V) { - if(!K.isNil()) { - if(attr.isNil()) { - attr = RubyHash.newHash(runtime); - } - ((RubyHash)attr).aset(K,V); - } - } - - public void ATTR(IRubyObject[] K, IRubyObject V) { - ATTR(K[0],V); - } - - public void ATTR(IRubyObject K, IRubyObject[] V) { - ATTR(K,V[0]); - } - - public void ATTR(IRubyObject[] K, IRubyObject[] V) { - ATTR(K[0],V[0]); - } - - public void TEXT_PASS() { - if(!text) { - if(ele_open) { - ele_open = false; - if(tokstart > -1) { - mark_tag = tokstart; - } - } else { - mark_tag = p; - } - attr = runtime.getNil(); - tag[0] = runtime.getNil(); - text = true; - } - } - - public void EBLK(IRubyObject N, int T) { - CAT(tag, p - T + 1); - ELE(N); - } - - - public void rb_raise(RubyClass error, String message) { - throw new RaiseException(runtime, error, message, true); - } - - public IRubyObject rb_str_new2(String s) { - return runtime.newString(s); - } - -%%{ - machine hpricot_scan; - - action newEle { - if (text) { - CAT(tag, p); - ELE(sym_text); - text = false; - } - attr = runtime.getNil(); - tag[0] = runtime.getNil(); - mark_tag = -1; - ele_open = true; - } - - action _tag { mark_tag = p; } - action _aval { mark_aval = p; } - action _akey { mark_akey = p; } - action tag { SET(tag, p); } - action tagc { SET(tag, p-1); } - action aval { SET(aval, p); } - action aunq { - if (buf[p-1] == '"' || buf[p-1] == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - action akey { SET(akey, p); } - action xmlver { SET(aval, p); ATTR(rb_str_new2("version"), aval); } - action xmlenc { SET(aval, p); ATTR(rb_str_new2("encoding"), aval); } - action xmlsd { SET(aval, p); ATTR(rb_str_new2("standalone"), aval); } - action pubid { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - action sysid { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - - action new_attr { - akey[0] = runtime.getNil(); - aval[0] = runtime.getNil(); - mark_akey = -1; - mark_aval = -1; - } - - action save_attr { - ATTR(akey, aval); - } - - include hpricot_common "ext/hpricot_scan/hpricot_common.rl"; - -}%% - -%% write data nofinal; - -public final static int BUFSIZE=16384; - -private void rb_yield_tokens(IRubyObject sym, IRubyObject tag, IRubyObject attr, IRubyObject raw, boolean taint) { - IRubyObject ary; - if (sym == runtime.newSymbol("text")) { - raw = tag; - } - ary = runtime.newArray(new IRubyObject[]{sym, tag, attr, raw}); - if (taint) { - ary.setTaint(true); - tag.setTaint(true); - attr.setTaint(true); - raw.setTaint(true); - } - block.yield(runtime.getCurrentContext(), ary, null, null, false); -} - - -int cs, act, have = 0, nread = 0, curline = 1, p=-1; -boolean text = false; -int tokstart=-1, tokend; -char[] buf; -Ruby runtime; -IRubyObject attr, bufsize; -IRubyObject[] tag, akey, aval; -int mark_tag, mark_akey, mark_aval; -boolean done = false, ele_open = false; -int buffer_size = 0; -boolean taint = false; -Block block = null; - - -IRubyObject xmldecl, doctype, procins, stag, etag, emptytag, comment, - cdata, sym_text; - -IRubyObject hpricot_scan(IRubyObject recv, IRubyObject port) { - attr = bufsize = runtime.getNil(); - tag = new IRubyObject[]{runtime.getNil()}; - akey = new IRubyObject[]{runtime.getNil()}; - aval = new IRubyObject[]{runtime.getNil()}; - - RubyClass rb_eHpricotParseError = runtime.getModule("Hpricot").getClass("ParseError"); - - taint = port.isTaint(); - if ( !port.respondsTo("read")) { - if ( port.respondsTo("to_str")) { - port = port.callMethod(runtime.getCurrentContext(),"to_str"); - } else { - throw runtime.newArgumentError("bad Hpricot argument, String or IO only please."); - } - } - - buffer_size = BUFSIZE; - if (recv.getInstanceVariable("@buffer_size") != null) { - bufsize = recv.getInstanceVariable("@buffer_size"); - if (!bufsize.isNil()) { - buffer_size = RubyNumeric.fix2int(bufsize); - } - } - buf = new char[buffer_size]; - - %% write init; - - while( !done ) { - IRubyObject str; - p = have; - int pe; - int len, space = buffer_size - have; - - if ( space == 0 ) { - /* We've used up the entire buffer storing an already-parsed token - * prefix that must be preserved. Likely caused by super-long attributes. - * See ticket #13. */ - rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <" + tag.toString() + ">, starting on line "+curline+"."); - } - - if (port.respondsTo("read")) { - str = port.callMethod(runtime.getCurrentContext(),"read",runtime.newFixnum(space)); - } else { - str = ((RubyString)port).substr(nread,space); - } - - str = str.convertToString(); - String sss = str.toString(); - char[] chars = sss.toCharArray(); - System.arraycopy(chars,0,buf,p,chars.length); - - len = sss.length(); - nread += len; - - if ( len < space ) { - len++; - done = true; - } - - pe = p + len; - char[] data = buf; - - %% write exec; - - if ( cs == hpricot_scan_error ) { - if(!tag[0].isNil()) { - rb_raise(rb_eHpricotParseError, "parse error on element <"+tag.toString()+">, starting on line "+curline+".\n" + NO_WAY_SERIOUSLY); - } else { - rb_raise(rb_eHpricotParseError, "parse error on line "+curline+".\n" + NO_WAY_SERIOUSLY); - } - } - - if ( done && ele_open ) { - ele_open = false; - if(tokstart > -1) { - mark_tag = tokstart; - tokstart = -1; - text = true; - } - } - - if(tokstart == -1) { - have = 0; - /* text nodes have no tokstart because each byte is parsed alone */ - if(mark_tag != -1 && text) { - if (done) { - if(mark_tag < p-1) { - CAT(tag, p-1); - ELE(sym_text); - } - } else { - CAT(tag, p); - } - } - mark_tag = 0; - } else { - have = pe - tokstart; - System.arraycopy(buf,tokstart,buf,0,have); - SLIDE(tag); - SLIDE(akey); - SLIDE(aval); - tokend = (tokend - tokstart); - tokstart = 0; - } - } - return runtime.getNil(); -} - -public static IRubyObject __hpricot_scan(IRubyObject recv, IRubyObject port, Block block) { - Ruby runtime = recv.getRuntime(); - HpricotScanService service = new HpricotScanService(); - service.runtime = runtime; - service.xmldecl = runtime.newSymbol("xmldecl"); - service.doctype = runtime.newSymbol("doctype"); - service.procins = runtime.newSymbol("procins"); - service.stag = runtime.newSymbol("stag"); - service.etag = runtime.newSymbol("etag"); - service.emptytag = runtime.newSymbol("emptytag"); - service.comment = runtime.newSymbol("comment"); - service.cdata = runtime.newSymbol("cdata"); - service.sym_text = runtime.newSymbol("text"); - service.block = block; - return service.hpricot_scan(recv, port); -} - - -public boolean basicLoad(final Ruby runtime) throws IOException { - Init_hpricot_scan(runtime); - return true; -} - -public static void Init_hpricot_scan(Ruby runtime) { - RubyModule mHpricot = runtime.defineModule("Hpricot"); - mHpricot.getMetaClass().attr_accessor(new IRubyObject[]{runtime.newSymbol("buffer_size")}); - CallbackFactory fact = runtime.callbackFactory(HpricotScanService.class); - mHpricot.getMetaClass().defineMethod("scan",fact.getSingletonMethod("__hpricot_scan",IRubyObject.class)); - mHpricot.defineClassUnder("ParseError",runtime.getClass("Exception"),runtime.getClass("Exception").getAllocator()); -} -} diff --git a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.rl b/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.rl deleted file mode 100644 index df6d114..0000000 --- a/vendor/gems/hpricot-0.6/ext/hpricot_scan/hpricot_scan.rl +++ /dev/null @@ -1,273 +0,0 @@ -/* - * hpricot_scan.rl - * - * $Author: why $ - * $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $ - * - * Copyright (C) 2006 why the lucky stiff - */ -#include - -#define NO_WAY_SERIOUSLY "*** This should not happen, please send a bug report with the HTML you're parsing to why@whytheluckystiff.net. So sorry!" - -static VALUE sym_xmldecl, sym_doctype, sym_procins, sym_stag, sym_etag, sym_emptytag, sym_comment, - sym_cdata, sym_text; -static VALUE rb_eHpricotParseError; -static ID s_read, s_to_str; - -#define ELE(N) \ - if (tokend > tokstart || text == 1) { \ - VALUE raw_string = Qnil; \ - ele_open = 0; text = 0; \ - if (tokstart != 0 && sym_##N != sym_cdata && sym_##N != sym_text && sym_##N != sym_procins && sym_##N != sym_comment) { \ - raw_string = rb_str_new(tokstart, tokend-tokstart); \ - } \ - rb_yield_tokens(sym_##N, tag, attr, raw_string, taint); \ - } - -#define SET(N, E) \ - if (mark_##N == NULL || E == mark_##N) \ - N = rb_str_new2(""); \ - else if (E > mark_##N) \ - N = rb_str_new(mark_##N, E - mark_##N); - -#define CAT(N, E) if (NIL_P(N)) { SET(N, E); } else { rb_str_cat(N, mark_##N, E - mark_##N); } - -#define SLIDE(N) if ( mark_##N > tokstart ) mark_##N = buf + (mark_##N - tokstart); - -#define ATTR(K, V) \ - if (!NIL_P(K)) { \ - if (NIL_P(attr)) attr = rb_hash_new(); \ - rb_hash_aset(attr, K, V); \ - } - -#define TEXT_PASS() \ - if (text == 0) \ - { \ - if (ele_open == 1) { \ - ele_open = 0; \ - if (tokstart > 0) { \ - mark_tag = tokstart; \ - } \ - } else { \ - mark_tag = p; \ - } \ - attr = Qnil; \ - tag = Qnil; \ - text = 1; \ - } - -#define EBLK(N, T) CAT(tag, p - T + 1); ELE(N); - -%%{ - machine hpricot_scan; - - action newEle { - if (text == 1) { - CAT(tag, p); - ELE(text); - text = 0; - } - attr = Qnil; - tag = Qnil; - mark_tag = NULL; - ele_open = 1; - } - - action _tag { mark_tag = p; } - action _aval { mark_aval = p; } - action _akey { mark_akey = p; } - action tag { SET(tag, p); } - action tagc { SET(tag, p-1); } - action aval { SET(aval, p); } - action aunq { - if (*(p-1) == '"' || *(p-1) == '\'') { SET(aval, p-1); } - else { SET(aval, p); } - } - action akey { SET(akey, p); } - action xmlver { SET(aval, p); ATTR(rb_str_new2("version"), aval); } - action xmlenc { SET(aval, p); ATTR(rb_str_new2("encoding"), aval); } - action xmlsd { SET(aval, p); ATTR(rb_str_new2("standalone"), aval); } - action pubid { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); } - action sysid { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); } - - action new_attr { - akey = Qnil; - aval = Qnil; - mark_akey = NULL; - mark_aval = NULL; - } - - action save_attr { - ATTR(akey, aval); - } - - include hpricot_common "ext/hpricot_scan/hpricot_common.rl"; - -}%% - -%% write data nofinal; - -#define BUFSIZE 16384 - -void rb_yield_tokens(VALUE sym, VALUE tag, VALUE attr, VALUE raw, int taint) -{ - VALUE ary; - if (sym == sym_text) { - raw = tag; - } - ary = rb_ary_new3(4, sym, tag, attr, raw); - if (taint) { - OBJ_TAINT(ary); - OBJ_TAINT(tag); - OBJ_TAINT(attr); - OBJ_TAINT(raw); - } - rb_yield(ary); -} - -VALUE hpricot_scan(VALUE self, VALUE port) -{ - int cs, act, have = 0, nread = 0, curline = 1, text = 0; - char *tokstart = 0, *tokend = 0, *buf = NULL; - - VALUE attr = Qnil, tag = Qnil, akey = Qnil, aval = Qnil, bufsize = Qnil; - char *mark_tag = 0, *mark_akey = 0, *mark_aval = 0; - int done = 0, ele_open = 0, buffer_size = 0; - - int taint = OBJ_TAINTED( port ); - if ( !rb_respond_to( port, s_read ) ) - { - if ( rb_respond_to( port, s_to_str ) ) - { - port = rb_funcall( port, s_to_str, 0 ); - StringValue(port); - } - else - { - rb_raise( rb_eArgError, "bad Hpricot argument, String or IO only please." ); - } - } - - buffer_size = BUFSIZE; - if (rb_ivar_defined(self, rb_intern("@buffer_size")) == Qtrue) { - bufsize = rb_ivar_get(self, rb_intern("@buffer_size")); - if (!NIL_P(bufsize)) { - buffer_size = NUM2INT(bufsize); - } - } - buf = ALLOC_N(char, buffer_size); - - %% write init; - - while ( !done ) { - VALUE str; - char *p = buf + have, *pe; - int len, space = buffer_size - have; - - if ( space == 0 ) { - /* We've used up the entire buffer storing an already-parsed token - * prefix that must be preserved. Likely caused by super-long attributes. - * See ticket #13. */ - rb_raise(rb_eHpricotParseError, "ran out of buffer space on element <%s>, starting on line %d.", RSTRING(tag)->ptr, curline); - } - - if ( rb_respond_to( port, s_read ) ) - { - str = rb_funcall( port, s_read, 1, INT2FIX(space) ); - } - else - { - str = rb_str_substr( port, nread, space ); - } - - StringValue(str); - memcpy( p, RSTRING(str)->ptr, RSTRING(str)->len ); - len = RSTRING(str)->len; - nread += len; - - /* If this is the last buffer, tack on an EOF. */ - if ( len < space ) { - p[len++] = 0; - done = 1; - } - - pe = p + len; - %% write exec; - - if ( cs == hpricot_scan_error ) { - free(buf); - if ( !NIL_P(tag) ) - { - rb_raise(rb_eHpricotParseError, "parse error on element <%s>, starting on line %d.\n" NO_WAY_SERIOUSLY, RSTRING(tag)->ptr, curline); - } - else - { - rb_raise(rb_eHpricotParseError, "parse error on line %d.\n" NO_WAY_SERIOUSLY, curline); - } - } - - if ( done && ele_open ) - { - ele_open = 0; - if (tokstart > 0) { - mark_tag = tokstart; - tokstart = 0; - text = 1; - } - } - - if ( tokstart == 0 ) - { - have = 0; - /* text nodes have no tokstart because each byte is parsed alone */ - if ( mark_tag != NULL && text == 1 ) - { - if (done) - { - if (mark_tag < p-1) - { - CAT(tag, p-1); - ELE(text); - } - } - else - { - CAT(tag, p); - } - } - mark_tag = buf; - } - else - { - have = pe - tokstart; - memmove( buf, tokstart, have ); - SLIDE(tag); - SLIDE(akey); - SLIDE(aval); - tokend = buf + (tokend - tokstart); - tokstart = buf; - } - } - free(buf); -} - -void Init_hpricot_scan() -{ - VALUE mHpricot = rb_define_module("Hpricot"); - rb_define_attr(rb_singleton_class(mHpricot), "buffer_size", 1, 1); - rb_define_singleton_method(mHpricot, "scan", hpricot_scan, 1); - rb_eHpricotParseError = rb_define_class_under(mHpricot, "ParseError", rb_eException); - - s_read = rb_intern("read"); - s_to_str = rb_intern("to_str"); - sym_xmldecl = ID2SYM(rb_intern("xmldecl")); - sym_doctype = ID2SYM(rb_intern("doctype")); - sym_procins = ID2SYM(rb_intern("procins")); - sym_stag = ID2SYM(rb_intern("stag")); - sym_etag = ID2SYM(rb_intern("etag")); - sym_emptytag = ID2SYM(rb_intern("emptytag")); - sym_comment = ID2SYM(rb_intern("comment")); - sym_cdata = ID2SYM(rb_intern("cdata")); - sym_text = ID2SYM(rb_intern("text")); -} diff --git a/vendor/gems/hpricot-0.6/extras/mingw-rbconfig.rb b/vendor/gems/hpricot-0.6/extras/mingw-rbconfig.rb deleted file mode 100644 index 25dec44..0000000 --- a/vendor/gems/hpricot-0.6/extras/mingw-rbconfig.rb +++ /dev/null @@ -1,176 +0,0 @@ - -# This rbconfig.rb corresponds to a Ruby installation for win32 cross-compiled -# with mingw under i686-linux. It can be used to cross-compile extensions for -# win32 using said toolchain. -# -# This file assumes that a cross-compiled mingw32 build (compatible with the -# mswin32 builds) is installed under $HOME/ruby-mingw32. - -module Config - #RUBY_VERSION == "1.8.5" or - # raise "ruby lib version (1.8.5) doesn't match executable version (#{RUBY_VERSION})" - - mingw32 = ENV['MINGW32_RUBY'] || "#{ENV["HOME"]}/ruby-mingw32" - mingwpre = ENV['MINGW32_PREFIX'] - TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32") - DESTDIR = '' unless defined? DESTDIR - CONFIG = {} - CONFIG["DESTDIR"] = DESTDIR - CONFIG["INSTALL"] = "/usr/bin/install -c" - CONFIG["prefix"] = (TOPDIR || DESTDIR + mingw32) - CONFIG["EXEEXT"] = ".exe" - CONFIG["ruby_install_name"] = "ruby" - CONFIG["RUBY_INSTALL_NAME"] = "ruby" - CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18" - CONFIG["SHELL"] = "/bin/sh" - CONFIG["PATH_SEPARATOR"] = ":" - CONFIG["PACKAGE_NAME"] = "" - CONFIG["PACKAGE_TARNAME"] = "" - CONFIG["PACKAGE_VERSION"] = "" - CONFIG["PACKAGE_STRING"] = "" - CONFIG["PACKAGE_BUGREPORT"] = "" - CONFIG["exec_prefix"] = "$(prefix)" - CONFIG["bindir"] = "$(exec_prefix)/bin" - CONFIG["sbindir"] = "$(exec_prefix)/sbin" - CONFIG["libexecdir"] = "$(exec_prefix)/libexec" - CONFIG["datadir"] = "$(prefix)/share" - CONFIG["sysconfdir"] = "$(prefix)/etc" - CONFIG["sharedstatedir"] = "$(prefix)/com" - CONFIG["localstatedir"] = "$(prefix)/var" - CONFIG["libdir"] = "$(exec_prefix)/lib" - CONFIG["includedir"] = "$(prefix)/include" - CONFIG["oldincludedir"] = "/usr/include" - CONFIG["infodir"] = "$(prefix)/info" - CONFIG["mandir"] = "$(prefix)/man" - CONFIG["build_alias"] = "i686-linux" - CONFIG["host_alias"] = "#{mingwpre}" - CONFIG["target_alias"] = "i386-mingw32" - CONFIG["ECHO_C"] = "" - CONFIG["ECHO_N"] = "-n" - CONFIG["ECHO_T"] = "" - CONFIG["LIBS"] = "-lwsock32 " - CONFIG["MAJOR"] = "1" - CONFIG["MINOR"] = "8" - CONFIG["TEENY"] = "4" - CONFIG["build"] = "i686-pc-linux" - CONFIG["build_cpu"] = "i686" - CONFIG["build_vendor"] = "pc" - CONFIG["build_os"] = "linux" - CONFIG["host"] = "i586-pc-mingw32msvc" - CONFIG["host_cpu"] = "i586" - CONFIG["host_vendor"] = "pc" - CONFIG["host_os"] = "mingw32msvc" - CONFIG["target"] = "i386-pc-mingw32" - CONFIG["target_cpu"] = "i386" - CONFIG["target_vendor"] = "pc" - CONFIG["target_os"] = "mingw32" - CONFIG["CC"] = "#{mingwpre}-gcc" - CONFIG["CFLAGS"] = "-g -O2 " - CONFIG["LDFLAGS"] = "" - CONFIG["CPPFLAGS"] = "" - CONFIG["OBJEXT"] = "o" - CONFIG["CPP"] = "#{mingwpre}-gcc -E" - CONFIG["EGREP"] = "grep -E" - CONFIG["GNU_LD"] = "yes" - CONFIG["CPPOUTFILE"] = "-o conftest.i" - CONFIG["OUTFLAG"] = "-o " - CONFIG["YACC"] = "bison -y" - CONFIG["RANLIB"] = "#{mingwpre}-ranlib" - CONFIG["AR"] = "#{mingwpre}-ar" - CONFIG["NM"] = "#{mingwpre}-nm" - CONFIG["WINDRES"] = "#{mingwpre}-windres" - CONFIG["DLLWRAP"] = "#{mingwpre}-dllwrap" - CONFIG["OBJDUMP"] = "#{mingwpre}-objdump" - CONFIG["LN_S"] = "ln -s" - CONFIG["SET_MAKE"] = "" - CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)" - CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)" - CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644" - CONFIG["RM"] = "rm -f" - CONFIG["CP"] = "cp" - CONFIG["MAKEDIRS"] = "mkdir -p" - CONFIG["LIBOBJS"] = " fileblocks$(U).o crypt$(U).o flock$(U).o acosh$(U).o win32$(U).o" - CONFIG["ALLOCA"] = "" - CONFIG["DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all" - CONFIG["ARCH_FLAG"] = "" - CONFIG["STATIC"] = "" - CONFIG["CCDLFLAGS"] = "" - CONFIG["LDSHARED"] = "#{mingwpre}-gcc -shared -s" - CONFIG["DLEXT"] = "so" - CONFIG["DLEXT2"] = "dll" - CONFIG["LIBEXT"] = "a" - CONFIG["LINK_SO"] = "" - CONFIG["LIBPATHFLAG"] = " -L\"%s\"" - CONFIG["RPATHFLAG"] = "" - CONFIG["LIBPATHENV"] = "" - CONFIG["TRY_LINK"] = "" - CONFIG["STRIP"] = "strip" - CONFIG["EXTSTATIC"] = "" - CONFIG["setup"] = "Setup" - CONFIG["MINIRUBY"] = "ruby -rfake" - CONFIG["PREP"] = "fake.rb" - CONFIG["RUNRUBY"] = "$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`" - CONFIG["EXTOUT"] = ".ext" - CONFIG["ARCHFILE"] = "" - CONFIG["RDOCTARGET"] = "" - CONFIG["XCFLAGS"] = " -DRUBY_EXPORT" - CONFIG["XLDFLAGS"] = " -Wl,--stack,0x02000000 -L." - CONFIG["LIBRUBY_LDSHARED"] = "#{mingwpre}-gcc -shared -s" - CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBRUBY)" - CONFIG["rubyw_install_name"] = "rubyw" - CONFIG["RUBYW_INSTALL_NAME"] = "rubyw" - CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a" - CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll" - CONFIG["LIBRUBY_ALIASES"] = "" - CONFIG["LIBRUBY"] = "lib$(LIBRUBY_SO).a" - CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)" - CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static" - CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)" - CONFIG["SOLIBS"] = "$(LIBS)" - CONFIG["DLDLIBS"] = "" - CONFIG["ENABLE_SHARED"] = "yes" - CONFIG["MAINLIBS"] = "" - CONFIG["COMMON_LIBS"] = "m" - CONFIG["COMMON_MACROS"] = "" - CONFIG["COMMON_HEADERS"] = "windows.h winsock.h" - CONFIG["EXPORT_PREFIX"] = "" - CONFIG["MINIOBJS"] = "dmydln.o" - CONFIG["MAKEFILES"] = "Makefile GNUmakefile" - CONFIG["arch"] = "i386-mingw32" - CONFIG["sitearch"] = "i386-msvcrt" - CONFIG["sitedir"] = "$(prefix)/lib/ruby/site_ruby" - CONFIG["configure_args"] = "'--host=#{mingwpre}' '--target=i386-mingw32' '--build=i686-linux' '--prefix=#{mingw32}' 'build_alias=i686-linux' 'host_alias=#{mingwpre}' 'target_alias=i386-mingw32'" - CONFIG["NROFF"] = "/usr/bin/nroff" - CONFIG["MANTYPE"] = "doc" - CONFIG["LTLIBOBJS"] = " fileblocks$(U).lo crypt$(U).lo flock$(U).lo acosh$(U).lo win32$(U).lo" - CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)" - CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)" - CONFIG["archdir"] = "$(rubylibdir)/$(arch)" - CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)" - CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)" - CONFIG["topdir"] = File.dirname(__FILE__) - MAKEFILE_CONFIG = {} - CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup} - def Config::expand(val, config = CONFIG) - val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var| - if !(v = $1 || $2) - '$' - elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]] - pat, sub = $1, $2 - config[v] = false - Config::expand(key, config) - config[v] = key - key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat - key - else - var - end - end - val - end - CONFIG.each_value do |val| - Config::expand(val) - end -end -RbConfig = Config # compatibility for ruby-1.9 -CROSS_COMPILING = nil unless defined? CROSS_COMPILING diff --git a/vendor/gems/hpricot-0.6/init.rb b/vendor/gems/hpricot-0.6/init.rb deleted file mode 100644 index e8b352b..0000000 --- a/vendor/gems/hpricot-0.6/init.rb +++ /dev/null @@ -1,3 +0,0 @@ - - require File.join(File.dirname(__FILE__), 'lib', 'hpricot') - diff --git a/vendor/gems/hpricot-0.6/lib/hpricot.rb b/vendor/gems/hpricot-0.6/lib/hpricot.rb deleted file mode 100644 index 3032f63..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot.rb +++ /dev/null @@ -1,26 +0,0 @@ -# == About hpricot.rb -# -# All of Hpricot's various part are loaded when you use require 'hpricot'. -# -# * hpricot_scan: the scanner (a C extension for Ruby) which turns an HTML stream into tokens. -# * hpricot/parse.rb: uses the scanner to sort through tokens and give you back a complete document object. -# * hpricot/tag.rb: sets up objects for the various types of elements in an HTML document. -# * hpricot/modules.rb: categorizes the various elements using mixins. -# * hpricot/traverse.rb: methods for searching documents. -# * hpricot/elements.rb: methods for dealing with a group of elements as an Hpricot::Elements list. -# * hpricot/inspect.rb: methods for displaying documents in a readable form. - -# If available, Nikolai's UTF-8 library will ease use of utf-8 documents. -# See http://git.bitwi.se/ruby-character-encodings.git/. -begin - require 'encoding/character/utf-8' -rescue LoadError -end - -require 'hpricot_scan' -require 'hpricot/tag' -require 'hpricot/modules' -require 'hpricot/traverse' -require 'hpricot/inspect' -require 'hpricot/parse' -require 'hpricot/builder' diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/blankslate.rb b/vendor/gems/hpricot-0.6/lib/hpricot/blankslate.rb deleted file mode 100644 index c247d46..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/blankslate.rb +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env ruby -#-- -# Copyright 2004 by Jim Weirich (jim@weirichhouse.org). -# All rights reserved. - -# Permission is granted for use, copying, modification, distribution, -# and distribution of modified versions of this work as long as the -# above copyright notice is included. -#++ - -module Hpricot - - # BlankSlate provides an abstract base class with no predefined - # methods (except for \_\_send__ and \_\_id__). - # BlankSlate is useful as a base class when writing classes that - # depend upon method_missing (e.g. dynamic proxies). - class BlankSlate - class << self - - # Hide the method named +name+ in the BlankSlate class. Don't - # hide +instance_eval+ or any method beginning with "__". - def hide(name) - undef_method name if - instance_methods.include?(name.to_s) and - name !~ /^(__|instance_eval)/ - end - end - - instance_methods.each { |m| hide(m) } - end -end - -# Since Ruby is very dynamic, methods added to the ancestors of -# BlankSlate after BlankSlate is defined will show up in the -# list of available BlankSlate methods. We handle this by defining a -# hook in the Object and Kernel classes that will hide any defined -module Kernel - class << self - alias_method :hpricot_slate_method_added, :method_added - - # Detect method additions to Kernel and remove them in the - # BlankSlate class. - def method_added(name) - hpricot_slate_method_added(name) - return if self != Kernel - Hpricot::BlankSlate.hide(name) - end - end -end - -class Object - class << self - alias_method :hpricot_slate_method_added, :method_added - - # Detect method additions to Object and remove them in the - # BlankSlate class. - def method_added(name) - hpricot_slate_method_added(name) - return if self != Object - Hpricot::BlankSlate.hide(name) - end - end -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/builder.rb b/vendor/gems/hpricot-0.6/lib/hpricot/builder.rb deleted file mode 100644 index 37c31e0..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/builder.rb +++ /dev/null @@ -1,200 +0,0 @@ -require 'hpricot/tags' -require 'hpricot/xchar' -require 'hpricot/blankslate' - -module Hpricot - def self.build(ele = Doc.new, assigns = {}, &blk) - ele.extend Builder - assigns.each do |k, v| - ele.instance_variable_set("@#{k}", v) - end - ele.instance_eval &blk - ele - end - - module Builder - - @@default = { - :indent => 0, - :output_helpers => true, - :output_xml_instruction => true, - :output_meta_tag => true, - :auto_validation => true, - :tagset => Hpricot::XHTMLTransitional, - :root_attributes => { - :xmlns => 'http://www.w3.org/1999/xhtml', :'xml:lang' => 'en', :lang => 'en' - } - } - - def self.set(option, value) - @@default[option] = value - end - - # Write a +string+ to the HTML stream, making sure to escape it. - def text!(string) - @children << Text.new(Hpricot.xs(string)) - end - - # Write a +string+ to the HTML stream without escaping it. - def text(string) - @children << Text.new(string) - nil - end - alias_method :<<, :text - alias_method :concat, :text - - # Create a tag named +tag+. Other than the first argument which is the tag name, - # the arguments are the same as the tags implemented via method_missing. - def tag!(tag, *args, &block) - ele_id = nil - if @auto_validation and @tagset - if !@tagset.tagset.has_key?(tag) - raise InvalidXhtmlError, "no element `#{tag}' for #{tagset.doctype}" - elsif args.last.respond_to?(:to_hash) - attrs = args.last.to_hash - - if @tagset.forms.include?(tag) and attrs[:id] - attrs[:name] ||= attrs[:id] - end - - attrs.each do |k, v| - atname = k.to_s.downcase.intern - unless k =~ /:/ or @tagset.tagset[tag].include? atname - raise InvalidXhtmlError, "no attribute `#{k}' on #{tag} elements" - end - if atname == :id - ele_id = v.to_s - if @elements.has_key? ele_id - raise InvalidXhtmlError, "id `#{ele_id}' already used (id's must be unique)." - end - end - end - end - end - - # turn arguments into children or attributes - childs = [] - attrs = args.grep(Hash) - childs.concat((args - attrs).map do |x| - if x.respond_to? :to_html - Hpricot.make(x.to_html) - elsif x - Text.new(Hpricot.xs(x)) - end - end.flatten) - attrs = attrs.inject({}) do |hsh, ath| - ath.each do |k, v| - hsh[k] = Hpricot.xs(v.to_s) if v - end - hsh - end - - # create the element itself - f = Elem.new(STag.new(tag, attrs), childs, ETag.new(tag)) - - # build children from the block - if block - build(f, &block) - end - - @children << f - f - end - - def build(*a, &b) - Hpricot.build(*a, &b) - end - - # Every HTML tag method goes through an html_tag call. So, calling div is equivalent - # to calling html_tag(:div). All HTML tags in Hpricot's list are given generated wrappers - # for this method. - # - # If the @auto_validation setting is on, this method will check for many common mistakes which - # could lead to invalid XHTML. - def html_tag(sym, *args, &block) - if @auto_validation and @tagset.self_closing.include?(sym) and block - raise InvalidXhtmlError, "the `#{sym}' element is self-closing, please remove the block" - elsif args.empty? and block.nil? - CssProxy.new(self, sym) - else - tag!(sym, *args, &block) - end - end - - XHTMLTransitional.tags.each do |k| - class_eval %{ - def #{k}(*args, &block) - html_tag(#{k.inspect}, *args, &block) - end - } - end - - def doctype(target, pub, sys) - @children << DocType.new(target, pub, sys) - end - - remove_method :head - - # Builds a head tag. Adds a meta tag inside with Content-Type - # set to text/html; charset=utf-8. - def head(*args, &block) - tag!(:head, *args) do - tag!(:meta, "http-equiv" => "Content-Type", "content" => "text/html; charset=utf-8") if @output_meta_tag - instance_eval(&block) - end - end - - # Builds an html tag. An XML 1.0 instruction and an XHTML 1.0 Transitional doctype - # are prepended. Also assumes :xmlns => "http://www.w3.org/1999/xhtml", - # :lang => "en". - def xhtml_transitional(attrs = {}, &block) - # self.tagset = Hpricot::XHTMLTransitional - xhtml_html(attrs, &block) - end - - # Builds an html tag with XHTML 1.0 Strict doctype instead. - def xhtml_strict(attrs = {}, &block) - # self.tagset = Hpricot::XHTMLStrict - xhtml_html(attrs, &block) - end - - private - - def xhtml_html(attrs = {}, &block) - instruct! if @output_xml_instruction - doctype(:html, *@@default[:tagset].doctype) - tag!(:html, @@default[:root_attributes].merge(attrs), &block) - end - - end - - # Class used by Markaby::Builder to store element options. Methods called - # against the CssProxy object are added as element classes or IDs. - # - # See the README for examples. - class CssProxy < BlankSlate - - # Creates a CssProxy object. - def initialize(builder, sym) - @builder, @sym, @attrs = builder, sym, {} - end - - # Adds attributes to an element. Bang methods set the :id attribute. - # Other methods add to the :class attribute. - def method_missing(id_or_class, *args, &block) - if (idc = id_or_class.to_s) =~ /!$/ - @attrs[:id] = $` - else - @attrs[:class] = @attrs[:class].nil? ? idc : "#{@attrs[:class]} #{idc}".strip - end - - if block or args.any? - args.push(@attrs) - return @builder.tag!(@sym, *args, &block) - end - - return self - end - - end -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/elements.rb b/vendor/gems/hpricot-0.6/lib/hpricot/elements.rb deleted file mode 100644 index 26c0636..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/elements.rb +++ /dev/null @@ -1,510 +0,0 @@ -module Hpricot -# Once you've matched a list of elements, you will often need to handle them as -# a group. Or you may want to perform the same action on each of them. -# Hpricot::Elements is an extension of Ruby's array class, with some methods -# added for altering elements contained in the array. -# -# If you need to create an element array from regular elements: -# -# Hpricot::Elements[ele1, ele2, ele3] -# -# Assuming that ele1, ele2 and ele3 contain element objects (Hpricot::Elem, -# Hpricot::Doc, etc.) -# -# == Continuing Searches -# -# Usually the Hpricot::Elements you're working on comes from a search you've -# done. Well, you can continue searching the list by using the same at -# and search methods you can use on plain elements. -# -# elements = doc.search("/div/p") -# elements = elements.search("/a[@href='http://hoodwink.d/']") -# elements = elements.at("img") -# -# == Altering Elements -# -# When you're altering elements in the list, your changes will be reflected in -# the document you started searching from. -# -# doc = Hpricot("That's my spoon, Tyler.") -# doc.at("b").swap("fork") -# doc.to_html -# #=> "That's my fork, Tyler." -# -# == Getting More Detailed -# -# If you can't find a method here that does what you need, you may need to -# loop through the elements and find a method in Hpricot::Container::Trav -# which can do what you need. -# -# For example, you may want to search for all the H3 header tags in a document -# and grab all the tags underneath the header, but not inside the header. -# A good method for this is next_sibling: -# -# doc.search("h3").each do |h3| -# while ele = h3.next_sibling -# ary << ele # stuff away all the elements under the h3 -# end -# end -# -# Most of the useful element methods are in the mixins Hpricot::Traverse -# and Hpricot::Container::Trav. - class Elements < Array - - # Searches this list for any elements (or children of these elements) matching - # the CSS or XPath expression +expr+. Root is assumed to be the element scanned. - # - # See Hpricot::Container::Trav.search for more. - def search(*expr,&blk) - Elements[*map { |x| x.search(*expr,&blk) }.flatten.uniq] - end - alias_method :/, :search - - # Searches this list for the first element (or child of these elements) matching - # the CSS or XPath expression +expr+. Root is assumed to be the element scanned. - # - # See Hpricot::Container::Trav.at for more. - def at(expr, &blk) - search(expr, &blk).first - end - alias_method :%, :at - - # Convert this group of elements into a complete HTML fragment, returned as a - # string. - def to_html - map { |x| x.output("") }.join - end - alias_method :to_s, :to_html - - # Returns an HTML fragment built of the contents of each element in this list. - # - # If a HTML +string+ is supplied, this method acts like inner_html=. - def inner_html(*string) - if string.empty? - map { |x| x.inner_html }.join - else - x = self.inner_html = string.pop || x - end - end - alias_method :html, :inner_html - alias_method :innerHTML, :inner_html - - # Replaces the contents of each element in this list. Supply an HTML +string+, - # which is loaded into Hpricot objects and inserted into every element in this - # list. - def inner_html=(string) - each { |x| x.inner_html = string } - end - alias_method :html=, :inner_html= - alias_method :innerHTML=, :inner_html= - - # Returns an string containing the text contents of each element in this list. - # All HTML tags are removed. - def inner_text - map { |x| x.inner_text }.join - end - alias_method :text, :inner_text - - # Remove all elements in this list from the document which contains them. - # - # doc = Hpricot("Remove this: here") - # doc.search("b").remove - # doc.to_html - # => "Remove this: " - # - def remove - each { |x| x.parent.children.delete(x) } - end - - # Empty the elements in this list, by removing their insides. - # - # doc = Hpricot("

      We have so much to say.

      ") - # doc.search("i").empty - # doc.to_html - # => "

      We have to say.

      " - # - def empty - each { |x| x.inner_html = nil } - end - - # Add to the end of the contents inside each element in this list. - # Pass in an HTML +str+, which is turned into Hpricot elements. - def append(str = nil, &blk) - each { |x| x.html(x.children + Hpricot.make(str, &blk)) } - end - - # Add to the start of the contents inside each element in this list. - # Pass in an HTML +str+, which is turned into Hpricot elements. - def prepend(str = nil, &blk) - each { |x| x.html(Hpricot.make(str, &blk) + x.children) } - end - - # Add some HTML just previous to each element in this list. - # Pass in an HTML +str+, which is turned into Hpricot elements. - def before(str = nil, &blk) - each { |x| x.parent.insert_before Hpricot.make(str, &blk), x } - end - - # Just after each element in this list, add some HTML. - # Pass in an HTML +str+, which is turned into Hpricot elements. - def after(str = nil, &blk) - each { |x| x.parent.insert_after Hpricot.make(str, &blk), x } - end - - # Wraps each element in the list inside the element created by HTML +str+. - # If more than one element is found in the string, Hpricot locates the - # deepest spot inside the first element. - # - # doc.search("a[@href]"). - # wrap(%{}) - # - # This code wraps every link on the page inside a +div.link+ and a +div.link_inner+ nest. - def wrap(str = nil, &blk) - each do |x| - wrap = Hpricot.make(str, &blk) - nest = wrap.detect { |w| w.respond_to? :children } - unless nest - raise Exception, "No wrapping element found." - end - x.parent.replace_child(x, wrap) - nest = nest.children.first until nest.empty? - nest.html(nest.children + [x]) - end - end - - # Gets and sets attributes on all matched elements. - # - # Pass in a +key+ on its own and this method will return the string value - # assigned to that attribute for the first elements. Or +nil+ if the - # attribute isn't found. - # - # doc.search("a").attr("href") - # #=> "http://hacketyhack.net/" - # - # Or, pass in a +key+ and +value+. This will set an attribute for all - # matched elements. - # - # doc.search("p").attr("class", "basic") - # - # You may also use a Hash to set a series of attributes: - # - # (doc/"a").attr(:class => "basic", :href => "http://hackety.org/") - # - # Lastly, a block can be used to rewrite an attribute based on the element - # it belongs to. The block will pass in an element. Return from the block - # the new value of the attribute. - # - # records.attr("href") { |e| e['href'] + "#top" } - # - # This example adds a #top anchor to each link. - # - def attr key, value = nil, &blk - if value or blk - each do |el| - el.set_attribute(key, value || blk[el]) - end - return self - end - if key.is_a? Hash - key.each { |k,v| self.attr(k,v) } - return self - else - return self[0].get_attribute(key) - end - end - alias_method :set, :attr - - # Adds the class to all matched elements. - # - # (doc/"p").add_class("bacon") - # - # Now all paragraphs will have class="bacon". - def add_class class_name - each do |el| - next unless el.respond_to? :get_attribute - classes = el.get_attribute('class').to_s.split(" ") - el.set_attribute('class', classes.push(class_name).uniq.join(" ")) - end - self - end - - # Remove an attribute from each of the matched elements. - # - # (doc/"input").remove_attr("disabled") - # - def remove_attr name - each do |el| - next unless el.respond_to? :remove_attribute - el.remove_attribute(name) - end - self - end - - # Removes a class from all matched elements. - # - # (doc/"span").remove_class("lightgrey") - # - # Or, to remove all classes: - # - # (doc/"span").remove_class - # - def remove_class name = nil - each do |el| - next unless el.respond_to? :get_attribute - if name - classes = el.get_attribute('class').to_s.split(" ") - el.set_attribute('class', (classes - [name]).uniq.join(" ")) - else - el.remove_attribute("class") - end - end - self - end - - ATTR_RE = %r!\[ *(?:(@)([\w\(\)-]+)|([\w\(\)-]+\(\))) *([~\!\|\*$\^=]*) *'?"?([^\]'"]*)'?"? *\]!i - BRACK_RE = %r!(\[) *([^\]]*) *\]+!i - FUNC_RE = %r!(:)?([a-zA-Z0-9\*_-]*)\( *[\"']?([^ \)]*?)['\"]? *\)! - CUST_RE = %r!(:)([a-zA-Z0-9\*_-]*)()! - CATCH_RE = %r!([:\.#]*)([a-zA-Z0-9\*_-]+)! - - def self.filter(nodes, expr, truth = true) - until expr.empty? - _, *m = *expr.match(/^(?:#{ATTR_RE}|#{BRACK_RE}|#{FUNC_RE}|#{CUST_RE}|#{CATCH_RE})/) - break unless _ - - expr = $' - m.compact! - if m[0] == '@' - m[0] = "@#{m.slice!(2,1)}" - end - - if m[0] == '[' && m[1] =~ /^\d+$/ - m = [":", "nth", m[1].to_i-1] - end - - if m[0] == ":" && m[1] == "not" - nodes, = Elements.filter(nodes, m[2], false) - elsif "#{m[0]}#{m[1]}" =~ /^(:even|:odd)$/ - new_nodes = [] - nodes.each_with_index {|n,i| new_nodes.push(n) if (i % 2 == (m[1] == "even" ? 0 : 1)) } - nodes = new_nodes - elsif "#{m[0]}#{m[1]}" =~ /^(:first|:last)$/ - nodes = [nodes.send(m[1])] - else - meth = "filter[#{m[0]}#{m[1]}]" unless m[0].empty? - if meth and Traverse.method_defined? meth - args = m[2..-1] - else - meth = "filter[#{m[0]}]" - if Traverse.method_defined? meth - args = m[1..-1] - end - end - i = -1 - nodes = Elements[*nodes.find_all do |x| - i += 1 - x.send(meth, *([*args] + [i])) ? truth : !truth - end] - end - end - [nodes, expr] - end - - # Given two elements, attempt to gather an Elements array of everything between - # (and including) those two elements. - def self.expand(ele1, ele2, excl=false) - ary = [] - offset = excl ? -1 : 0 - - if ele1 and ele2 - # let's quickly take care of siblings - if ele1.parent == ele2.parent - ary = ele1.parent.children[ele1.node_position..(ele2.node_position+offset)] - else - # find common parent - p, ele1_p = ele1, [ele1] - ele1_p.unshift p while p.respond_to?(:parent) and p = p.parent - p, ele2_p = ele2, [ele2] - ele2_p.unshift p while p.respond_to?(:parent) and p = p.parent - common_parent = ele1_p.zip(ele2_p).select { |p1, p2| p1 == p2 }.flatten.last - - child = nil - if ele1 == common_parent - child = ele2 - elsif ele2 == common_parent - child = ele1 - end - - if child - ary = common_parent.children[0..(child.node_position+offset)] - end - end - end - - return Elements[*ary] - end - - def filter(expr) - nodes, = Elements.filter(self, expr) - nodes - end - - def not(expr) - if expr.is_a? Traverse - nodes = self - [expr] - else - nodes, = Elements.filter(self, expr, false) - end - nodes - end - - private - def copy_node(node, l) - l.instance_variables.each do |iv| - node.instance_variable_set(iv, l.instance_variable_get(iv)) - end - end - - end - - module Traverse - def self.filter(tok, &blk) - define_method("filter[#{tok.is_a?(String) ? tok : tok.inspect}]", &blk) - end - - filter '' do |name,i| - name == '*' || (self.respond_to?(:name) && self.name.downcase == name.downcase) - end - - filter '#' do |id,i| - self.elem? and get_attribute('id').to_s == id - end - - filter '.' do |name,i| - self.elem? and classes.include? name - end - - filter :lt do |num,i| - self.position < num.to_i - end - - filter :gt do |num,i| - self.position > num.to_i - end - - nth = proc { |num,i| self.position == num.to_i } - nth_first = proc { |*a| self.position == 0 } - nth_last = proc { |*a| self == parent.children_of_type(self.name).last } - - filter :nth, &nth - filter :eq, &nth - filter ":nth-of-type", &nth - - filter :first, &nth_first - filter ":first-of-type", &nth_first - - filter :last, &nth_last - filter ":last-of-type", &nth_last - - filter :even do |num,i| - self.position % 2 == 0 - end - - filter :odd do |num,i| - self.position % 2 == 1 - end - - filter ':first-child' do |i| - self == parent.containers.first - end - - filter ':nth-child' do |arg,i| - case arg - when 'even'; (parent.containers.index(self) + 1) % 2 == 0 - when 'odd'; (parent.containers.index(self) + 1) % 2 == 1 - else self == (parent.containers[arg.to_i + 1]) - end - end - - filter ":last-child" do |i| - self == parent.containers.last - end - - filter ":nth-last-child" do |arg,i| - self == parent.containers[-1-arg.to_i] - end - - filter ":nth-last-of-type" do |arg,i| - self == parent.children_of_type(self.name)[-1-arg.to_i] - end - - filter ":only-of-type" do |arg,i| - parent.children_of_type(self.name).length == 1 - end - - filter ":only-child" do |arg,i| - parent.containers.length == 1 - end - - filter :parent do - containers.length > 0 - end - - filter :empty do - containers.length == 0 - end - - filter :root do - self.is_a? Hpricot::Doc - end - - filter 'text' do - self.text? - end - - filter 'comment' do - self.comment? - end - - filter :contains do |arg, ignore| - html.include? arg - end - - - - pred_procs = - {'text()' => proc { |ele, *_| ele.inner_text.strip }, - '@' => proc { |ele, attr, *_| ele.get_attribute(attr).to_s if ele.elem? }} - - oper_procs = - {'=' => proc { |a,b| a == b }, - '!=' => proc { |a,b| a != b }, - '~=' => proc { |a,b| a.split(/\s+/).include?(b) }, - '|=' => proc { |a,b| a =~ /^#{Regexp::quote b}(-|$)/ }, - '^=' => proc { |a,b| a.index(b) == 0 }, - '$=' => proc { |a,b| a =~ /#{Regexp::quote b}$/ }, - '*=' => proc { |a,b| idx = a.index(b) }} - - pred_procs.each do |pred_n, pred_f| - oper_procs.each do |oper_n, oper_f| - filter "#{pred_n}#{oper_n}" do |*a| - qual = pred_f[self, *a] - oper_f[qual, a[-2]] if qual - end - end - end - - filter 'text()' do |val,i| - !self.inner_text.strip.empty? - end - - filter '@' do |attr,val,i| - self.elem? and has_attribute? attr - end - - filter '[' do |val,i| - self.elem? and search(val).length > 0 - end - - end -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/htmlinfo.rb b/vendor/gems/hpricot-0.6/lib/hpricot/htmlinfo.rb deleted file mode 100644 index 951ce17..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/htmlinfo.rb +++ /dev/null @@ -1,672 +0,0 @@ -module Hpricot -# The code below is auto-generated. Don't edit manually. - # :stopdoc: - NamedCharacters = -{"AElig"=>198, "Aacute"=>193, "Acirc"=>194, "Agrave"=>192, "Alpha"=>913, - "Aring"=>197, "Atilde"=>195, "Auml"=>196, "Beta"=>914, "Ccedil"=>199, - "Chi"=>935, "Dagger"=>8225, "Delta"=>916, "ETH"=>208, "Eacute"=>201, - "Ecirc"=>202, "Egrave"=>200, "Epsilon"=>917, "Eta"=>919, "Euml"=>203, - "Gamma"=>915, "Iacute"=>205, "Icirc"=>206, "Igrave"=>204, "Iota"=>921, - "Iuml"=>207, "Kappa"=>922, "Lambda"=>923, "Mu"=>924, "Ntilde"=>209, "Nu"=>925, - "OElig"=>338, "Oacute"=>211, "Ocirc"=>212, "Ograve"=>210, "Omega"=>937, - "Omicron"=>927, "Oslash"=>216, "Otilde"=>213, "Ouml"=>214, "Phi"=>934, - "Pi"=>928, "Prime"=>8243, "Psi"=>936, "Rho"=>929, "Scaron"=>352, "Sigma"=>931, - "THORN"=>222, "Tau"=>932, "Theta"=>920, "Uacute"=>218, "Ucirc"=>219, - "Ugrave"=>217, "Upsilon"=>933, "Uuml"=>220, "Xi"=>926, "Yacute"=>221, - "Yuml"=>376, "Zeta"=>918, "aacute"=>225, "acirc"=>226, "acute"=>180, - "aelig"=>230, "agrave"=>224, "alefsym"=>8501, "alpha"=>945, "amp"=>38, - "and"=>8743, "ang"=>8736, "apos"=>39, "aring"=>229, "asymp"=>8776, - "atilde"=>227, "auml"=>228, "bdquo"=>8222, "beta"=>946, "brvbar"=>166, - "bull"=>8226, "cap"=>8745, "ccedil"=>231, "cedil"=>184, "cent"=>162, - "chi"=>967, "circ"=>710, "clubs"=>9827, "cong"=>8773, "copy"=>169, - "crarr"=>8629, "cup"=>8746, "curren"=>164, "dArr"=>8659, "dagger"=>8224, - "darr"=>8595, "deg"=>176, "delta"=>948, "diams"=>9830, "divide"=>247, - "eacute"=>233, "ecirc"=>234, "egrave"=>232, "empty"=>8709, "emsp"=>8195, - "ensp"=>8194, "epsilon"=>949, "equiv"=>8801, "eta"=>951, "eth"=>240, - "euml"=>235, "euro"=>8364, "exist"=>8707, "fnof"=>402, "forall"=>8704, - "frac12"=>189, "frac14"=>188, "frac34"=>190, "frasl"=>8260, "gamma"=>947, - "ge"=>8805, "gt"=>62, "hArr"=>8660, "harr"=>8596, "hearts"=>9829, - "hellip"=>8230, "iacute"=>237, "icirc"=>238, "iexcl"=>161, "igrave"=>236, - "image"=>8465, "infin"=>8734, "int"=>8747, "iota"=>953, "iquest"=>191, - "isin"=>8712, "iuml"=>239, "kappa"=>954, "lArr"=>8656, "lambda"=>955, - "lang"=>9001, "laquo"=>171, "larr"=>8592, "lceil"=>8968, "ldquo"=>8220, - "le"=>8804, "lfloor"=>8970, "lowast"=>8727, "loz"=>9674, "lrm"=>8206, - "lsaquo"=>8249, "lsquo"=>8216, "lt"=>60, "macr"=>175, "mdash"=>8212, - "micro"=>181, "middot"=>183, "minus"=>8722, "mu"=>956, "nabla"=>8711, - "nbsp"=>160, "ndash"=>8211, "ne"=>8800, "ni"=>8715, "not"=>172, "notin"=>8713, - "nsub"=>8836, "ntilde"=>241, "nu"=>957, "oacute"=>243, "ocirc"=>244, - "oelig"=>339, "ograve"=>242, "oline"=>8254, "omega"=>969, "omicron"=>959, - "oplus"=>8853, "or"=>8744, "ordf"=>170, "ordm"=>186, "oslash"=>248, - "otilde"=>245, "otimes"=>8855, "ouml"=>246, "para"=>182, "part"=>8706, - "permil"=>8240, "perp"=>8869, "phi"=>966, "pi"=>960, "piv"=>982, - "plusmn"=>177, "pound"=>163, "prime"=>8242, "prod"=>8719, "prop"=>8733, - "psi"=>968, "quot"=>34, "rArr"=>8658, "radic"=>8730, "rang"=>9002, - "raquo"=>187, "rarr"=>8594, "rceil"=>8969, "rdquo"=>8221, "real"=>8476, - "reg"=>174, "rfloor"=>8971, "rho"=>961, "rlm"=>8207, "rsaquo"=>8250, - "rsquo"=>8217, "sbquo"=>8218, "scaron"=>353, "sdot"=>8901, "sect"=>167, - "shy"=>173, "sigma"=>963, "sigmaf"=>962, "sim"=>8764, "spades"=>9824, - "sub"=>8834, "sube"=>8838, "sum"=>8721, "sup"=>8835, "sup1"=>185, "sup2"=>178, - "sup3"=>179, "supe"=>8839, "szlig"=>223, "tau"=>964, "there4"=>8756, - "theta"=>952, "thetasym"=>977, "thinsp"=>8201, "thorn"=>254, "tilde"=>732, - "times"=>215, "trade"=>8482, "uArr"=>8657, "uacute"=>250, "uarr"=>8593, - "ucirc"=>251, "ugrave"=>249, "uml"=>168, "upsih"=>978, "upsilon"=>965, - "uuml"=>252, "weierp"=>8472, "xi"=>958, "yacute"=>253, "yen"=>165, - "yuml"=>255, "zeta"=>950, "zwj"=>8205, "zwnj"=>8204} - - - NamedCharactersPattern = /\A(?-mix:AElig|Aacute|Acirc|Agrave|Alpha|Aring|Atilde|Auml|Beta|Ccedil|Chi|Dagger|Delta|ETH|Eacute|Ecirc|Egrave|Epsilon|Eta|Euml|Gamma|Iacute|Icirc|Igrave|Iota|Iuml|Kappa|Lambda|Mu|Ntilde|Nu|OElig|Oacute|Ocirc|Ograve|Omega|Omicron|Oslash|Otilde|Ouml|Phi|Pi|Prime|Psi|Rho|Scaron|Sigma|THORN|Tau|Theta|Uacute|Ucirc|Ugrave|Upsilon|Uuml|Xi|Yacute|Yuml|Zeta|aacute|acirc|acute|aelig|agrave|alefsym|alpha|amp|and|ang|apos|aring|asymp|atilde|auml|bdquo|beta|brvbar|bull|cap|ccedil|cedil|cent|chi|circ|clubs|cong|copy|crarr|cup|curren|dArr|dagger|darr|deg|delta|diams|divide|eacute|ecirc|egrave|empty|emsp|ensp|epsilon|equiv|eta|eth|euml|euro|exist|fnof|forall|frac12|frac14|frac34|frasl|gamma|ge|gt|hArr|harr|hearts|hellip|iacute|icirc|iexcl|igrave|image|infin|int|iota|iquest|isin|iuml|kappa|lArr|lambda|lang|laquo|larr|lceil|ldquo|le|lfloor|lowast|loz|lrm|lsaquo|lsquo|lt|macr|mdash|micro|middot|minus|mu|nabla|nbsp|ndash|ne|ni|not|notin|nsub|ntilde|nu|oacute|ocirc|oelig|ograve|oline|omega|omicron|oplus|or|ordf|ordm|oslash|otilde|otimes|ouml|para|part|permil|perp|phi|pi|piv|plusmn|pound|prime|prod|prop|psi|quot|rArr|radic|rang|raquo|rarr|rceil|rdquo|real|reg|rfloor|rho|rlm|rsaquo|rsquo|sbquo|scaron|sdot|sect|shy|sigma|sigmaf|sim|spades|sub|sube|sum|sup|sup1|sup2|sup3|supe|szlig|tau|there4|theta|thetasym|thinsp|thorn|tilde|times|trade|uArr|uacute|uarr|ucirc|ugrave|uml|upsih|upsilon|uuml|weierp|xi|yacute|yen|yuml|zeta|zwj|zwnj)\z/ - - ElementContent = -{"h6"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "object"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "param", "pre", "q", - "s", "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "dl"=>["dd", "dt"], - "p"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "acronym"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "code"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "ul"=>["li"], - "tt"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "label"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "form"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "q"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "thead"=>["tr"], - "area"=>:EMPTY, - "td"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "title"=>[], - "dir"=>["li"], - "s"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "ol"=>["li"], - "hr"=>:EMPTY, - "applet"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "param", "pre", "q", - "s", "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "table"=>["caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr"], - "legend"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "cite"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "a"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "html"=> - ["a", "abbr", "acronym", "address", "applet", "b", "base", "basefont", "bdo", - "big", "blockquote", "body", "br", "button", "center", "cite", "code", - "dfn", "dir", "div", "dl", "em", "fieldset", "font", "form", "h1", "h2", - "h3", "h4", "h5", "h6", "head", "hr", "i", "iframe", "img", "input", - "isindex", "kbd", "label", "map", "menu", "noframes", "noscript", "object", - "ol", "p", "pre", "q", "s", "samp", "script", "select", "small", "span", - "strike", "strong", "sub", "sup", "table", "textarea", "title", "tt", "u", - "ul", "var"], - "u"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "blockquote"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "center"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "b"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "base"=>:EMPTY, - "th"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "link"=>:EMPTY, - "var"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "samp"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "div"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "textarea"=>[], - "pre"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "head"=>["base", "isindex", "title"], - "span"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "br"=>:EMPTY, - "script"=>:CDATA, - "noframes"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "style"=>:CDATA, - "meta"=>:EMPTY, - "dt"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "option"=>[], - "kbd"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "big"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "tfoot"=>["tr"], - "sup"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "bdo"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "isindex"=>:EMPTY, - "dfn"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "fieldset"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "legend", - "map", "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "em"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "font"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "tbody"=>["tr"], - "noscript"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "li"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "col"=>:EMPTY, - "small"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "dd"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "i"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "menu"=>["li"], - "strong"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "basefont"=>:EMPTY, - "img"=>:EMPTY, - "optgroup"=>["option"], - "map"=> - ["address", "area", "blockquote", "center", "dir", "div", "dl", "fieldset", - "form", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "isindex", "menu", - "noframes", "noscript", "ol", "p", "pre", "table", "ul"], - "h1"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "address"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "p", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "sub"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "param"=>:EMPTY, - "input"=>:EMPTY, - "h2"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "abbr"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "h3"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "strike"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "body"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "ins"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "button"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "h4"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "select"=>["optgroup", "option"], - "caption"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "colgroup"=>["col"], - "tr"=>["td", "th"], - "del"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"], - "h5"=> - ["a", "abbr", "acronym", "applet", "b", "basefont", "bdo", "big", "br", - "button", "cite", "code", "dfn", "em", "font", "i", "iframe", "img", - "input", "kbd", "label", "map", "object", "q", "s", "samp", "script", - "select", "small", "span", "strike", "strong", "sub", "sup", "textarea", - "tt", "u", "var"], - "iframe"=> - ["a", "abbr", "acronym", "address", "applet", "b", "basefont", "bdo", "big", - "blockquote", "br", "button", "center", "cite", "code", "dfn", "dir", "div", - "dl", "em", "fieldset", "font", "form", "h1", "h2", "h3", "h4", "h5", "h6", - "hr", "i", "iframe", "img", "input", "isindex", "kbd", "label", "map", - "menu", "noframes", "noscript", "object", "ol", "p", "pre", "q", "s", - "samp", "script", "select", "small", "span", "strike", "strong", "sub", - "sup", "table", "textarea", "tt", "u", "ul", "var"]} - - ElementInclusions = -{"head"=>["link", "meta", "object", "script", "style"], "body"=>["del", "ins"]} - - ElementExclusions = -{"button"=> - ["a", "button", "fieldset", "form", "iframe", "input", "isindex", "label", - "select", "textarea"], - "a"=>["a"], - "dir"=> - ["address", "blockquote", "center", "dir", "div", "dl", "fieldset", "form", - "h1", "h2", "h3", "h4", "h5", "h6", "hr", "isindex", "menu", "noframes", - "noscript", "ol", "p", "pre", "table", "ul"], - "title"=>["link", "meta", "object", "script", "style"], - "pre"=> - ["applet", "basefont", "big", "font", "img", "object", "small", "sub", - "sup"], - "form"=>["form"], - "menu"=> - ["address", "blockquote", "center", "dir", "div", "dl", "fieldset", "form", - "h1", "h2", "h3", "h4", "h5", "h6", "hr", "isindex", "menu", "noframes", - "noscript", "ol", "p", "pre", "table", "ul"], - "label"=>["label"]} - - OmittedAttrName = -{"h6"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "object"=> - {"bottom"=>"align", "declare"=>"declare", "left"=>"align", "ltr"=>"dir", - "middle"=>"align", "right"=>"align", "rtl"=>"dir", "top"=>"align"}, - "dl"=>{"compact"=>"compact", "ltr"=>"dir", "rtl"=>"dir"}, - "p"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "acronym"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "code"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "ul"=> - {"circle"=>"type", "compact"=>"compact", "disc"=>"type", "ltr"=>"dir", - "rtl"=>"dir", "square"=>"type"}, - "tt"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "label"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "form"=>{"get"=>"method", "ltr"=>"dir", "post"=>"method", "rtl"=>"dir"}, - "q"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "thead"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "middle"=>"valign", "right"=>"align", "rtl"=>"dir", "top"=>"valign"}, - "area"=> - {"circle"=>"shape", "default"=>"shape", "ltr"=>"dir", "nohref"=>"nohref", - "poly"=>"shape", "rect"=>"shape", "rtl"=>"dir"}, - "td"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "col"=>"scope", "colgroup"=>"scope", "justify"=>"align", - "left"=>"align", "ltr"=>"dir", "middle"=>"valign", "nowrap"=>"nowrap", - "right"=>"align", "row"=>"scope", "rowgroup"=>"scope", "rtl"=>"dir", - "top"=>"valign"}, - "title"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "dir"=>{"compact"=>"compact", "ltr"=>"dir", "rtl"=>"dir"}, - "s"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "ol"=>{"compact"=>"compact", "ltr"=>"dir", "rtl"=>"dir"}, - "hr"=> - {"center"=>"align", "left"=>"align", "ltr"=>"dir", "noshade"=>"noshade", - "right"=>"align", "rtl"=>"dir"}, - "applet"=> - {"bottom"=>"align", "left"=>"align", "middle"=>"align", "right"=>"align", - "top"=>"align"}, - "table"=> - {"above"=>"frame", "all"=>"rules", "below"=>"frame", "border"=>"frame", - "box"=>"frame", "center"=>"align", "cols"=>"rules", "groups"=>"rules", - "hsides"=>"frame", "left"=>"align", "lhs"=>"frame", "ltr"=>"dir", - "none"=>"rules", "rhs"=>"frame", "right"=>"align", "rows"=>"rules", - "rtl"=>"dir", "void"=>"frame", "vsides"=>"frame"}, - "legend"=> - {"bottom"=>"align", "left"=>"align", "ltr"=>"dir", "right"=>"align", - "rtl"=>"dir", "top"=>"align"}, - "cite"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "a"=> - {"circle"=>"shape", "default"=>"shape", "ltr"=>"dir", "poly"=>"shape", - "rect"=>"shape", "rtl"=>"dir"}, - "html"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "u"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "blockquote"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "center"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "b"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "th"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "col"=>"scope", "colgroup"=>"scope", "justify"=>"align", - "left"=>"align", "ltr"=>"dir", "middle"=>"valign", "nowrap"=>"nowrap", - "right"=>"align", "row"=>"scope", "rowgroup"=>"scope", "rtl"=>"dir", - "top"=>"valign"}, - "link"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "var"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "samp"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "div"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "textarea"=> - {"disabled"=>"disabled", "ltr"=>"dir", "readonly"=>"readonly", "rtl"=>"dir"}, - "pre"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "head"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "span"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "br"=>{"all"=>"clear", "left"=>"clear", "none"=>"clear", "right"=>"clear"}, - "script"=>{"defer"=>"defer"}, - "noframes"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "style"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "meta"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "dt"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "option"=> - {"disabled"=>"disabled", "ltr"=>"dir", "rtl"=>"dir", "selected"=>"selected"}, - "kbd"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "big"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "tfoot"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "middle"=>"valign", "right"=>"align", "rtl"=>"dir", "top"=>"valign"}, - "sup"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "bdo"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "isindex"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "dfn"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "fieldset"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "em"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "font"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "tbody"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "middle"=>"valign", "right"=>"align", "rtl"=>"dir", "top"=>"valign"}, - "noscript"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "li"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "col"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "middle"=>"valign", "right"=>"align", "rtl"=>"dir", "top"=>"valign"}, - "small"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "dd"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "i"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "menu"=>{"compact"=>"compact", "ltr"=>"dir", "rtl"=>"dir"}, - "strong"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "img"=> - {"bottom"=>"align", "ismap"=>"ismap", "left"=>"align", "ltr"=>"dir", - "middle"=>"align", "right"=>"align", "rtl"=>"dir", "top"=>"align"}, - "optgroup"=>{"disabled"=>"disabled", "ltr"=>"dir", "rtl"=>"dir"}, - "map"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "address"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "h1"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "sub"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "param"=>{"data"=>"valuetype", "object"=>"valuetype", "ref"=>"valuetype"}, - "input"=> - {"bottom"=>"align", "button"=>"type", "checkbox"=>"type", - "checked"=>"checked", "disabled"=>"disabled", "file"=>"type", - "hidden"=>"type", "image"=>"type", "ismap"=>"ismap", "left"=>"align", - "ltr"=>"dir", "middle"=>"align", "password"=>"type", "radio"=>"type", - "readonly"=>"readonly", "reset"=>"type", "right"=>"align", "rtl"=>"dir", - "submit"=>"type", "text"=>"type", "top"=>"align"}, - "h2"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "abbr"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "h3"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "strike"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "body"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "ins"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "button"=> - {"button"=>"type", "disabled"=>"disabled", "ltr"=>"dir", "reset"=>"type", - "rtl"=>"dir", "submit"=>"type"}, - "h4"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "select"=> - {"disabled"=>"disabled", "ltr"=>"dir", "multiple"=>"multiple", "rtl"=>"dir"}, - "caption"=> - {"bottom"=>"align", "left"=>"align", "ltr"=>"dir", "right"=>"align", - "rtl"=>"dir", "top"=>"align"}, - "colgroup"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "middle"=>"valign", "right"=>"align", "rtl"=>"dir", "top"=>"valign"}, - "tr"=> - {"baseline"=>"valign", "bottom"=>"valign", "center"=>"align", - "char"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "middle"=>"valign", "right"=>"align", "rtl"=>"dir", "top"=>"valign"}, - "del"=>{"ltr"=>"dir", "rtl"=>"dir"}, - "h5"=> - {"center"=>"align", "justify"=>"align", "left"=>"align", "ltr"=>"dir", - "right"=>"align", "rtl"=>"dir"}, - "iframe"=> - {"0"=>"frameborder", "1"=>"frameborder", "auto"=>"scrolling", - "bottom"=>"align", "left"=>"align", "middle"=>"align", "no"=>"scrolling", - "right"=>"align", "top"=>"align", "yes"=>"scrolling"}} - - # :startdoc: -# The code above is auto-generated. Don't edit manually. -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/inspect.rb b/vendor/gems/hpricot-0.6/lib/hpricot/inspect.rb deleted file mode 100644 index 0af4d35..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/inspect.rb +++ /dev/null @@ -1,107 +0,0 @@ -require 'pp' - -module Hpricot - # :stopdoc: - class Elements - def pretty_print(q) - q.object_group(self) { super } - end - alias inspect pretty_print_inspect - end - - class Doc - def pretty_print(q) - q.object_group(self) { @children.each {|elt| q.breakable; q.pp elt } } - end - alias inspect pretty_print_inspect - end - - class Elem - def pretty_print(q) - if empty? - q.group(1, '{emptyelem', '}') { - q.breakable; q.pp @stag - } - else - q.group(1, "{elem", "}") { - q.breakable; q.pp @stag - if @children - @children.each {|elt| q.breakable; q.pp elt } - end - if @etag - q.breakable; q.pp @etag - end - } - end - end - alias inspect pretty_print_inspect - end - - module Leaf - def pretty_print(q) - q.group(1, '{', '}') { - q.text self.class.name.sub(/.*::/,'').downcase - if rs = @raw_string - rs.scan(/[^\r\n]*(?:\r\n?|\n|[^\r\n]\z)/) {|line| - q.breakable - q.pp line - } - elsif self.respond_to? :to_s - q.breakable - q.text self.to_s - end - } - end - alias inspect pretty_print_inspect - end - - class STag - def pretty_print(q) - q.group(1, '<', '>') { - q.text @name - - if @raw_attributes - @raw_attributes.each {|n, t| - q.breakable - if t - q.text "#{n}=\"#{Hpricot.uxs(t)}\"" - else - q.text n - end - } - end - } - end - alias inspect pretty_print_inspect - end - - class ETag - def pretty_print(q) - q.group(1, '') { - q.text @name - } - end - alias inspect pretty_print_inspect - end - - class Text - def pretty_print(q) - q.text @content.dump - end - end - - class BogusETag - def pretty_print(q) - q.group(1, '{', '}') { - q.text self.class.name.sub(/.*::/,'').downcase - if rs = @raw_string - q.breakable - q.text rs - else - q.text "" - end - } - end - end - # :startdoc: -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/modules.rb b/vendor/gems/hpricot-0.6/lib/hpricot/modules.rb deleted file mode 100644 index e96b922..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/modules.rb +++ /dev/null @@ -1,37 +0,0 @@ -module Hpricot - class Name; include Hpricot end - class Context; include Hpricot end - - # :stopdoc: - module Tag; include Hpricot end - class STag; include Tag end - class ETag; include Tag end - # :startdoc: - - module Node; include Hpricot end - module Container; include Node end - class Doc; include Container end - class Elem; include Container end - module Leaf; include Node end - class Text; include Leaf end - class XMLDecl; include Leaf end - class DocType; include Leaf end - class ProcIns; include Leaf end - class Comment; include Leaf end - class BogusETag; include Leaf end - - module Traverse end - module Container::Trav; include Traverse end - module Leaf::Trav; include Traverse end - class Doc; module Trav; include Container::Trav end; include Trav end - class Elem; module Trav; include Container::Trav end; include Trav end - class Text; module Trav; include Leaf::Trav end; include Trav end - class XMLDecl; module Trav; include Leaf::Trav end; include Trav end - class DocType; module Trav; include Leaf::Trav end; include Trav end - class ProcIns; module Trav; include Leaf::Trav end; include Trav end - class Comment; module Trav; include Leaf::Trav end; include Trav end - class BogusETag; module Trav; include Leaf::Trav end; include Trav end - - class Error < StandardError; end -end - diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/parse.rb b/vendor/gems/hpricot-0.6/lib/hpricot/parse.rb deleted file mode 100644 index 47ed217..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/parse.rb +++ /dev/null @@ -1,297 +0,0 @@ -require 'hpricot/htmlinfo' - -def Hpricot(input = nil, opts = {}, &blk) - Hpricot.parse(input, opts, &blk) -end - -module Hpricot - # Exception class used for any errors related to deficiencies in the system when - # handling the character encodings of a document. - class EncodingError < StandardError; end - - # Hpricot.parse parses input and return a document tree. - # represented by Hpricot::Doc. - def Hpricot.parse(input = nil, opts = {}, &blk) - Doc.new(make(input, opts, &blk)) - end - - # Hpricot::XML parses input, disregarding all the HTML rules - # and returning a document tree. - def Hpricot.XML(input, opts = {}) - Doc.new(make(input, opts.merge(:xml => true))) - end - - # :stopdoc: - - def Hpricot.make(input = nil, opts = {}, &blk) - opts = {:fixup_tags => false}.merge(opts) - unless input or blk - raise ArgumentError, "An Hpricot document must be built from an input source (a String) or a block." - end - - conv = opts[:xml] ? :to_s : :downcase - - fragment = - if input - case opts[:encoding] - when nil - when 'utf-8' - unless defined? Encoding::Character::UTF8 - raise EncodingError, "The ruby-character-encodings library could not be found for utf-8 mode." - end - else - raise EncodingError, "No encoding option `#{opts[:encoding]}' is available." - end - - if opts[:xhtml_strict] - opts[:fixup_tags] = true - end - - stack = [[nil, nil, [], [], [], []]] - Hpricot.scan(input) do |token| - if stack.last[5] == :CDATA and ![:procins, :comment, :cdata].include?(token[0]) and - !(token[0] == :etag and token[1].casecmp(stack.last[0]).zero?) - token[0] = :text - token[1] = token[3] if token[3] - end - - if !opts[:xml] and token[0] == :emptytag - token[1] = token[1].send(conv) - if ElementContent[token[1].downcase] != :EMPTY - token[0] = :stag - end - end - - # TODO: downcase instead when parsing attributes? - if !opts[:xml] and token[2].is_a?(Hash) - token[2] = token[2].inject({}) { |hsh,(k,v)| hsh[k.downcase] = v; hsh } - end - - case token[0] - when :stag - case opts[:encoding] when 'utf-8' - token.map! { |str| u(str) if str.is_a? String } - end - - stagname = token[0] = token[1] = token[1].send(conv) - if ElementContent[stagname] == :EMPTY and !opts[:xml] - token[0] = :emptytag - stack.last[2] << token - else - unless opts[:xml] - if opts[:fixup_tags] - # obey the tag rules set up by the current element - if ElementContent.has_key? stagname - trans = nil - (stack.length-1).downto(0) do |i| - untags = stack[i][5] - break unless untags.include? stagname - # puts "** ILLEGAL #{stagname} IN #{stack[i][0]}" - trans = i - end - if trans.to_i > 1 - eles = stack.slice!(trans..-1) - stack.last[2] += eles - # puts "** TRANSPLANTED #{stagname} TO #{stack.last[0]}" - end - elsif opts[:xhtml_strict] - token[2] = {'class' => stagname} - stagname = token[0] = "div" - end - end - - # setup tag rules for inside this element - if ElementContent[stagname] == :CDATA - uncontainable_tags = :CDATA - elsif opts[:fixup_tags] - possible_tags = ElementContent[stagname] - excluded_tags, included_tags = stack.last[3..4] - if possible_tags - excluded_tags = excluded_tags | (ElementExclusions[stagname] || []) - included_tags = included_tags | (ElementInclusions[stagname] || []) - containable_tags = (possible_tags | included_tags) - excluded_tags - uncontainable_tags = ElementContent.keys - containable_tags - else - # If the tagname is unknown, it is assumed that any element - # except excluded can be contained. - uncontainable_tags = excluded_tags - end - end - end - unless opts[:xml] - case token[2] when Hash - token[2] = token[2].inject({}) { |hsh,(k,v)| hsh[k.downcase] = v; hsh } - end - end - stack << [stagname, token, [], excluded_tags, included_tags, uncontainable_tags] - end - when :etag - etagname = token[0] = token[1].send(conv) - if opts[:xhtml_strict] and not ElementContent.has_key? etagname - etagname = token[0] = "div" - end - matched_elem = nil - (stack.length-1).downto(0) do |i| - stagname, = stack[i] - if stagname == etagname - matched_elem = stack[i] - stack[i][1] += token - eles = stack.slice!((i+1)..-1) - stack.last[2] += eles - break - end - end - unless matched_elem - stack.last[2] << [:bogus_etag, token.first, token.last] - else - ele = stack.pop - stack.last[2] << ele - end - when :text - l = stack.last[2].last - if l and l[0] == :text - l[1] += token[1] - else - stack.last[2] << token - end - else - stack.last[2] << token - end - end - - while 1 < stack.length - ele = stack.pop - stack.last[2] << ele - end - - structure_list = stack[0][2] - structure_list.map {|s| build_node(s, opts) } - elsif blk - Hpricot.build(&blk).children - end - end - - def Hpricot.build_node(structure, opts = {}) - case structure[0] - when String - tagname, _, attrs, sraw, _, _, _, eraw = structure[1] - children = structure[2] - etag = eraw && ETag.parse(tagname, eraw) - stag = STag.parse(tagname, attrs, sraw, true) - if !children.empty? || etag - Elem.new(stag, - children.map {|c| build_node(c, opts) }, - etag) - else - Elem.new(stag) - end - when :text - Text.parse_pcdata(structure[1]) - when :emptytag - Elem.new(STag.parse(structure[1], structure[2], structure[3], false)) - when :bogus_etag - BogusETag.parse(structure[1], structure[2]) - when :xmldecl - XMLDecl.parse(structure[2], structure[3]) - when :doctype - if opts[:xhtml_strict] - structure[2]['system_id'] = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" - structure[2]['public_id'] = "-//W3C//DTD XHTML 1.0 Strict//EN" - end - DocType.parse(structure[1], structure[2], structure[3]) - when :procins - ProcIns.parse(structure[1]) - when :comment - Comment.parse(structure[1]) - when :cdata_content - Text.parse_cdata_content(structure[1]) - when :cdata - Text.parse_cdata_section(structure[1]) - else - raise Exception, "[bug] unknown structure: #{structure.inspect}" - end - end - - def STag.parse(qname, attrs, raw_string, is_stag) - result = STag.new(qname, attrs) - result.raw_string = raw_string - result - end - - def ETag.parse(qname, raw_string) - result = self.new(qname) - result.raw_string = raw_string - result - end - - def BogusETag.parse(qname, raw_string) - result = self.new(qname) - result.raw_string = raw_string - result - end - - def Text.parse_pcdata(raw_string) - result = Text.new(raw_string) - result - end - - def Text.parse_cdata_content(raw_string) - result = CData.new(raw_string) - result - end - - def Text.parse_cdata_section(content) - result = CData.new(content) - result - end - - def XMLDecl.parse(attrs, raw_string) - attrs ||= {} - version = attrs['version'] - encoding = attrs['encoding'] - case attrs['standalone'] - when 'yes' - standalone = true - when 'no' - standalone = false - else - standalone = nil - end - - result = XMLDecl.new(version, encoding, standalone) - result.raw_string = raw_string - result - end - - def DocType.parse(root_element_name, attrs, raw_string) - if attrs - public_identifier = attrs['public_id'] - system_identifier = attrs['system_id'] - end - - root_element_name = root_element_name.downcase - - result = DocType.new(root_element_name, public_identifier, system_identifier) - result.raw_string = raw_string - result - end - - def ProcIns.parse(raw_string) - _, target, content = *raw_string.match(/\A<\?(\S+)\s+(.+)/m) - result = ProcIns.new(target, content) - result - end - - def Comment.parse(content) - result = Comment.new(content) - result - end - - module Pat - NameChar = /[-A-Za-z0-9._:]/ - Name = /[A-Za-z_:]#{NameChar}*/ - Nmtoken = /#{NameChar}+/ - end - - # :startdoc: -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/tag.rb b/vendor/gems/hpricot-0.6/lib/hpricot/tag.rb deleted file mode 100644 index 7fe5479..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/tag.rb +++ /dev/null @@ -1,228 +0,0 @@ -module Hpricot - # :stopdoc: - - class Doc - attr_accessor :children - def initialize(children = []) - @children = children ? children.each { |c| c.parent = self } : [] - end - def output(out, opts = {}) - @children.each do |n| - n.output(out, opts) - end - out - end - def altered!; end - end - - class BaseEle - attr_accessor :raw_string, :parent - def html_quote(str) - "\"" + str.gsub('"', '\\"') + "\"" - end - def if_output(opts) - if opts[:preserve] and not @raw_string.nil? - @raw_string - else - yield opts - end - end - def pathname; self.name end - def altered! - @raw_string = nil - end - def self.alterable(*fields) - attr_accessor(*fields) - fields.each do |f| - define_method("#{f}=") do |v| - altered! - instance_variable_set("@#{f}", v) - end - end - end - end - - class Elem - attr_accessor :stag, :etag, :children - def initialize(stag, children=nil, etag=nil) - @stag, @etag = stag, etag - @children = children ? children.each { |c| c.parent = self } : [] - end - def empty?; @children.empty? end - [:name, :raw_attributes, :parent, :altered!].each do |m| - [m, "#{m}="].each { |m2| define_method(m2) { |*a| [@etag, @stag].inject { |_,t| t.send(m2, *a) if t and t.respond_to?(m2) } } } - end - def attributes - if raw_attributes - raw_attributes.inject({}) do |hsh, (k, v)| - hsh[k] = Hpricot.uxs(v) - hsh - end - end - end - def to_plain_text - if self.name == 'br' - "\n" - elsif self.name == 'p' - "\n\n" + super + "\n\n" - elsif self.name == 'a' and self.has_attribute?('href') - "#{super} [#{self['href']}]" - elsif self.name == 'img' and self.has_attribute?('src') - "[img:#{self['src']}]" - else - super - end - end - def pathname; self.name end - def output(out, opts = {}) - if empty? and ElementContent[@stag.name] == :EMPTY - @stag.output(out, opts.merge(:style => :empty)) - else - @stag.output(out, opts) - @children.each { |n| n.output(out, opts) } - if @etag - @etag.output(out, opts) - elsif !opts[:preserve] - ETag.new(@stag.name).output(out, opts) - end - end - out - end - end - - class STag < BaseEle - def initialize(name, attributes=nil) - @name = name.to_s - @raw_attributes = attributes || {} - end - alterable :name, :raw_attributes - def attributes_as_html - if @raw_attributes - @raw_attributes.map do |aname, aval| - " #{aname}" + - (aval ? "=\"#{aval}\"" : "") - end.join - end - end - def output(out, opts = {}) - out << - if_output(opts) do - "<#{@name}#{attributes_as_html}" + - (opts[:style] == :empty ? " /" : "") + - ">" - end - end - end - - class ETag < BaseEle - def initialize(qualified_name) - @name = qualified_name.to_s - end - alterable :name - def output(out, opts = {}) - out << - if_output(opts) do - "" - end - end - end - - class BogusETag < ETag - def output(out, opts = {}); out << if_output(opts) { '' }; end - end - - class Text < BaseEle - def initialize(text) - @content = text - end - alterable :content - def pathname; "text()" end - def to_s - Hpricot.uxs(@content) - end - alias_method :inner_text, :to_s - alias_method :to_plain_text, :to_s - def output(out, opts = {}) - out << - if_output(opts) do - @content - end - end - end - - class CData < Text - alias_method :to_s, :content - alias_method :to_plain_text, :content - def output(out, opts = {}) - out << - if_output(opts) do - "" - end - end - end - - class XMLDecl < BaseEle - def initialize(version, encoding, standalone) - @version, @encoding, @standalone = version, encoding, standalone - end - alterable :version, :encoding, :standalone - def pathname; "xmldecl()" end - def output(out, opts = {}) - out << - if_output(opts) do - "" - end - end - end - - class DocType < BaseEle - def initialize(target, pubid, sysid) - @target, @public_id, @system_id = target, pubid, sysid - end - alterable :target, :public_id, :system_id - def pathname; "doctype()" end - def output(out, opts = {}) - out << - if_output(opts) do - "" - end - end - end - - class ProcIns < BaseEle - def initialize(target, content) - @target, @content = target, content - end - def pathname; "procins()" end - alterable :target, :content - def output(out, opts = {}) - out << - if_output(opts) do - "" - end - end - end - - class Comment < BaseEle - def initialize(content) - @content = content - end - def pathname; "comment()" end - alterable :content - def output(out, opts = {}) - out << - if_output(opts) do - "" - end - end - end - - # :startdoc: -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/tags.rb b/vendor/gems/hpricot-0.6/lib/hpricot/tags.rb deleted file mode 100644 index 6c2db5f..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/tags.rb +++ /dev/null @@ -1,164 +0,0 @@ -module Hpricot - - FORM_TAGS = [ :form, :input, :select, :textarea ] - SELF_CLOSING_TAGS = [ :base, :meta, :link, :hr, :br, :param, :img, :area, :input, :col ] - - # Common sets of attributes. - AttrCore = [:id, :class, :style, :title] - AttrI18n = [:lang, 'xml:lang'.intern, :dir] - AttrEvents = [:onclick, :ondblclick, :onmousedown, :onmouseup, :onmouseover, :onmousemove, - :onmouseout, :onkeypress, :onkeydown, :onkeyup] - AttrFocus = [:accesskey, :tabindex, :onfocus, :onblur] - AttrHAlign = [:align, :char, :charoff] - AttrVAlign = [:valign] - Attrs = AttrCore + AttrI18n + AttrEvents - - # All the tags and attributes from XHTML 1.0 Strict - class XHTMLStrict - class << self - attr_accessor :tags, :tagset, :forms, :self_closing, :doctype - end - @doctype = ["-//W3C//DTD XHTML 1.0 Strict//EN", "DTD/xhtml1-strict.dtd"] - @tagset = { - :html => AttrI18n + [:id, :xmlns], - :head => AttrI18n + [:id, :profile], - :title => AttrI18n + [:id], - :base => [:href, :id], - :meta => AttrI18n + [:id, :http, :name, :content, :scheme, 'http-equiv'.intern], - :link => Attrs + [:charset, :href, :hreflang, :type, :rel, :rev, :media], - :style => AttrI18n + [:id, :type, :media, :title, 'xml:space'.intern], - :script => [:id, :charset, :type, :src, :defer, 'xml:space'.intern], - :noscript => Attrs, - :body => Attrs + [:onload, :onunload], - :div => Attrs, - :p => Attrs, - :ul => Attrs, - :ol => Attrs, - :li => Attrs, - :dl => Attrs, - :dt => Attrs, - :dd => Attrs, - :address => Attrs, - :hr => Attrs, - :pre => Attrs + ['xml:space'.intern], - :blockquote => Attrs + [:cite], - :ins => Attrs + [:cite, :datetime], - :del => Attrs + [:cite, :datetime], - :a => Attrs + AttrFocus + [:charset, :type, :name, :href, :hreflang, :rel, :rev, :shape, :coords], - :span => Attrs, - :bdo => AttrCore + AttrEvents + [:lang, 'xml:lang'.intern, :dir], - :br => AttrCore, - :em => Attrs, - :strong => Attrs, - :dfn => Attrs, - :code => Attrs, - :samp => Attrs, - :kbd => Attrs, - :var => Attrs, - :cite => Attrs, - :abbr => Attrs, - :acronym => Attrs, - :q => Attrs + [:cite], - :sub => Attrs, - :sup => Attrs, - :tt => Attrs, - :i => Attrs, - :b => Attrs, - :big => Attrs, - :small => Attrs, - :object => Attrs + [:declare, :classid, :codebase, :data, :type, :codetype, :archive, :standby, :height, :width, :usemap, :name, :tabindex], - :param => [:id, :name, :value, :valuetype, :type], - :img => Attrs + [:src, :alt, :longdesc, :height, :width, :usemap, :ismap], - :map => AttrI18n + AttrEvents + [:id, :class, :style, :title, :name], - :area => Attrs + AttrFocus + [:shape, :coords, :href, :nohref, :alt], - :form => Attrs + [:action, :method, :enctype, :onsubmit, :onreset, :accept, :accept], - :label => Attrs + [:for, :accesskey, :onfocus, :onblur], - :input => Attrs + AttrFocus + [:type, :name, :value, :checked, :disabled, :readonly, :size, :maxlength, :src, :alt, :usemap, :onselect, :onchange, :accept], - :select => Attrs + [:name, :size, :multiple, :disabled, :tabindex, :onfocus, :onblur, :onchange], - :optgroup => Attrs + [:disabled, :label], - :option => Attrs + [:selected, :disabled, :label, :value], - :textarea => Attrs + AttrFocus + [:name, :rows, :cols, :disabled, :readonly, :onselect, :onchange], - :fieldset => Attrs, - :legend => Attrs + [:accesskey], - :button => Attrs + AttrFocus + [:name, :value, :type, :disabled], - :table => Attrs + [:summary, :width, :border, :frame, :rules, :cellspacing, :cellpadding], - :caption => Attrs, - :colgroup => Attrs + AttrHAlign + AttrVAlign + [:span, :width], - :col => Attrs + AttrHAlign + AttrVAlign + [:span, :width], - :thead => Attrs + AttrHAlign + AttrVAlign, - :tfoot => Attrs + AttrHAlign + AttrVAlign, - :tbody => Attrs + AttrHAlign + AttrVAlign, - :tr => Attrs + AttrHAlign + AttrVAlign, - :th => Attrs + AttrHAlign + AttrVAlign + [:abbr, :axis, :headers, :scope, :rowspan, :colspan], - :td => Attrs + AttrHAlign + AttrVAlign + [:abbr, :axis, :headers, :scope, :rowspan, :colspan], - :h1 => Attrs, - :h2 => Attrs, - :h3 => Attrs, - :h4 => Attrs, - :h5 => Attrs, - :h6 => Attrs - } - - @tags = @tagset.keys - @forms = @tags & FORM_TAGS - @self_closing = @tags & SELF_CLOSING_TAGS - end - - # Additional tags found in XHTML 1.0 Transitional - class XHTMLTransitional - class << self - attr_accessor :tags, :tagset, :forms, :self_closing, :doctype - end - @doctype = ["-//W3C//DTD XHTML 1.0 Transitional//EN", "DTD/xhtml1-transitional.dtd"] - @tagset = XHTMLStrict.tagset.merge \ - :strike => Attrs, - :center => Attrs, - :dir => Attrs + [:compact], - :noframes => Attrs, - :basefont => [:id, :size, :color, :face], - :u => Attrs, - :menu => Attrs + [:compact], - :iframe => AttrCore + [:longdesc, :name, :src, :frameborder, :marginwidth, :marginheight, :scrolling, :align, :height, :width], - :font => AttrCore + AttrI18n + [:size, :color, :face], - :s => Attrs, - :applet => AttrCore + [:codebase, :archive, :code, :object, :alt, :name, :width, :height, :align, :hspace, :vspace], - :isindex => AttrCore + AttrI18n + [:prompt] - - # Additional attributes found in XHTML 1.0 Transitional - { :script => [:language], - :a => [:target], - :td => [:bgcolor, :nowrap, :width, :height], - :p => [:align], - :h5 => [:align], - :h3 => [:align], - :li => [:type, :value], - :div => [:align], - :pre => [:width], - :body => [:background, :bgcolor, :text, :link, :vlink, :alink], - :ol => [:type, :compact, :start], - :h4 => [:align], - :h2 => [:align], - :object => [:align, :border, :hspace, :vspace], - :img => [:name, :align, :border, :hspace, :vspace], - :link => [:target], - :legend => [:align], - :dl => [:compact], - :input => [:align], - :h6 => [:align], - :hr => [:align, :noshade, :size, :width], - :base => [:target], - :ul => [:type, :compact], - :br => [:clear], - :form => [:name, :target], - :area => [:target], - :h1 => [:align] - }.each do |k, v| - @tagset[k] += v - end - - @tags = @tagset.keys - @forms = @tags & FORM_TAGS - @self_closing = @tags & SELF_CLOSING_TAGS - end - -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/traverse.rb b/vendor/gems/hpricot-0.6/lib/hpricot/traverse.rb deleted file mode 100644 index 4ccb853..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/traverse.rb +++ /dev/null @@ -1,821 +0,0 @@ -require 'hpricot/elements' -require 'uri' - -module Hpricot - module Traverse - # Is this object the enclosing HTML or XML document? - def doc?() Doc::Trav === self end - # Is this object an HTML or XML element? - def elem?() Elem::Trav === self end - # Is this object an HTML text node? - def text?() Text::Trav === self end - # Is this object an XML declaration? - def xmldecl?() XMLDecl::Trav === self end - # Is this object a doctype tag? - def doctype?() DocType::Trav === self end - # Is this object an XML processing instruction? - def procins?() ProcIns::Trav === self end - # Is this object a comment? - def comment?() Comment::Trav === self end - # Is this object a stranded end tag? - def bogusetag?() BogusETag::Trav === self end - - # Builds an HTML string from this node and its contents. - # If you need to write to a stream, try calling output(io) - # as a method on this object. - def to_html - output("") - end - alias_method :to_s, :to_html - - # Attempts to preserve the original HTML of the document, only - # outputing new tags for elements which have changed. - def to_original_html - output("", :preserve => true) - end - - def index(name) - i = 0 - return i if name == "*" - children.each do |x| - return i if (x.respond_to?(:name) and name == x.name) or - (x.text? and name == "text()") - i += 1 - end - -1 - end - - # Puts together an array of neighboring nodes based on their proximity - # to this node. So, for example, to get the next node, you could use - # nodes_at(1). Or, to get the previous node, use nodes_at(1). - # - # This method also accepts ranges and sets of numbers. - # - # ele.nodes_at(-3..-1, 1..3) # gets three nodes before and three after - # ele.nodes_at(1, 5, 7) # gets three nodes at offsets below the current node - # ele.nodes_at(0, 5..6) # the current node and two others - def nodes_at(*pos) - sib = parent.children - i, si = 0, sib.index(self) - pos.map! do |r| - if r.is_a?(Range) and r.begin.is_a?(String) - r = Range.new(parent.index(r.begin)-si, parent.index(r.end)-si, r.exclude_end?) - end - r - end - p pos - Elements[* - sib.select do |x| - sel = - case i - si when *pos - true - end - i += 1 - sel - end - ] - end - - # Returns the node neighboring this node to the south: just below it. - # This method includes text nodes and comments and such. - def next - sib = parent.children - sib[sib.index(self) + 1] if parent - end - alias_method :next_node, :next - - # Returns to node neighboring this node to the north: just above it. - # This method includes text nodes and comments and such. - def previous - sib = parent.children - x = sib.index(self) - 1 - sib[x] if sib and x >= 0 - end - alias_method :previous_node, :previous - - # Find all preceding nodes. - def preceding - sibs = parent.children - si = sibs.index(self) - return Elements[*sibs[0...si]] - end - - # Find all nodes which follow the current one. - def following - sibs = parent.children - si = sibs.index(self) + 1 - return Elements[*sibs[si...sibs.length]] - end - - # Adds elements immediately after this element, contained in the +html+ string. - def after(html = nil, &blk) - parent.insert_after(Hpricot.make(html, &blk), self) - end - - # Adds elements immediately before this element, contained in the +html+ string. - def before(html = nil, &blk) - parent.insert_before(Hpricot.make(html, &blk), self) - end - - - # Replace this element and its contents with the nodes contained - # in the +html+ string. - def swap(html = nil, &blk) - parent.altered! - parent.replace_child(self, Hpricot.make(html, &blk)) - end - - def get_subnode(*indexes) - n = self - indexes.each {|index| - n = n.get_subnode_internal(index) - } - n - end - - # Builds a string from the text contained in this node. All - # HTML elements are removed. - def to_plain_text - if respond_to? :children - children.map { |x| x.to_plain_text }.join.strip.gsub(/\n{2,}/, "\n\n") - end - end - - # Builds a string from the text contained in this node. All - # HTML elements are removed. - def inner_text - if respond_to? :children - children.map { |x| x.inner_text }.join - end - end - alias_method :innerText, :inner_text - - # Builds an HTML string from the contents of this node. - def html(inner = nil, &blk) - if inner or blk - altered! - case inner - when Array - self.children = inner - else - self.children = Hpricot.make(inner, &blk) - end - reparent self.children - else - if respond_to? :children - children.map { |x| x.output("") }.join - end - end - end - alias_method :inner_html, :html - alias_method :innerHTML, :inner_html - - # Inserts new contents into the current node, based on - # the HTML contained in string +inner+. - def inner_html=(inner) - html(inner || []) - end - alias_method :innerHTML=, :inner_html= - - def reparent(nodes) - altered! - [*nodes].each { |e| e.parent = self } - end - private :reparent - - def clean_path(path) - path.gsub(/^\s+|\s+$/, '') - end - - # Builds a unique XPath string for this node, from the - # root of the document containing it. - def xpath - if elem? and has_attribute? 'id' - "//#{self.name}[@id='#{get_attribute('id')}']" - else - sim, id = 0, 0, 0 - parent.children.each do |e| - id = sim if e == self - sim += 1 if e.pathname == self.pathname - end - p = File.join(parent.xpath, self.pathname) - p += "[#{id+1}]" if sim >= 2 - p - end - end - - # Builds a unique CSS string for this node, from the - # root of the document containing it. - def css_path - if elem? and has_attribute? 'id' - "##{get_attribute('id')}" - else - sim, i, id = 0, 0, 0 - parent.children.each do |e| - id = sim if e == self - sim += 1 if e.pathname == self.pathname - end - p = parent.css_path - p = p ? "#{p} > #{self.pathname}" : self.pathname - p += ":nth(#{id})" if sim >= 2 - p - end - end - - def node_position - parent.children.index(self) - end - - def position - parent.children_of_type(self.pathname).index(self) - end - - # Searches this node for all elements matching - # the CSS or XPath +expr+. Returns an Elements array - # containing the matching nodes. If +blk+ is given, it - # is used to iterate through the matching set. - def search(expr, &blk) - if Range === expr - return Elements.expand(at(expr.begin), at(expr.end), expr.exclude_end?) - end - last = nil - nodes = [self] - done = [] - expr = expr.to_s - hist = [] - until expr.empty? - expr = clean_path(expr) - expr.gsub!(%r!^//!, '') - - case expr - when %r!^/?\.\.! - last = expr = $' - nodes.map! { |node| node.parent } - when %r!^[>/]\s*! - last = expr = $' - nodes = Elements[*nodes.map { |node| node.children if node.respond_to? :children }.flatten.compact] - when %r!^\+! - last = expr = $' - nodes.map! do |node| - siblings = node.parent.children - siblings[siblings.index(node)+1] - end - nodes.compact! - when %r!^~! - last = expr = $' - nodes.map! do |node| - siblings = node.parent.children - siblings[(siblings.index(node)+1)..-1] - end - nodes.flatten! - when %r!^[|,]! - last = expr = " #$'" - nodes.shift if nodes.first == self - done += nodes - nodes = [self] - else - m = expr.match(%r!^([#.]?)([a-z0-9\\*_-]*)!i).to_a - after = $' - mt = after[%r!:[a-z0-9\\*_-]+!i, 0] - oop = false - if mt and not (mt == ":not" or Traverse.method_defined? "filter[#{mt}]") - after = $' - m[2] += mt - expr = after - end - if m[1] == '#' - oid = get_element_by_id(m[2]) - nodes = oid ? [oid] : [] - expr = after - else - m[2] = "*" if after =~ /^\(\)/ || m[2] == "" || m[1] == "." - ret = [] - nodes.each do |node| - case m[2] - when '*' - node.traverse_element { |n| ret << n } - else - if node.respond_to? :get_elements_by_tag_name - ret += [*node.get_elements_by_tag_name(m[2])] - [*(node unless last)] - end - end - end - nodes = ret - end - last = nil - end - - hist << expr - break if hist[-1] == hist[-2] - nodes, expr = Elements.filter(nodes, expr) - end - nodes = done + nodes.flatten.uniq - if blk - nodes.each(&blk) - self - else - Elements[*nodes] - end - end - alias_method :/, :search - - # Find the first matching node for the CSS or XPath - # +expr+ string. - def at(expr) - search(expr).first - end - alias_method :%, :at - - # +traverse_element+ traverses elements in the tree. - # It yields elements in depth first order. - # - # If _names_ are empty, it yields all elements. - # If non-empty _names_ are given, it should be list of universal names. - # - # A nested element is yielded in depth first order as follows. - # - # t = Hpricot('') - # t.traverse_element("a", "c") {|e| p e} - # # => - # {elem {elem {emptyelem } } {emptyelem } } - # {emptyelem } - # {emptyelem } - # - # Universal names are specified as follows. - # - # t = Hpricot(<<'End') - # - # - # - # - # End - # t.traverse_element("{http://www.w3.org/1999/xhtml}meta") {|e| p e} - # # => - # {emptyelem <{http://www.w3.org/1999/xhtml}meta name="robots" content="index,nofollow">} - # {emptyelem <{http://www.w3.org/1999/xhtml}meta name="author" content="Who am I?">} - # - def traverse_element(*names, &block) # :yields: element - if names.empty? - traverse_all_element(&block) - else - name_set = {} - names.each {|n| name_set[n] = true } - traverse_some_element(name_set, &block) - end - nil - end - - # Find children of a given +tag_name+. - # - # ele.children_of_type('p') - # #=> [...array of paragraphs...] - # - def children_of_type(tag_name) - if respond_to? :children - children.find_all do |x| - x.respond_to?(:pathname) && x.pathname == tag_name - end - end - end - - end - - module Container::Trav - # Return all children of this node which can contain other - # nodes. This is a good way to get all HTML elements which - # aren't text, comment, doctype or processing instruction nodes. - def containers - children.grep(Container::Trav) - end - - # Returns the container node neighboring this node to the south: just below it. - # By "container" node, I mean: this method does not find text nodes or comments or cdata or any of that. - # See Hpricot::Traverse#next_node if you need to hunt out all kinds of nodes. - def next_sibling - sib = parent.containers - sib[sib.index(self) + 1] if parent - end - - # Returns the container node neighboring this node to the north: just above it. - # By "container" node, I mean: this method does not find text nodes or comments or cdata or any of that. - # See Hpricot::Traverse#previous_node if you need to hunt out all kinds of nodes. - def previous_sibling - sib = parent.containers - x = sib.index(self) - 1 - sib[x] if sib and x >= 0 - end - - # Find all preceding sibling elements. Like the other "sibling" methods, this weeds - # out text and comment nodes. - def preceding_siblings() - sibs = parent.containers - si = sibs.index(self) - return Elements[*sibs[0...si]] - end - - # Find sibling elements which follow the current one. Like the other "sibling" methods, this weeds - # out text and comment nodes. - def following_siblings() - sibs = parent.containers - si = sibs.index(self) + 1 - return Elements[*sibs[si...sibs.length]] - end - - # Puts together an array of neighboring sibling elements based on their proximity - # to this element. - # - # This method accepts ranges and sets of numbers. - # - # ele.siblings_at(-3..-1, 1..3) # gets three elements before and three after - # ele.siblings_at(1, 5, 7) # gets three elements at offsets below the current element - # ele.siblings_at(0, 5..6) # the current element and two others - # - # Like the other "sibling" methods, this doesn't find text and comment nodes. - # Use nodes_at to include those nodes. - def siblings_at(*pos) - sib = parent.containers - i, si = 0, sib.index(self) - Elements[* - sib.select do |x| - sel = case i - si when *pos - true - end - i += 1 - sel - end - ] - end - - # Replace +old+, a child of the current node, with +new+ node. - def replace_child(old, new) - reparent new - children[children.index(old), 1] = [*new] - end - - # Insert +nodes+, an array of HTML elements or a single element, - # before the node +ele+, a child of the current node. - def insert_before(nodes, ele) - case nodes - when Array - nodes.each { |n| insert_before(n, ele) } - else - reparent nodes - children[children.index(ele) || 0, 0] = nodes - end - end - - # Insert +nodes+, an array of HTML elements or a single element, - # after the node +ele+, a child of the current node. - def insert_after(nodes, ele) - case nodes - when Array - nodes.reverse_each { |n| insert_after(n, ele) } - else - reparent nodes - idx = children.index(ele) - children[idx ? idx + 1 : children.length, 0] = nodes - end - end - - # +each_child+ iterates over each child. - def each_child(&block) # :yields: child_node - children.each(&block) - nil - end - - # +each_child_with_index+ iterates over each child. - def each_child_with_index(&block) # :yields: child_node, index - children.each_with_index(&block) - nil - end - - # +find_element+ searches an element which universal name is specified by - # the arguments. - # It returns nil if not found. - def find_element(*names) - traverse_element(*names) {|e| return e } - nil - end - - # Returns a list of CSS classes to which this element belongs. - def classes - get_attribute('class').to_s.strip.split(/\s+/) - end - - def get_element_by_id(id) - traverse_all_element do |ele| - if ele.elem? and eid = ele.get_attribute('id') - return ele if eid.to_s == id - end - end - nil - end - - def get_elements_by_tag_name(*a) - list = Elements[] - traverse_element(*a.map { |tag| [tag, "{http://www.w3.org/1999/xhtml}#{tag}"] }.flatten) do |e| - list << e - end - list - end - - def each_hyperlink_attribute - traverse_element( - '{http://www.w3.org/1999/xhtml}a', - '{http://www.w3.org/1999/xhtml}area', - '{http://www.w3.org/1999/xhtml}link', - '{http://www.w3.org/1999/xhtml}img', - '{http://www.w3.org/1999/xhtml}object', - '{http://www.w3.org/1999/xhtml}q', - '{http://www.w3.org/1999/xhtml}blockquote', - '{http://www.w3.org/1999/xhtml}ins', - '{http://www.w3.org/1999/xhtml}del', - '{http://www.w3.org/1999/xhtml}form', - '{http://www.w3.org/1999/xhtml}input', - '{http://www.w3.org/1999/xhtml}head', - '{http://www.w3.org/1999/xhtml}base', - '{http://www.w3.org/1999/xhtml}script') {|elem| - case elem.name - when %r{\{http://www.w3.org/1999/xhtml\}(?:base|a|area|link)\z}i - attrs = ['href'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:img)\z}i - attrs = ['src', 'longdesc', 'usemap'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:object)\z}i - attrs = ['classid', 'codebase', 'data', 'usemap'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:q|blockquote|ins|del)\z}i - attrs = ['cite'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:form)\z}i - attrs = ['action'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:input)\z}i - attrs = ['src', 'usemap'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:head)\z}i - attrs = ['profile'] - when %r{\{http://www.w3.org/1999/xhtml\}(?:script)\z}i - attrs = ['src', 'for'] - end - attrs.each {|attr| - if hyperlink = elem.get_attribute(attr) - yield elem, attr, hyperlink - end - } - } - end - private :each_hyperlink_attribute - - # +each_hyperlink_uri+ traverses hyperlinks such as HTML href attribute - # of A element. - # - # It yields Hpricot::Text and URI for each hyperlink. - # - # The URI objects are created with a base URI which is given by - # HTML BASE element or the argument ((|base_uri|)). - # +each_hyperlink_uri+ doesn't yields href of the BASE element. - def each_hyperlink_uri(base_uri=nil) # :yields: hyperlink, uri - base_uri = URI.parse(base_uri) if String === base_uri - links = [] - each_hyperlink_attribute {|elem, attr, hyperlink| - if %r{\{http://www.w3.org/1999/xhtml\}(?:base)\z}i =~ elem.name - base_uri = URI.parse(hyperlink.to_s) - else - links << hyperlink - end - } - if base_uri - links.each {|hyperlink| yield hyperlink, base_uri + hyperlink.to_s } - else - links.each {|hyperlink| yield hyperlink, URI.parse(hyperlink.to_s) } - end - end - - # +each_hyperlink+ traverses hyperlinks such as HTML href attribute - # of A element. - # - # It yields Hpricot::Text. - # - # Note that +each_hyperlink+ yields HTML href attribute of BASE element. - def each_hyperlink # :yields: text - links = [] - each_hyperlink_attribute {|elem, attr, hyperlink| - yield hyperlink - } - end - - # +each_uri+ traverses hyperlinks such as HTML href attribute - # of A element. - # - # It yields URI for each hyperlink. - # - # The URI objects are created with a base URI which is given by - # HTML BASE element or the argument ((|base_uri|)). - def each_uri(base_uri=nil) # :yields: URI - each_hyperlink_uri(base_uri) {|hyperlink, uri| yield uri } - end - end - - # :stopdoc: - module Doc::Trav - def traverse_all_element(&block) - children.each {|c| c.traverse_all_element(&block) } - end - def xpath - "/" - end - def css_path - nil - end - end - - module Elem::Trav - def traverse_all_element(&block) - yield self - children.each {|c| c.traverse_all_element(&block) } - end - end - - module Leaf::Trav - def traverse_all_element - yield self - end - end - - module Doc::Trav - def traverse_some_element(name_set, &block) - children.each {|c| c.traverse_some_element(name_set, &block) } - end - end - - module Elem::Trav - def traverse_some_element(name_set, &block) - yield self if name_set.include? self.name - children.each {|c| c.traverse_some_element(name_set, &block) } - end - end - - module Leaf::Trav - def traverse_some_element(name_set) - end - end - # :startdoc: - - module Traverse - # +traverse_text+ traverses texts in the tree - def traverse_text(&block) # :yields: text - traverse_text_internal(&block) - nil - end - end - - # :stopdoc: - module Container::Trav - def traverse_text_internal(&block) - each_child {|c| c.traverse_text_internal(&block) } - end - end - - module Leaf::Trav - def traverse_text_internal - end - end - - module Text::Trav - def traverse_text_internal - yield self - end - end - # :startdoc: - - module Container::Trav - # +filter+ rebuilds the tree without some components. - # - # node.filter {|descendant_node| predicate } -> node - # loc.filter {|descendant_loc| predicate } -> node - # - # +filter+ yields each node except top node. - # If given block returns false, corresponding node is dropped. - # If given block returns true, corresponding node is retained and - # inner nodes are examined. - # - # +filter+ returns an node. - # It doesn't return location object even if self is location object. - # - def filter(&block) - subst = {} - each_child_with_index {|descendant, i| - if yield descendant - if descendant.elem? - subst[i] = descendant.filter(&block) - else - subst[i] = descendant - end - else - subst[i] = nil - end - } - to_node.subst_subnode(subst) - end - end - - module Doc::Trav - # +title+ searches title and return it as a text. - # It returns nil if not found. - # - # +title+ searchs following information. - # - # - ... in HTML - # - ... in RSS - def title - e = find_element('title', - '{http://www.w3.org/1999/xhtml}title', - '{http://purl.org/rss/1.0/}title', - '{http://my.netscape.com/rdf/simple/0.9/}title') - e && e.extract_text - end - - # +author+ searches author and return it as a text. - # It returns nil if not found. - # - # +author+ searchs following information. - # - # - in HTML - # - in HTML - # - author-name in RSS - # - author-name in RSS - def author - traverse_element('meta', - '{http://www.w3.org/1999/xhtml}meta') {|e| - begin - next unless e.fetch_attr('name').downcase == 'author' - author = e.fetch_attribute('content').strip - return author if !author.empty? - rescue IndexError - end - } - - traverse_element('link', - '{http://www.w3.org/1999/xhtml}link') {|e| - begin - next unless e.fetch_attr('rev').downcase == 'made' - author = e.fetch_attribute('title').strip - return author if !author.empty? - rescue IndexError - end - } - - if channel = find_element('{http://purl.org/rss/1.0/}channel') - channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e| - begin - author = e.extract_text.strip - return author if !author.empty? - rescue IndexError - end - } - channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e| - begin - author = e.extract_text.strip - return author if !author.empty? - rescue IndexError - end - } - end - - nil - end - - end - - module Doc::Trav - def root - es = [] - children.each {|c| es << c if c.elem? } - raise Hpricot::Error, "no element" if es.empty? - raise Hpricot::Error, "multiple top elements" if 1 < es.length - es[0] - end - end - - module Elem::Trav - def has_attribute?(name) - self.raw_attributes && self.raw_attributes.has_key?(name.to_s) - end - def get_attribute(name) - a = self.raw_attributes && self.raw_attributes[name.to_s] - a = Hpricot.uxs(a) if a - a - end - alias_method :[], :get_attribute - def set_attribute(name, val) - altered! - self.raw_attributes ||= {} - self.raw_attributes[name.to_s] = Hpricot.xs(val) - end - alias_method :[]=, :set_attribute - def remove_attribute(name) - name = name.to_s - if has_attribute? name - altered! - self.raw_attributes.delete(name) - end - end - end - -end diff --git a/vendor/gems/hpricot-0.6/lib/hpricot/xchar.rb b/vendor/gems/hpricot-0.6/lib/hpricot/xchar.rb deleted file mode 100644 index 6a5aa4b..0000000 --- a/vendor/gems/hpricot-0.6/lib/hpricot/xchar.rb +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env ruby - -# The XChar library is provided courtesy of Sam Ruby (See -# http://intertwingly.net/stories/2005/09/28/xchar.rb) - -# -------------------------------------------------------------------- - -###################################################################### -module Hpricot - - #################################################################### - # XML Character converter, from Sam Ruby: - # (see http://intertwingly.net/stories/2005/09/28/xchar.rb). - # - module XChar # :nodoc: - - # See - # http://intertwingly.net/stories/2004/04/14/i18n.html#CleaningWindows - # for details. - CP1252 = { # :nodoc: - 128 => 8364, # euro sign - 130 => 8218, # single low-9 quotation mark - 131 => 402, # latin small letter f with hook - 132 => 8222, # double low-9 quotation mark - 133 => 8230, # horizontal ellipsis - 134 => 8224, # dagger - 135 => 8225, # double dagger - 136 => 710, # modifier letter circumflex accent - 137 => 8240, # per mille sign - 138 => 352, # latin capital letter s with caron - 139 => 8249, # single left-pointing angle quotation mark - 140 => 338, # latin capital ligature oe - 142 => 381, # latin capital letter z with caron - 145 => 8216, # left single quotation mark - 146 => 8217, # right single quotation mark - 147 => 8220, # left double quotation mark - 148 => 8221, # right double quotation mark - 149 => 8226, # bullet - 150 => 8211, # en dash - 151 => 8212, # em dash - 152 => 732, # small tilde - 153 => 8482, # trade mark sign - 154 => 353, # latin small letter s with caron - 155 => 8250, # single right-pointing angle quotation mark - 156 => 339, # latin small ligature oe - 158 => 382, # latin small letter z with caron - 159 => 376, # latin capital letter y with diaeresis - } - - # See http://www.w3.org/TR/REC-xml/#dt-chardata for details. - PREDEFINED = { - 34 => '"', # quotation mark - 38 => '&', # ampersand - 60 => '<', # left angle bracket - 62 => '>' # right angle bracket - } - PREDEFINED_U = PREDEFINED.inject({}) { |hsh, (k, v)| hsh[v] = k; hsh } - - # See http://www.w3.org/TR/REC-xml/#charsets for details. - VALID = [ - 0x9, 0xA, 0xD, - (0x20..0xD7FF), - (0xE000..0xFFFD), - (0x10000..0x10FFFF) - ] - end - - class << self - # XML escaped version of chr - def xchr(str) - n = XChar::CP1252[str] || str - case n when *XChar::VALID - XChar::PREDEFINED[n] or (n<128 ? n.chr : "&##{n};") - else - '*' - end - end - - # XML escaped version of to_s - def xs(str) - str.to_s.unpack('U*').map {|n| xchr(n)}.join # ASCII, UTF-8 - rescue - str.to_s.unpack('C*').map {|n| xchr(n)}.join # ISO-8859-1, WIN-1252 - end - - # XML unescape - def uxs(str) - str.to_s. - gsub(/\&\w+;/) { |x| (XChar::PREDEFINED_U[x] || ??).chr }. - gsub(/\&\#(\d+);/) { [$1.to_i].pack("U*") } - end - end -end - diff --git a/vendor/gems/hpricot-0.6/test/files/basic.xhtml b/vendor/gems/hpricot-0.6/test/files/basic.xhtml deleted file mode 100644 index 898f0ea..0000000 --- a/vendor/gems/hpricot-0.6/test/files/basic.xhtml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - Sample XHTML - - - - - -

      Sample XHTML for MouseHole 2.

      -

      Please filter me!

      -

      The third paragraph

      -

      THE FINAL PARAGRAPH

      - - - diff --git a/vendor/gems/hpricot-0.6/test/files/boingboing.html b/vendor/gems/hpricot-0.6/test/files/boingboing.html deleted file mode 100644 index 082a0a8..0000000 --- a/vendor/gems/hpricot-0.6/test/files/boingboing.html +++ /dev/null @@ -1,2266 +0,0 @@ - - - - - - - - - - - Boing Boing: A Directory of Wonderful Things - - - - - - - - - - -
      - - - - - - - - - - -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      Boing Boing
      - - - - - - - -
      -
      - - - - -
      - -

      - Wednesday, June 14, 2006 -

      - - - -

      - Slipstream Science Fiction anthology defies genre conventions -

      - James Patrick Kelly and John Kessel gave a great interview to Sci Fi Weekly about their new anthology, Feeling Very Strange: The Slipstream Anthology. The book has a top-notch table-of-contents, stories that defy genre conventions and make your head spin in a good way. - -
      - -We make the point in our introduction that slipstream isn't really a genre at the moment and may never be one. What it is, in our opinion, is a literary effect--in the same way that horror or comedy are literary effects achieved by many different kinds of dissimilar stories. What is that effect? We borrowed the term cognitive dissonance from the psychologists. When we are presented with two contradictory cognitions--impressions, feelings, beliefs--we experience cognitive dissonance, a kind of psychic discomfort that we normally try to ease by discounting one of the cognitions as false or illusory and promoting the other to reality. But in some cases we aren't well served by this convenient sorting out. -

      -We think that what slipstream stories do is to embrace cognitive dissonance. F. Scott Fitzgerald once said that "The test of a first-rate intelligence is the ability to hold two opposing ideas in mind at the same time and still retain the ability to function." We believe that such an ability is necessary to cope with life in the 21st century and that stories that ask us to exercise that ability are an expression of the zeitgeist. Do you really need a definitive answer as to whether an electron is a wave or a particle? Why? Maybe it's time to make room for uncertainty in contemporary fiction, even if the stories do make you feel very strange. Slipstream may use metafictional techniques to estrange us from consensus reality, they may rewrite history, they may mash up different styles or genres. But that's the point, as we see it. Slipstream has no rules, it has only results. - -
      -

      - -Link - -(via Beyond the Beyond) - -
      -

      posted by - Cory Doctorow at - 03:43:28 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - College kids reportedly taking more smart drugs -

      - High-achieving college kids are reportedly dipping into "brain-steroids" -- drugs like Ritalin and Provigil, which focus attention. No one really knows how widespread this practice is, since it's uncommon for anyone to get busted for peddling smart drugs, and the side-effects of "abuse" are minimal. -

      -This strikes me as the canonical cognitive liberty fight: why shouldn't you be allowed to make an informed decision about what state of mind you'd like to be in? Why will the law allow people to kill brain and liver cells with stupefying booze, but not smart drugs? - -

      -"What was a surprise, though, was the alarming rate of senior business majors who have used" the drugs, he writes. Almost 90 percent reported at least occasional use of "smart pills" at crunch times such as final exams, including Adderall, Ritalin, Strattera and others. Of those, three-quarters did not have a legitimate prescription, obtaining the pills from friends. "We were shocked," Salantrie writes. He says that in his report, he was "attempting to bring to light the secondary market for Adderall" specifically because "most of the university is not aware" of its extent, he says. -
      - -Link - -(via Futurismic) - -
      -

      posted by - Cory Doctorow at - 03:33:51 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - UFO sighting picture photoshopping contest -

      - - -The next Worth1000 photoshopping contest challenges artists to fake UFO-sightings photos. The quality of entries here is a little uneven, but the best of the lot are real gems. - -Link - -
      - -
      -

      posted by - Cory Doctorow at - 03:26:59 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Rube Goldberg machine built out of sticks and stones -

      - - -There's a feature on today's Make video podcast about a giant, elaborate Rube Goldberg machine assembled out of sticks and stones in a forest. The video features some jaw-dropping, Mousetrap-style action, and the use of found forest-floor materials makes it all the more Wile E Coyote. The video features tips on setting up your own woodsy contraption. - - -Link - -
      - -
      -

      posted by - Cory Doctorow at - 02:59:42 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Lampooning the American dismissal of Gitmo suicides -

      - Fafblog today features a scathing, brilliant satirical look at the US characterization of the Guantanamo Bay suicides as an attack on America. Fafblog is consistently the best political satire/commentary on the net, the Web equivalent of Jon Stewart and Stephen Colbert, and they're finally back after a too-long hiatus. The characterization of the Gitmo suicides as an act of terrorism is so ugly and disingenuous that it begged to be punctured. I'm thankful that Fafblog is back to perform that service. - -
      - -Run for your lives - America is under attack! Just days ago three prisoners at Guantanamo Bay committed suicide in a savage assault on America's freedom to not care about prisoner suicides! Oh sure, the "Blame Atrocities First" crowd will tell you these prisoners were "driven to despair," that they "had no rights," that they were "held and tortured without due process or judicial oversight in a nightmarish mockery of justice." But what they won't tell you is that they only committed suicide as part of a diabolical ruse to trick the world into thinking our secret torture camp is the kind of secret torture camp that drives its prisoners to commit suicide! This fiendish attempt to slander the great American institution of the gulag is nothing less than an act of asymmetrical warfare against the United States - a noose is just a suicide bomb with a very small blast radius, people! - and when faced with a terrorist attack, America must respond. Giblets demands immediate retaliatory airstrikes on depressed Muslim torture victims throughout the mideast! -

      -"Oh but Giblets there are dozens of innocent prisoners in Guantanamo" you say because you are a namby-pamby appeasenik who suckles at the teat of terror. Well if these Guantanamo prisoners are so innocent then what are they doing in Guantanamo? Sneaking into our secret military prisons as part of an elaborate plot to make it look like we're holding them in our secret military prisons, that's what! And once they get there they can chain themselves to the floor, break their bones on helpless guards' fists, and waterboard themselves to their heart's content to further their sinister Salafi scheme to sully the reputation of secret American torture facilities everywhere! - -

      - -Link - -
      -

      posted by - Cory Doctorow at - 02:55:02 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Neil Gaiman tribute CD sneak-peek -

      - A new Neil Gaiman tribute CD is coming out in July. One of the tracks is already available -- "Mr Punch" by Future Bible Heroes, and it's a delight. Apparently, Stephin Merritt (from Future Bible Heroes) is also doing a Lemony Snickett-inspired CD in October. - -
      - -Track Listing:
      -1 Rasputina - Coraline
      -2 ThouShaltNot - When Everyone Forgets
      -3 Tapping The Vein - Trader Boy
      -4 Lunascape - Raven Star
      -5 Deine Lakaien - A Fish Called Prince
      -6 Thea Gilmore - Even Gods Do
      -7 Rose Berlin (feat. Curve) - Coraline
      -8 Schandmaul - Magda Treadgolds Märchen
      -9 Hungry Lucy - We Won't Go
      -10 Voltaire w/The Oddz - Come Sweet Death
      -11 Future Bible Heroes - Mr. Punch
      -12 Razed in Black - The Endless
      -13 The Cruxshadows - Wake the White Queen
      -14 Ego Likeness - You Better Leave the Stars Alone
      -15 Azam Ali - The Cold Black Key
      -16 Joachim Witt - Vandemar
      -17 Tori Amos - Sister Named Desire (New Master) -
      -
      - -Link - -(Thanks, Gary!) - -
      -

      posted by - Cory Doctorow at - 02:50:59 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Block DRM license plate -

      - - -Tom spotted this DC license plate, reading BLK DRM. He thinks it's an anti-DRM lobbyist's plate, which is plausible, though with the acronym soup in Washington, it could stand for just about anything. - -Link - -(Thanks, Tom) - -
      - -
      -

      posted by - Cory Doctorow at - 02:43:40 AM - permalink - | blogs' comments - -
      -

      -

      - - -

      - Tuesday, June 13, 2006 -

      - - - -

      - Chairs upholstered with lush photos -

      - - -ClothUK makes easy chairs and other soft furnishings upholstered with fabric that's printed with the lush, oversized photo of your choice. Not cheap, tho! - -Link - -(via Wonderland) - -
      - -
      -

      posted by - Cory Doctorow at - 06:21:37 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Corruptibles: Copyright's tech-fighting supervillains -

      - - -EFF has just launched a new video: The Corruptibles -- the story of Copyright Supervillains who patrol the Broadcast Flag future, blowing up our free and open devices. It's a great, funny viral short, and well worth a watch. - - - -Link - -
      - -
      -

      posted by - Cory Doctorow at - 06:14:53 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - WIPO meets to screw up podcasting, Barcelona, June 21 -

      - The United Nations' World Intellectual Property Organization has called a last-minute meeting on June 21 in Barcelona, out of the normal diplomatic venues to try to ram through the Broadcasting Treaty. This treaty gives broadcasters (not creators or copyright holders) the right to tie up the use of audiovisual material for 50 years after broadcasting it, even if the programs are in the public domain, Creative Commons licensed, or not copyrightable. -

      -The Barcelona meeting brings together lots of latinamerican broadcasters -- who no doubt love the idea of a new monopoly right that they get for free merely for broadcasting a work. Bringing these casters in is a way of undermining the effective opposition to the treaty that's come from countries like Brazil and Chile. -

      -No public interest groups are on the bill to give a counterpoint (of course not -- WIPO is the kind of place where public interest groups' handouts are thrown in the toilets' trashcans). -

      -This meeting is especially deadly, because it looks like they're trying to sneak podcasting back into the treaty, after agreeing to take it out at the last big meeting in Geneva. -

      -The good news is, it's open to the public. If you're a digital rights activist in Barcelona -- or just someone who cares about how big corporations are taking away your rights to use works freely -- then you need to be at this meeting. - -

      -Webcasting will clearly be part of next week's discussions. That much is clear from the title of next week's event: "From the Rome Convention to Podcasting". One of the invited speakers is from Yahoo! Europe, one of the proponents of new rights for webcasters. This, despite the fact that webcasting and simulcasting were taken out of the "traditional" Broadcasting Treaty and put on the slow track last month in response to concerns expressed by the majority of WIPO member states. -

      -The good news: unlike earlier meetings, this one is open to the public, with prior registration requested. So if you care about the proposed treaties and can get to the Barcelona meeting, this is your opportunity to stand up and be counted for the public interest. -

      -If you’re in the U.S., please tell your Congressional representatives to hold hearings on the proposed treaties before it’s too late. And if you need a reminder about the harm that these treaties could wreak on access to knowledge and technological innovation, read Jamie Boyle’s piece in today’s Financial Times. - -

      - -Link -

      -Update: Jamie Boyle has an excellent column that explains how this treaty (which the US is fighting for) would be unconstitutional in the USA. - -
      -

      posted by - Cory Doctorow at - 06:09:34 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - From the Boing Boing archives, circa 1999 -

      - I came across this funny list of "Things to Do," written by "fifth Boing Boinger" Stefan Jones, which was published on the pre-blog version of boingboing.net. - -
      1. Get $25 worth of paper currency from one of those countries where $25 worth of currency fills up two wheel barrows. Divide it into five lots and send them, along with an incomprehensible letter, to the addresses listed in an email chain letter. - -

      2. Build some gigantic rat traps, with wooden bases at least 2' x 3' and baited with an entire blocks of government cheese. Plant the traps, in sprung state, near a local chemical company. Wear giant rat foot shoes while doing this. - -

      3. Get a supply of those little plastic ties used to seal hotel minibars after they are loaded with a full complement of overpriced goodies. Bring them and a supply of useful things (socks, condoms, aspirin) and strange things (McGruff the Crime Dog coloring books, bottles of Moxie, a can of Hormel Calf Brains in Milk Gravy) while travelling. Put the things in the minibar before sealing it up.

      - -Link - -
      -

      posted by - Mark Frauenfelder at - 04:57:07 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Surreal English lessons video from Japan -

      - -Picture 3-10 -Very odd video of Japanese dancing girls and salarymen uttering defensive rebuttals in English. Link (via Sharpeworld) - -
      -

      posted by - Mark Frauenfelder at - 01:44:02 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Sexed robots video -

      - -Here's a video of two adorable, autonomous "sexed robots." - -
       Zlab Zlabpics Sexedmaleandfemale -The sexed robots are autonomous wheeled platforms fitted with nylon genital organs, respectively male and female. They are programmed to explore their environment, occasionally entering a "in heat" mode, where they will try and locate a partner in the same state. If a partner is located, the robots will attempt to mate.
      - - Link NSFW? (via Sharpeworld) - -
      -

      posted by - Mark Frauenfelder at - 01:38:27 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Burroughs' Encyclopaedia of Astounding Facts and Useful Information, 1889 -

      - Manybooks.net, which converts Project Gutenberg titles into useful formats for reading on Palm devics, iPods, and ebook readers, recently made available a fantastic compendium called Burroughs' Encyclopaedia of Astounding Facts and Useful Information, 1889: Universal Assistant and Treasure-House of Information to be Consulted on Every Question That Arises in Everyday Life by Young and Old Alike!. - -

      It's an amazing combination of a proto-Ripley's, a cookbook, etiquette guide, and almanac. - -

      200606131251 - - -WONDERS OF MINUTE WORKMANSHIP. - -

      In the twentieth year of Queen Elizabeth, a blacksmith named Mark Scaliot, made a lock consisting of eleven pieces of iron, steel and brass, all which, together with a key to it, weighed but one grain of gold. He also made a chain of gold, consisting of forty-three links, and, having fastened this to the before-mentioned lock and key, he put the chain about the neck of a flea, which drew them all with ease. All these together, lock and key, chain and flea, weighed only one grain and a half. - -

      Oswaldus Norhingerus, who was more famous even than Scaliot for his minute contrivances, is said to have made 1,600 dishes of turned ivory, all perfect and complete in every part, yet so small, thin and slender, that all of them were included at once in a cup turned out of a pepper-corn of the common size. Johannes Shad, of Mitelbrach, carried this wonderful work with him to Rome, and showed it to Pope Paul V., who saw and counted them all by the help of a pair of spectacles. They were so little as to be almost invisible to the eye. - -

      Johannes Ferrarius, a Jesuit, had in his posession cannons of wood, with their carriages, wheels, and all other military furniture, all of which were also contained in a pepper-corn of the ordinary size.

      - -Link - -
      -

      posted by - Mark Frauenfelder at - 12:57:03 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Door looks like you walk through it -

      - -200606131240 - - -Fukuda’s Automatic Door opens around your body as you pass through it. The idea is to save energy and keep the room clean. Link - -
      -

      posted by - Mark Frauenfelder at - 12:39:56 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - AOL's efforts to keep you from quitting your account -

      - Listen to this recording of a guy who called AOL to try to cancel his account and the AOL jerk who tries to keep him from canceling. Just disgusting. Link (via Digg) - -
      -

      posted by - Mark Frauenfelder at - 12:27:01 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - LA's South Central Farm under police siege right now -

      - The police have closed on South Central Farm, the largest community garden in the USA. The farms were planted after the Rodney King uprising, when the land was given to the neighborhood, and it has been reclaimed and cultivated by 350 families. The city reneged on its promise and sold the land to a developer, who has now moved on it with bulldozers and a riot squad. - -
      -The South Central Farm is currently under attack. An early morning raid began this 5-hour long eviction that is still in process. Trees are being cut down, bulldozers are leveling the families’ food, hundreds of protesters are on site rallying with tears in their eyes as the nation’s largest urban farm is destroyed before them. The L.A.P.D. is on tactical alert as fire ladders and cherry pickers are being brought in to remove the tree-sitters. The 350 families created this oasis 14 years ago in the wake of the 1992 uprising when this land was offered to the community by the then Mayor as a form of mitigation. -
      - - - -Link, Flickr's southcentralfarm tag - -(Thanks to everyone who wrote in with this link) -

      -Update: Elan sez, "the land for the farm was originally taken from Ralph Horowitz through eminent domain with the intension of using it for a trash incinerator. When the incinerator fell through, the city was required to sell it back to the Horowitz (after a ten year period of first refusal)." - -
      -

      posted by - Cory Doctorow at - 11:48:42 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Stephen Hawking writing a kids' book -

      - Stephen Hawking and his daughter are collaborating on a kids' novel that is "a bit like Harry Potter, but without the magic." - -
      -His daughter Lucy said their forthcoming project would be aimed at people like her own eight-year-old son. -

      -"It is a story for children, which explains the wonders of the universe," she said. - - -

      - -Link - -(via Fark) - -
      -

      posted by - Cory Doctorow at - 11:42:15 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - ScienceMatters@Berkeley, June issue -

      - -My new issue of ScienceMatters@Berkeley is online. In this issue: -
       Archives Volume3 Issue21 Images Oster3
      -* Start Your Protein Engines

      -* The New New Math of String Theory

      -* Molecular Rules of Engagement
      -Link - -
      -

      posted by - David Pescovitz at - 11:42:06 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - iPod dock/speakers built into bumwad dispenser -

      - - -This iPod dock and speakers built into a bumwad dispenser isn't as weird as it seems at first blush -- lots of us have a radio in the bathroom; this is a way of listening to your iPod without sacrificing your limited counterspace to an electronics footprint. - -Link - -(via Popgadget) - -
      - -
      -

      posted by - Cory Doctorow at - 11:38:34 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Cory's Someone to Town shortlisted for Canada's sf book award -

      - -I'm pleased as punch to say that my novel, Someone Comes to Town, Someone Leave Town has been shortlisted for the Sunburst, Canada's national science fiction award. The Sunburst jury honored me with the award in 2004 for my short story collection A Place So Foreign and Eight More and this is a double-helping of delight. -

      -Someone Comes to Town... comes out in a new trade paperback edition this week, too! - -Link - -
      - - -
      -

      posted by - Cory Doctorow at - 10:59:36 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - People are happier when they're older? -

      - A new study suggests that people may think that the happiest days of their lives are when they're young, but that belief doesn't jibe with reality. University of Michigan and VA Ann Arbor healthcare Systems researchers polled 540 adults in the 21-40 age group and 60+ age group. They rated their own happiness right now, predicted how happy they'd be in the future, and also how happy they think others are in those age groups. The results were published in the Journal of Happiness Studies, which is a delightful name for a scientific publication. From the University of Michigan Health System: -
      "Overall, people got it wrong, believing that most people become less happy as they age, when in fact this study and others have shown that people tend to become happier over time," says lead author Heather Lacey, Ph.D., a VA postdoctoral fellow and member of the U-M Medical School's Center for Behavioral and Decision Sciences in Medicine. "Not only do younger people believe that older people are less happy, but older people believe they and others must have been happier 'back then'. Neither belief is accurate..."

      - -"People often believe that happiness is a matter of circumstance, that if something good happens, they will experience long-lasting happiness, or if something bad happens, they will experience long-term misery," (says co-author Peter Ubel). "But instead, people's happiness results more from their underlying emotional resources -- resources that appear to grow with age. People get better at managing life's ups and downs, and the result is that as they age, they become happier -- even though their objective circumstances, such as their health, decline."
      -Link - -
      -

      posted by - David Pescovitz at - 10:58:28 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - The incredible sound-mimicking lyrebird -

      - -Lyrebird -Here's a video clip of a male Australian lyrebird, which sings complex songs to attract mates. Lyrebirds' songs are composed of sounds they hear, including sounds from machines, such as a camera's shutter mechanism and film drive, a car alarm, and logging equipment. This bird is like a tape recorder. Link (thanks, Coop!) - -
      -

      posted by - Mark Frauenfelder at - 10:53:26 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Aymara people's "reversed" concept of time -

      - The Aymara, an indigenous group in the Andes highlands, have a concept of time that's opposite our own spatial metaphor. A new study by cognitive scientists explains how the Aymara consider the past to be ahead and the future behind them. According to the study, this is the first documented culture that seems not to have mapped time with the properties of space "as if (the future) were in front of ego and the past in back." From UCSD: -
      The linguistic evidence seems, on the surface, clear: The Aymara language recruits “nayra,†the basic word for “eye,†“front†or “sight,†to mean “past†and recruits “qhipa,†the basic word for “back†or “behind,†to mean “future.†So, for example, the expression “nayra mara†– which translates in meaning to “last year†– can be literally glossed as “front year..."

      The Aymara, especially the elderly who didn’t command a grammatically correct Spanish, indicated space behind themselves when speaking of the future – by thumbing or waving over their shoulders – and indicated space in front of themselves when speaking of the past – by sweeping forward with their hands and arms, close to their bodies for now or the near past and farther out, to the full extent of the arm, for ancient times. In other words, they used gestures identical to the familiar ones – only exactly in reverse. -

      -“These findings suggest that cognition of such everyday abstractions as time is at least partly a cultural phenomenon,†(University of California, San Diego professor Rafael) Nunez said. “That we construe time on a front-back axis, treating future and past as though they were locations ahead and behind, is strongly influenced by the way we move, by our dorsoventral morphology, by our frontal binocular vision, etc. Ultimately, had we been blob-ish amoeba-like creatures, we wouldn’t have had the means to create and bring forth these concepts. -

      -“But the Aymara counter-example makes plain that there is room for cultural variation. With the same bodies – the same neuroanatomy, neurotransmitters and all – here we have a basic concept that is utterly different,†he said. -
      Link - -
      -

      posted by - David Pescovitz at - 10:05:40 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Webby Awards last night, with Prince -

      -
      -Prince
      -
      Prince performed an acoustic number at last night's Webby Awards in NYC. Prince won a Lifetime Achievement Award. His five word acceptance speech: "Everything you think is true." Also in attendance were Robert Kahn, Gorillaz, Arianna Huffington, and dozens of other interesting folks. Rob Corddry hosted. Congrats to all the winners and our friends at the Webby Awards for what sounds like an amazing ceremony! Check Rocketboom for the edit of the evening.
      Link - -
      -

      posted by - David Pescovitz at - 09:19:33 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Electrical substations disguised as houses -

      - Toronto Hydro, the electrical authority in Toronto, has spent decades building electrical substations that are disguised as typical family houses: - -
      - -In 1987, Canadian photographer Robin Collyer began documenting houses that aren't houses at all – they're architecturally-disguised electrical substations, complete with windows, blinds, and bourgeois landscaping. -

      -"During the 1950s and 1960s," Collyer explains in a recent issue of Cabinet Magazine, "the Hydro-Electric public utilities in the metropolitan region of Toronto built structures known as 'Bungalow-Style Substations.' These stations, which have transforming and switching functions, were constructed in a manner that mimics the style and character of the different neighborhoods." -
      -

      - -Link - -
      -

      posted by - Cory Doctorow at - 04:53:31 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Candyland board made from 100k beads -

      - - -Peggy Dembicer cloned a 1978 Candyland game-board using over 100,000 novelty beads. She's documented the finished project on Flickr, with details of some of the finer work. - -Link - -(via Make Blog) - -
      - -
      -

      posted by - Cory Doctorow at - 12:10:49 AM - permalink - | blogs' comments - -
      -

      -

      - - -

      - Monday, June 12, 2006 -

      - - - -

      - Stanford prof sues James Joyce estate for right to study Joyce -

      - A prof at Stanford University is suing the estate of James Joyce over the estate's long practice of destroying documents vital to Joyce scholarship, and of intimidating academics and creators who want to study and extend the works of Joyce. Carol Shloss, a Joyce scholar, has worked for 15 years on a book about the ways in which the book Finnegans Wake was inspired by Joyce's mentally ill daughter. Joyce's grandson, Stephen Joyce, have allegedly destroyed documents relating to this to undermine her book. -

      -This isn't the first time that Stephen Joyce has hurt the cause of scholarship about his grandfather. He threatened to sue the Irish Museum over its exhibition of Joyce's papers. He threatened to sue pubs in Ireland for allowing people to read aloud from Joyce's novels on Bloomsday, the celebration of Ulysses. He told symphonic composers that they couldn't put Joyce quotations in their symphonies. -

      -Most tragically, there was a brief moment when Stephen Joyce was irrelevant. The works of James Joyce were in the public domain until the EU copyright directive extended copyright by 20 years, putting Joyce's books back into the care of his capricious grandson for decades. -

      -There's a whole body of scholarship devoted to tracking the ways in which Stephen Joyce has made himself the enemy of academics and Joyce lovers. The best work to start with is Matthew Rimmer's Bloomsday: Copyright Estates and Cultural Festivals. - -

      -Before the book was published, publisher Farrar, Straus and Giroux removed several supporting citations from Shloss' tome to avoid a lawsuit, according to Olson. Shloss wants to post that information as an electronic appendix to answer several critics who charged that "To Dance in the Wake" was interesting, but thin on documentary evidence, Olson said. -

      -"It's painful once you've written something ... that you think is complete and good, to have it hacked up," Olson said. "There is a desire to bring it forth in the way she originally intended." -

      -Shloss prepared the Web site last year but never made it public because she worried about being sued, Olson said. Among the items excised from the book are quotations from "Finnegans Wake" she thinks support her thesis, as well as letters between James Joyce and his daughter, according to Olson. -

      -Shloss wants the court to declare she's entitled to use information the estate controls under laws that allow authors to quote copyrighted works if they do it in "a scholarly transformative manner." -

      - -Link - -(Thanks, Vidiot!)

      -Update: This New Yorker article on the case is full of great color and background, and includes the fact that Larry Lessig, founder of the Creative Commons project, is arguing the case. - -
      -

      posted by - Cory Doctorow at - 10:52:01 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - HOWTO turn a NES controller into a cell-phone -

      -
      - -Diyhappy took apart a Nokia 3200 -- which had interchangeable faceplates and was thus readily uncased -- and rebuilt it inside an old Nintendo Entertainment System controller. He dremelled out holes for the buttons and the screen and voila, the NES mobile phone. - - -Link - -(Thanks, Sam!) - -
      -

      posted by - Cory Doctorow at - 10:39:04 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - HOWTO make cufflinks out of Ethernet connectors -

      - - -Mark got invited to a fancy party and couldn't find his cufflinks, so he hacked a pair out of some Ethernet connectors and bits of wire; and thus the crimp-your-own cufflink was born. He's written up his mod in detail for others who want to follow suit. - -Link - -(Thanks, Mark!) - -
      - -
      -

      posted by - Cory Doctorow at - 10:32:58 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Inside China's iPod sweat-shops -

      - A British paper sent a reporter to "iPod City," the plant in Longhua, China, where iPods are assembled by women who earn $50/month for working 15 hour days. -

      -My guess is that this is no worse than the conditions in which Powerbooks, Thinkpads, Zens, Linksys routers, etc are manufactured, but Christ, this is depressing. - -

      - The Mail visited some of these factories and spoke with staff there. It reports that Foxconn's Longhua plant houses 200,000 workers, remarking: "This iPod City has a population bigger than Newcastle's." -

      -The report claims Longhua's workers live in dormitories that house 100 people, and that visitors from the outside world are not permitted. Workers toil for 15-hours a day to make the iconic music player, the report claims. They earn £27 per month. The report reveals that the iPod nano is made in a five-storey factory (E3) that is secured by police officers. -

      -Another factory in Suzhou, Shanghai, makes iPod shuffles. The workers are housed outside the plant, and earn £54 per month - but they must pay for their accommodation and food, "which takes up half their salaries", the report observes. - - -

      - -Link - -(Thanks, Tony!) -

      -Update: A former Nokia employee adds, "Add Nokia phones to your list. The type label may say 'Made in Finland' (top-notch models) or 'Made in Hungary' (mid-range ones), but Nokia cellphone engines (ie. the actual hardware) are manufactured by Foxconn in Longhua, China... unless they've found a cheaper supplier. Yes, I actually worked at the plant for a few months between real jobs." - -

      -Update 2: Apple has promised to investigate the labor conditions in its iPod factories. - -
      -

      posted by - Cory Doctorow at - 10:29:26 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Dave Alvin profile -

      - -200606122126 -Colin Berry's Dave Alvin piece, which ran on KQED's "California Report" a couple weeks ago, is now available online. - -

      Colin says: "Dave's new album [West of the West] is a tribute to California songwriters, including Tom Waits, Kate Wolf, Merle Haggard, Los Lobos, and others. I hung with him in the studio and talked to him (and some of the original songwriters) during the making of it." - -Link - -
      -

      posted by - Mark Frauenfelder at - 09:26:09 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Tim Biskup's tiny sculpture -

      - -Iki-Happy O -Iki-Sad O -
      Tim Biskup has created a tiny bronze sculpture to sell at his Laguna Art Museum retrospective (along with Gary Baseman). - -
      Iki stands 2.25" tall, has dual faces, is limited to 44 signed and numbered pieces,  and comes in a letterpressed packaging. Iki will be available at the Saturday opening (6.17.06, 8 - 10 PM)  of Tim's joint retrospective Pervasion show with Gary Baseman at the Laguna Art Museum.
      Link (Thanks, Scott!) - - -
      -

      posted by - Mark Frauenfelder at - 09:21:26 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Covers from '60s French satirical magazine: Hara Kiri -

      - -Hara Kiri -Here are a bunch of cover scans of a magazine I didn't know about until today. According to Wikipedia, Hara Kiri was created in 1960 and "in 1961 and 1966 they were temporarily banned by the French Government." Link - - - -
      -

      posted by - Mark Frauenfelder at - 06:57:48 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Negativland performing in LA tonight -

      - Mark from Negativland says: - -
      This is very late notice, but we (Negativland) want to let you and all -Boingboingers know that we are playing live in LA. this Monday night, -June 12th, at the Silent Movie Theater! Yes. We are. It's at 611 -North Fairfax Ave. Hollywood Box office- 323-655-2520. Tickets are -$22. The doors are at 9pm and the show starts at 10pm sharp! - -

      This is a very rare appearance for us in L.A, and at a really cool and -intimate venue. The show is we are performing is called "It's All In -Your Head FM", and we hope you can attend! It's about monotheism, but -in stereo. With blindfolds handed out at the door. Really.

      -Link - -
      -

      posted by - Mark Frauenfelder at - 06:24:05 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Meme Therapy interviews Rudy Rucker -

      - Meme Therapy has a long and interesting review with one of my very favorite authors, Rudy Rucker. - -
      MT: What aspects of writing do you enjoy the most? - -

      -200606121734 -RR: I like leaving the daily world and going to another world, a world that I had a hand in designing. You’ll notice that in most of my novels, the main character in fact leaves the world where I start him out and goes to another world. Another planet, another dimension, another sheet of reality. It’s an objective correlative for what I’m doing when I leave this mundane world and go into the world of my novel. - -

      Writing is so much work. Every part of writing a novel is hard. The planning, the sitting down and creating, the revising. I guess the most fun part is when it seems to pour out and I’m having a good day. When I’m doing that, I stop worrying for a while, I forget myself and I’m happy and proud and even exalted and amazed to see what’s coming down or going up. - -

      More precisely, that fun part is “the narcotic moment of creative bliss.” I just heard John Malkovich deliver that phrase, playing the role of an artist/art prof in Art School Confidential. That’s very right on; the operative word is “narcotic,” it’s definitely something you get addicted to over the years. Really I go to all this trouble writing a novel day after day month after month because, in a way, I’m trying to get high. Or see God. Or make love to the Muse. Waiting for the narcotic moment of creative bliss.

      - -Link - -
      -

      posted by - Mark Frauenfelder at - 05:35:13 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Transparent street signs -

      - - City Of Chicago Images Images Image04 -Two years ago, artist Cayetano Ferrer took photos of the scene behind several Chicago street signs and then pasted the prints on top of the signs to achieve an amazing transparency effect. (As the Wooster Collective blog points out, Amnesty International's recent ad campaign employs a similar technique. And it's also the idea behind the "Transparent Screen" trick for your computer display.)
      -Link to Ferrer's "City of Chicago" image gallery, Link to Amnesty International campaign (via Neatorama) - -
      -

      posted by - David Pescovitz at - 03:41:34 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Illustrations from Rabelais's Gargantua and Pantagruel -

      - - -Bibliodyssey has posted two mind-blowing selections of surrealist characters from a 1565 publication called "Les Songes Drolatiques de Pantagruel, ou sont contenues plusieurs figures de l’invention de maistre François Rabelais : & derniere oeuvre d’iceluy, pour la recreation des bons esprits." While Rabelais is often credited with drawing the characters to accompany his text, they were apparently most likely drawn by François Desprez. The absurd monsters remind me of the wonderful phantasmagoric work of Jim Woodring.
       Blogger 1717 1584 1600 Rabelais-Pantegruel-By-Francois-Desprez-11-1 -
      -From Bibliodyssey: - -
      Franciscan friar, doctor, traveller, model for the Thelemic magickal writings of Aleister Crowley, humanist, Benedictine monk, alchemist, teacher, leader of the French renaissance, heretic, greek scholar and groundbreaking satirical writer, François Rabelais (?1483/1493-1553) issued his magnum opus 'The life of Gargantua and Pantagruel' as a five book series over 20 years up to 1564. -

      -The books chart the humorous adventures of giants Gargantua and his son, Pantagruel in a scatalogical and often bawdy manner. Rabelais wrote in the epic tradition of Homer, and beyond the burlesque, there is an underlying serious examination of society, politics, education and philosophy whilst introducing 500 new words to the french lanugage.
      Link and -Link - -
      -

      posted by - David Pescovitz at - 02:52:18 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Cartoonist Chris Ware on the piano -

      - -Chris Ware on piano -This isn't fair. Not only is Chris Ware a supremely gifted cartoonist, he can also play ragtime piano like nobody's business. Link (via Flog!) - -

      Reader comment: - -Rob DeRose says: - -

      Chris Ware shares his love of ragtime with MacArthur Genius Grant winner Reginald Robinson. In fact Chris heard Reginald playing in the winter garden of the Chicago Central Library one day and became fast friends. Here's a story from NPR on how the two of them found an entirely new song of Scott Joplin's. (its the fourth of four mini-segments.) - - -

      I've been a fan of Reginald ever since I saw him accompany the Squirrel Nut Zippers (in-between their first & second album) here in Chicago. If you get a chance to see him, by all means go. A nice Trib article about him. His CD on Amazon. - -

      The Chicago Library's winter garden, where he used to practice, and where he & Chris Ware met (it's the nicest part of the building.)

      - -
      -

      posted by - Mark Frauenfelder at - 02:22:04 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Walt Disney's 1956 time-capsule letter to the future -

      - The Disney company has unearthed a 1956 time-capsule containing a letter from Walt Disney to the future, on stationary bearing the legend "NO AGREEMENT WILL BE BINDING ON THIS CORPORATION UNLESS IN WRITING AND SIGNED BY AN OFFICER." Walt's letter to the future speculates about the future of entertainment and is at once profoundly wrong and profoundly right. -

      -Walt predicts that the world will be overturned by technology, all the old order remade. At the same time, he assumes that what will come in on the tails of 1956's mass media will be...more mass media! Even though Walt himself predated truly national media, he can't conceive of the age of mass media waning and being replaced by a mass medium -- a channel like the net -- crowded with a never-ending confusion of micro-media. Walt, in other words, didn't predict the long tail. - -

      -[...O]f one thing I'm sure. People will need and demand amusement, refreshment and pleasant relaxation from daily tasks as much in your day as they have in ours and in all the generations of mankind into the remote past. What the exact nature and implementation of these mass entertainments may be, doesn't make much difference, it seems to me. -

      -Humanity, as history informs us, changes very slowly in character and basic interests. People need to play as much as they need toll. They never cease to be fascinated by they own powers and passions, their base or noble emotions, their faiths and struggles and triumphs against handicap -- all things that make them laugh and weep and comfort one another in love and sacrifice out of the depths of their being... -

      -Mindful of the phenomenal discoveries and applications of science to all our activities and institutions, it seems no mere guess that public entertainment will have become machined and powered by atomic and solar energies long before you read this capsule. -

      -The extension of radar and other as yet untapped sources of cosmic force may well have changed the entire technique of communication, in the theatre and television fields as well as in other areas of informational broadcast. -

      -Millions of people in massive assemblies around the world may now be viewing the same staged or natural event, scanned by some incredibly potent scope, in the same amount of time. They may even be viewing presently obscured vistas on neighboring planets as one might look at neighbors across our Los Angeles Streets. -

      -Omniscience will have drawn closer to finite senses and perceptions, for our entertainment as for our livelihood -- yours, I should say, who will read this in your 21st Century. -

      - -200K PDF Link - -(Thanks, Anonymous Source!) - -
      -

      posted by - Cory Doctorow at - 02:01:45 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Plans for Barney Fife statue toppled by Knotts' estate -

      - A couple of Barney Fife fans who put down $8,000 to erect a statue of Barney Fife (played by Mick Jagger lookalike Don Knotts) in downtown Mount Airy, NC (the model for Mayberry) received a letter from CBS attorneys telling them to halt the project. - -
      - Knottsstatue -[CBS attorney] Mallory Levitt explained to [would-be statue erector Tom] Hellebrand and the Mount Airy News that although Paramount/CBS owned the rights to the character of Barney Fife, the group didn't have the authority to give permission for a likeness of Don Knotts. - -

      "That right belongs to the Knotts estate," she said. - -

      Levitt told Hellebrand she contacted the actor's estate and business associates of Andy Griffith, and none wanted to go through with the project.

      - -The project website, donknottsstatue.com, has a note about the cancellation of the project: "The tears on our pillows bespeak the pain that is in our hearts." The project leaders will be selling a full-size replica of a Mayberry Squad car and a golf cart made to look like a squad car on eBay to recoup their expenses. - -Link (Thanks for the correct, url, Dru!) - -
      -

      posted by - Mark Frauenfelder at - 01:20:09 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Ol' Glory energy drink -

      - - 72 165796068 94C49E9C84 -At the Institute for the Future this morning, my colleague Mike Love is chugging this delicious and patriotic energy drink. Their tag line: "Makes you feel better all over than anywhere else." Ummm....
      Link to Ol' Glory site, Link to Mike's photo on Flickr - -
      -

      posted by - David Pescovitz at - 11:41:56 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - theFLOWmarket sells consumer awareness -

      - -Flowmarket -Gmo -
      -theFLOWmarket is a supermarket-as-artwork that sells consumer awareness in the form of imaginary products like "commercial free-space," "exploitation free produce," "symptom removers," "factory farming antibiotics," "renewable energy," and "a feeling of safety." The nicely-packaged products are available for sale at prices from $5 to $20. theFLOWmarket is open for business at the Danish Design Centre in Copenhagen. -Link to Flash site (Thanks, Lindsay Tiemeyer!) - -
      -

      posted by - David Pescovitz at - 11:34:06 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Pea-head smashes art gallery window, gets busted -

      - Roq La Rue gallery Kirsten Anderson has a funny story about an idiot that smashed a window at her new gallery in Seattle, called BLVD. He might just be the stupidest brick-wielder on in the known universe. Read on... - -
      -BLVD broken window -[A]fter I left and Damion was closing up, some drunk mouth-breathing knuckle-dragger starts banging on the door demanding to be let in. After Damion tells him that the gallery was closed, the Moron says "I'm going to smash your door in with a brick!" Damion at the time was talking to a couple of bad asses who offered to kick the guy's ass for us and looks like we should have taken them up on it, as an hour later, the guy pulls up to the gallery in his car, double parks, pulls a brick out of his car, and smashes BLVD's door a couple times. Cool huh? No one was in the gallery -- but the guy who lives upstairs heard it and called Damion. Also -- there is a bar a few storefronts away from us and I guess the folks on the patio saw it all. But it gets better. Moron turns to go back to his car and finds he's locked himself out. Har har! So he tries to smash his own car window in with the brick, which doesn't work... so he goes into the Rendevous to use the payphone to call a locksmith which is where he got nabbed by the cops. What a maroon. So anyway. Today is happy fun door repair day.
      - -Link - -
      -

      posted by - Mark Frauenfelder at - 11:04:18 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Prescription stimulants on campus -

      - In yesterday's Washington Post, Joel Garreau, author of Radical Evolution, writes about the popularity of drugs like Adderall and Provigil to increase focus and wakefulness during academically stressful times. From the article: -
      "I'm a varsity athlete in crew," says Katharine Malone, a George Washington University junior. "So we're pretty careful about what we put in our bodies. So among my personal friends, I'd say the use is only like 50 or 60 percent..."

      -For a senior project this semester, Christopher Salantrie conducted a random survey of 150 University of Delaware students at the university's Morris Library and Trabant Student Center. -

      -"With rising competition for admissions and classes becoming harder and harder by the day, a hypothesis was made that at least half of students at the university have at one point used/experienced such 'smart drugs,' " Salantrie writes in his report. He found his hunch easy to confirm. -

      -"What was a surprise, though, was the alarming rate of senior business majors who have used" the drugs, he writes. Almost 90 percent reported at least occasional use of "smart pills" at crunch times such as final exams, including Adderall, Ritalin, Strattera and others. Of those, three-quarters did not have a legitimate prescription, obtaining the pills from friends."
      -Link (Thanks, Jason Tester!) - -
      -

      posted by - David Pescovitz at - 09:51:50 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Vintage pulp covers for classic novels -

      - - -Slate commissioned designers to produce six vintage pulp-fiction covers for classic novels like Moby Dick ("Primitive Pirate Passions Were a Prelude to Death!"), The Iliad ("Gore! Greeks! Glory!") and Alice in Wonderland ("One girl's drug-induced descent into dreamland debauchery"). The results are lovely. - -Link - -(Thanks, Fipi Lele!) - -
      - -
      -

      posted by - Cory Doctorow at - 08:33:24 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - LotR video clip with voices replaced by foolish groans -

      - - -In this youtube, "CJ" has taken a clip from the Lord of the Rings trilogy in which Frodo awakens in the Elf stronghold and greets his comrades and replaced all the voices with idiotic groaning and moaning and squealing, apparently voiced by someone named Olaf. The net effect is surprisingly funny! - -Link - -(Thanks, Alice!) - -
      - -
      -

      posted by - Cory Doctorow at - 04:36:17 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - William Gibson blogging fiction excerpts -

      - Since June 1, William GIbson has been posting irregular chunks of prose to his blog, stuff that appears to be excerpts from a novel-in-progress. It's fascinating stuff, little vignettes that hint at a really exciting bigger picture. - -
      -Vianca sat cross-legged on Tito’s floor, wearing a disposable hairnet and white knit cotton gloves, with his Sony plasma screen across her knees, going over it with an Armor All wipe. When she’d wiped it completely down, it would go back into its factory packaging, which in turn would be wiped down. Tito, in his own hairnet and gloves, sat opposite her, wiping the keys of his Casio. A carton of cleaning supplies had been waiting for them in the hall, beside a new and expensive-looking vacuum-cleaner Vianca said was German. Nothing came out of this vacuum but air, she said, so there would no stray hairs or other traces left behind. Tito had helped his cousin Eusebio with exactly this procedure, though Eusebio had mainly had books, each of which had needed, according to protocol, to be flipped through for forgotten insertions and then wiped. The reasons for Eusebio’s departure had never been made clear to him. That too was protocol. -
      - -Link 1, - -Link 2, - -Link 3 - -
      -

      posted by - Cory Doctorow at - 12:29:17 AM - permalink - | blogs' comments - -
      -

      -

      - - -

      - Sunday, June 11, 2006 -

      - - - -

      - Japanese anti-foreigner comic warns against human rights act -

      -
      - -Coal sez, "I've just translated and posted a rather well rendered manga from an 'emergency publication' in Japan about the dangers of protecting human rights. Japan is a little behind in legal recognition of basic human rights (including but not limited to racial discrimination etc.), and it seems the emergence of a bill to make protection of rights enforceable has a few people worried. The level of alarmism I think is particularly amusing, if that's the right word. What's also noteworthy is the constant demonising of trouble-making foreigners, and the pity the writer tries to inspire for the poor landlord who can no longer refuse to rent his house to Chinese etc. You can't make this stuff up!" - - -Link - -(Thanks, Coal!) - -
      -

      posted by - Cory Doctorow at - 10:54:13 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - iPod Nano boombox built into flashlight casing -

      - - -Here's a monaural boombox built into the housing for a big Eveready flashlight. The speaker fits over the mouth, and it sits over a miniature amp scavegened from a set of desktop speakers and an iPod Nano with a wireless remote. - -Link to parts-list, Link to finished item - -
      - -
      -

      posted by - Cory Doctorow at - 10:12:36 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - New Barenaked Ladies single as free, remixable multitracks -

      - -The Canadian band Barenaked Ladies have pre-released a track from their upcoming album Barenaked Ladies Are Me, in a four-track mix that's ready for remixing, and free. They're planning to do more of the same with their future releases. -

      -I used to see BNL play at my local shopping mall, the Scarborough Town Centre, when all they'd released was an indie cassette tape with an amazing cover of Public Enemy's "Fight the Power" on it, and I'm so amazingly glad to see them still making great music. What's more, the band's frontman, Steve Page, is also fronting a group of Canadian musicians who've spoken out against DRM and suing fans and other music label shenanigans. -

      -Best of all -- they're releasing the next album as a 15-song digital version as well as a 13-song CD, so I can get their music without having to take another piece of slow-decaying, space-hogging media into my already overcrowded home. - -Link - -(Thanks, Frank!) - -
      - -
      -

      posted by - Cory Doctorow at - 11:27:33 AM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Images from anti-DRM protest at the San Fran Apple Store -

      - -Here are some photos and a video from yesterday's anti-DRM protest at the Apple Store in San Francisco. - -Video Link, Photos Link - -
      - -
      -

      posted by - Cory Doctorow at - 11:19:28 AM - permalink - | blogs' comments - -
      -

      -

      - - -

      - Saturday, June 10, 2006 -

      - - - -

      - Responses to Jaron Lanier's crit of online collectivism -

      - Two weeks ago, Edge.org published Jaron Lanier's essay "Digital Maoism: The Hazards of the New Online Collectivism," critiquing the importance people are now placing on Wikipedia and other examples of the "hive mind," as people called it in the cyberdelic early 1990s. It's an engaging essay to be sure, but much more thought-provoking to me are the responses from the likes of Clay Shirky, Dan Gillmor, Howard Rheingold, our own Cory Doctorow, Douglas Rushkoff, and, of course, Jimmy Wales.

      From Douglas Rushkoff: - - -
      I have a hard time fearing that the participants of Wikipedia or even the call-in voters of American Idol will be in a position to remake the social order anytime, soon. And I'm concerned that any argument against collaborative activity look fairly at the real reasons why some efforts turn out the way they do. Our fledgling collective intelligences are not emerging in a vacuum, but on media platforms with very specific biases. -

      -First off, we can't go on pretending that even our favorite disintermediation efforts are revolutions in any real sense of the word. Projects like Wikipedia do not overthrow any elite at all, but merely replace one elite — in this case an academic one — with another: the interactive media elite...

      - -While it may be true that a large number of current websites and group projects contain more content aggregation (links) than original works (stuff), that may as well be a critique of the entirety of Western culture since post-modernism. I'm as tired as anyone of art and thought that exists entirely in the realm of context and reference — but you can't blame Wikipedia for architecture based on winks to earlier eras or a music culture obsessed with sampling old recordings instead of playing new compositions. -

      -Honestly, the loudest outcry over our Internet culture's inclination towards re-framing and the "meta" tend to come from those with the most to lose in a society where "credit" is no longer a paramount concern. Most of us who work in or around science and technology understand that our greatest achievements are not personal accomplishments but lucky articulations of collective realizations. Something in the air... Claiming authorship is really just a matter of ego and royalties. -
      -From Cory Doctorow: -
      Wikipedia isn't great because it's like the Britannica. The Britannica is great at being authoritative, edited, expensive, and monolithic. Wikipedia is great at being free, brawling, universal, and instantaneous.
      - -From Jimmy Wales (italics indicate quotes from Jaron's original essay): - - -
      "A core belief of the wiki world is that whatever problems exist in the wiki will be incrementally corrected as the process unfolds." -

      -My response is quite simple: this alleged "core belief" is not one which is held by me, nor as far as I know, by any important or prominent Wikipedians. Nor do we have any particular faith in collectives or collectivism as a mode of writing. Authoring at Wikipedia, as everywhere, is done by individuals exercising the judgment of their own minds. -

      - "The best guiding principle is to always cherish individuals first." -

      -Indeed.
      -Link

      -UPDATE: Jaron Lanier writes us that he's received a lot of negative feedback from people who he thinks may not have actually read his original essay: -
      -In the essay i criticized the desire (that has only recently become influential) to create an "oracle effect" out of anonymity on the internet - that's the thing i identified as being a new type of collectivism, but i did not make that accusation against the wikipedia - or against social cooperation on the net, which is something i was an early true believer in- if i remember those weird days well, i think i even made up some of the rhetoric and terminology that is still associated with net advocacy today- anyway, i specifically exempted many internet gatherings from my criticism, including the wikipedia, boingboing, google, cool tools... and also the substance of the essay was not accusatory but constructive- the three rules i proposed for creating effective feedback links to the "hive mind" being one example.
      - -
      -

      posted by - David Pescovitz at - 10:07:03 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Spanish castle optical effect -

      - This has been going around for a couple of days, but I just found out about it. It's a neat optical effect -- you stare at a color negative of a photo for 30 seconds (or even just 15), then move the mouse over the photo, keeping your eyes on the black dot. The photo appears in color, until you move your eyes. Link - -
      -

      posted by - Mark Frauenfelder at - 08:38:10 AM - permalink - | blogs' comments - -
      -

      -

      - - -

      - Friday, June 9, 2006 -

      - - - -

      - EFF podcast: How we kept caching legal -

      - Danny sez, "Line Noise is the new EFF podcast (RSS or iTunes); this week's episode is a chat with EFF's IP attorney Fred von Lohmann on the background to the Section 115 Reform Act (previously on Boing Boing. He explains how a good bill was used to sneak in bad precedents - including the insane idea that all temporarily cached copies on the Net and in RAM should be copyrightable and subject to licensing. -

      -"Good news on that, by the way -- thanks to your calls and comments, the committee have slowed the pace of this fast-track bill, and are now working to fix the bill's language. Everyone from the Copyright Office to Radio Shack and BellSouth have now commented on the problems, so there's an excellent chance of a clear resolution." - -Link - -
      -

      posted by - Cory Doctorow at - 11:55:41 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Why do these people have characters on their foreheads? -

      - Nick of Square America invites you to solve a mystery. - -
       Blogger 5842 2554 1600 F2 I got this lot of slides about three years ago and I've never been able to figure out just what is going on. There are about 50 slides in all- all dating from between 1959 and 1969 and all of young women. Some, like the ones here have letters written on their foreheads, others have press type with their names on it affixed to either their temples or foreheads. Were the slides taken by a dermatologist or plastic surgeon or were these young women part of some now forgotten experiment.
      Link - - -
      -

      posted by - Mark Frauenfelder at - 03:28:19 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Trailer for 2007 Disney Pixar movie: Ratatouille -

      - -Picture 2-9 -Apple has the trailer for the next Disney Pixar movie coming out in 2007. It's called Ratatouille and it appears to be about a Parisian rat (without a phony French accent) who, unlike other rats in his family, insists on eating only the finest food served in Paris' best restaurants. - -

      The quality of the video is really nice. Don't you wish YouTube looked half as nice as this? Link - -
      -

      posted by - Mark Frauenfelder at - 02:48:18 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - More great old illustrations from BilbiOdyssey -

      - - Blogger 1717 1584 1600 Begnino-Bossi-1771-Petitot - Blogger 1717 1584 1600 Heemskerck-.-Lyons
      - -Why are so many drawings from earlier centuries so deliciously weird? Here are a couple I came across on one of my favorite blogs, BibliOdyssey. Link - -
      -

      posted by - Mark Frauenfelder at - 02:28:39 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Play the World Cup with a stream of urine -

      - -200606091411Funny photo of a urinal with a small ball and goal in it. Link - -
      -

      posted by - Mark Frauenfelder at - 02:12:35 PM - permalink - | blogs' comments - -
      -

      -

      - - - - - -

      - Wired News tells how to watch FIFA World Cup for free online -

      - Worldcup-1 A while back, law firm Baker & McKenzie sent Boing Boing a snippy letter warning us not to do something we wouldn't do even if they begged us -- broadcast live streams of the FIFA World Cup. - -

      I wonder if Baker & McKenzie will send Wired News a letter complaining that Wired News is facilitating piracy for explaining a variety of ways in which FIFA World Cup fans can enjoy live video streams of the tournament on their computers without paying the rightsholder, Infront Sports & Media? - - Link

      (Image courtesy groovehouse of The Grooveblog.) - -
      -

      posted by - Mark Frauenfelder at - 02:01:40 PM - permalink - | blogs' comments - -
      -

      -

      - - - -Archives -
      - -
      - -
      -
      - - \ No newline at end of file diff --git a/vendor/gems/hpricot-0.6/test/files/cy0.html b/vendor/gems/hpricot-0.6/test/files/cy0.html deleted file mode 100644 index 5f79961..0000000 --- a/vendor/gems/hpricot-0.6/test/files/cy0.html +++ /dev/null @@ -1,3653 +0,0 @@ - - - - #41: 1cy0.html on Hpricot - - - - - - -
      - - - - -
      - - - - - - -
      - - -

      Ticket #41: 1cy0.html

      - - - - -
      - File 1cy0.html, 63.9 kB - (added by alexgutteridge, 1 month ago) -

      -html -

      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Line 
      1
      2
      3
      4
      5<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      6<html lang="en">
      7        <head>
      8<link rel="alternate" type="application/rss+xml" title="RCSB PDB - Latest Released Structures" href="/pdb/rss/LastLoad">       
      9                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      10                <title>RCSB PDB : Structure Explorer</title>
      11                <link rel="shortcut icon" href="/pdbstatic/images/pdb.ico" type="image/x-icon">
      12                <link rel="stylesheet" href="/pdb/skins/pastel/styles/pdbcomp.css" type="text/css">
      13                 
      14                <!-- please read /pdbstatic/common/lib/comp.js.README if you need to modify some javascript for the site -->
      15                <script type="text/javascript" language="JavaScript" src="/pdbstatic/common/lib/comp.js"></script>
      16                <script type="text/javascript" language="JavaScript" src="/pdbstatic/common/lib/expandable.js"></script>
      17                <script type="text/javascript" language="JavaScript" src="/pdbstatic/common/lib/results.js"></script>
      18                <script type="text/javascript" language="JavaScript" src="/pdbstatic/common/lib/pdbajax.js"></script>
      19                <script type="text/javascript" language="JavaScript" src="/pdbstatic/common/lib/htmlhttprequest_commented.js"></script>
      20                 
      21                 
      22               
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32<script type="text/javascript" language="JavaScript">
      33
      34var resultSorts = new Array();
      35
      36function openWindow(url){
      37      var w = window.open ("", "win", "height=600,width=800,location,menubar,resizable,scrollbars,status,toolbar");
      38                w.location.href = url;
      39                w.focus();
      40}
      41function openWindowToSize(url,width,height){
      42      var w = window.open ("", "win", "height="+height+",width="+width+",left=80,top=100,location,menubar,resizable,scrollbars,status,toolbar");
      43                w.location.href = url;
      44                w.focus();
      45}
      46
      47// due to the poor way that the treeview code generates the fullLink, we need to have
      48// our openWindowFromNav method use numbers to reference a site if the href has any quotes
      49var roboloc = '/robohelp/';
      50navsites = [
      51                        "http://deposit.rcsb.org",
      52                        "http://sg.pdb.org",
      53                        "http://targetdb.pdb.org",
      54                        "http://function.rcsb.org:8080/pdb/function_distribution/index.html",
      55                        "http://mmcif.pdb.org",
      56                        "http://pdbml.rcsb.org",
      57                        "http://sw-tools.pdb.org",
      58                        "http://deposit.pdb.org/cc_dict_tut.html",
      59                        "http://pepcdb.pdb.org/"
      60                       
      61                    ];
      62helpsites = [
      63            "data_deposition_and_processing/how_to_deposit.htm",
      64            "validation_server/how_to_validate.htm",
      65            "data_download/how_to_download.htm",
      66            "search_database/how_to_search.htm",
      67            "browse_database/how_to_browse.htm",
      68            "molecular_viewers/introduction_to_molecular_viewers.htm",
      69            "files_formats/structures/chemical_component_format/chemical_component_introduction.htm",
      70            "data_download/structure_download.htm", // 7
      71            "data_download/ftp_services.htm", // 8
      72            "data_download/theoretical_models.htm", //9
      73            "data_download/cd_rom_dvd.htm", //10
      74            "structuralgenomics/sg_home.htm",
      75            "structuralgenomics/targetdb.htm",
      76            "structuralgenomics/pepcdb.htm",
      77            "structuralgenomics/function_distributions.htm", // 14
      78            "files_formats/intro_dictionaries_file_formats.htm", //15
      79            "software/tools/deposition_mmcif_tools.htm", //16
      80            "data_deposition_and_processing/how_to_deposit.htm", //17
      81            "data_deposition_and_processing/deposition_tools_at_a_glance.htm", //18
      82            "site_navigation/citing_the_pdb.htm" //19
      83                    ];
      84navalerts = [
      85                        "Discussion Forums are not yet active.  Please check back later."
      86                    ];
      87function openWindowFromNav(urltype, urlnumber)
      88{
      89        if (urltype == 0) // new windows
      90        {
      91//              window.open (navsites[urlnumber], "win", "height=600,width=800,location,menubar,resizable,scrollbars,status,toolbar");
      92openWindow(navsites[urlnumber]);
      93        }
      94        else if (urltype == 1) // robo window
      95        {
      96                callHelp(roboloc, helpsites[urlnumber]);
      97        }
      98        else if (urltype == 2) // javascript alerts
      99        {
      100                alert(navalerts[urlnumber]);
      101        }
      102}
      103
      104
      105// You can find instructions for this file at http://www.treeview.net
      106
      107//Environment variables are usually set at the top of this file.
      108var ICONPATH = '/pdb/skins/pastel/images/tree/';
      109USETEXTLINKS = 1;
      110STARTALLOPEN = 0;
      111USEFRAMES = 0;
      112USEICONS = 1;
      113WRAPTEXT = 0;
      114PRESERVESTATE = 1;
      115HIGHLIGHT=1;
      116ALLOWTOPLEVELRETRACTION = 1;
      117
      118
      119
      120
      121var pdbPathNames = new Object(); // associative array of links to xIDs of tree
      122
      123function myInsDoc(nn,folder,opt,link,iconsrc)
      124{
      125  //if (opt == 'S')
      126  {
      127    if (link.substring(0,5) == '/pdb/')
      128    {
      129      pdbPathNames[link] = nn;
      130    }
      131  }
      132  var myInsDocSub = insDoc(folder,gLnk(opt, nn, link.replace(/'/g, "\\'")));
      133  myInsDocSub.xID = nn;
      134  if (iconsrc)
      135  {
      136    myInsDocSub.iconSrc = iconsrc;
      137  }
      138  else
      139  {
      140    myInsDocSub.iconSrc = ICONPATH + 'ftvsquare.gif';
      141  }
      142  return myInsDocSub;
      143}
      144
      145function myInsFolder(nn,folder,link)
      146{
      147  if (link.substring(0,5) == '/pdb/')
      148  {
      149    pdbPathNames[link] = nn;
      150  }
      151  var myInsFldSub = insFld(folder,gFld(nn, link.replace(/'/g, "\\'")));
      152  myInsFldSub.xID = nn.replace(/amp;/g, '');
      153  return myInsFldSub;
      154}
      155
      156function checkLocation()
      157{
      158  var pn = window.location.pathname + window.location.search;
      159  for (prop in pdbPathNames)
      160  {
      161    if (pn.indexOf(prop) >= 0)
      162    {
      163          var docObj;
      164          docObj = findObj(pdbPathNames[prop]);
      165          docObj.forceOpeningOfAncestorFolders();
      166          highlightObjLink(docObj);
      167          break;
      168    }
      169  }
      170}
      171
      172
      173
      174function addHomeTree()
      175{
      176
      177}
      178
      179function addSearchTree()
      180{
      181
      182}
      183
      184
      185
      186function addExploreTree()
      187{
      188
      189           fSub = myInsDoc('<b>1CY0<\/b>',f,'S','/pdb/explore.do?structureId=1CY0');
      190
      191   fSub = myInsFolder('Download Files',f,'');
      192   fSubSub = myInsDoc('PDB File',fSub,'S','/pdb/download/downloadFile.do?fileFormat=pdb&amp;compression=NO&amp;structureId=1CY0');
      193   fSubSub = myInsDoc('PDB gz',fSub,'S','/pdb/files/1cy0.pdb.gz');
      194   fSubSub = myInsDoc('PDB File (Header)',fSub,'S','/pdb/download/downloadFile.do?fileFormat=pdb&amp;headerOnly=YES&amp;structureId=1CY0');
      195   fSubSub = myInsDoc('mmCIF File',fSub,'S','/pdb/download/downloadFile.do?fileFormat=cif&amp;compression=NO&amp;structureId=1CY0');
      196   fSubSub = myInsDoc('mmCIF gz',fSub,'S','/pdb/files/1cy0.cif.gz');
      197   fSubSub = myInsDoc('mmCIF File (Header)',fSub,'S','/pdb/download/downloadFile.do?fileFormat=cif&amp;headerOnly=YES&amp;structureId=1CY0');
      198   fSubSub = myInsDoc('PDBML/XML File',fSub,'S','/pdb/download/downloadFile.do?fileFormat=xml&amp;compression=NO&amp;structureId=1CY0');
      199   fSubSub = myInsDoc('PDBML/XML gz',fSub,'S','/pdb/files/1cy0.xml.gz');
      200   fSubSub = myInsDoc('PDBML/XML File (Header)',fSub,'S','/pdb/download/downloadFile.do?fileFormat=xml&amp;headerOnly=YES&amp;structureId=1CY0');
      201
      202       
      203               fSubSub = myInsDoc('Biological Unit Coordinates',fSub,'S','/pdb/files/1cy0.pdb1.gz');
      204       
      205           fSub = myInsDoc('FASTA Sequence',f,'S','/pdb/download/downloadFile.do?fileFormat=FASTA&amp;compression=NO&amp;structureId=1CY0');
      206
      207   fSub = myInsFolder('Display Files',f,'');
      208
      209           fSubSub = myInsDoc('Custom Structure Summary',fSub,'S','/pdb/explore/customStructureReportForm.do?exptype=misc');
      210
      211   fSubSub = myInsDoc('PDB File',fSub,'B','/pdb/files/1cy0.pdb');
      212   fSubSub = myInsDoc('PDB File (Header)',fSub,'B','/pdb/files/1cy0.pdb?headerOnly=YES');
      213   fSubSub = myInsDoc('mmCIF File',fSub,'B','/pdb/files/1cy0.cif');
      214   fSubSub = myInsDoc('mmCIF File (Header)',fSub,'B','/pdb/files/1cy0.cif?headerOnly=YES');
      215   fSubSub = myInsDoc('PDBML/XML File',fSub,'B','/pdb/files/1cy0.xml');
      216   fSubSub = myInsDoc('PDBML/XML (Header)',fSub,'B','/pdb/files/1cy0.xml?headerOnly=YES');
      217
      218           fSub = myInsFolder('Display Molecule',f,'');
      219           fSubSub = myInsDoc('Image Gallery',fSub,'S','/pdb/explore/images.do?structureId=1CY0');
      220           fSubSub = myInsDoc('KiNG Viewer',fSub,'S','/pdb/static.do?p=explorer/viewers/king.jsp');
      221           fSubSub = myInsDoc('Jmol Viewer',fSub,'S','/pdb/static.do?p=explorer/viewers/jmol.jsp');
      222           fSubSub = myInsDoc('WebMol Viewer',fSub,'S','/pdb/static.do?p=explorer/viewers/webmol.jsp');
      223           fSubSub = myInsDoc('Protein Workshop',fSub,'S','/pdb/Viewers/ProteinWorkshop/protein_workshop_launch.jsp');
      224           fSubSub = myInsDoc('Rasmol Viewer <br>(<b>Plugin required</b>)',fSub,'B','/pdb/download/downloadFile.do?fileFormat=PDB&amp;display=rasmol&amp;compression=NO&amp;structureId=1CY0');
      225           fSubSub = myInsDoc('Swiss-PDB Viewer <br>(<b>Plugin required</b>)',fSub,'B','/pdb/download/downloadFile.do?fileFormat=PDB&amp;display=spdbv&amp;compression=NO&amp;structureId=1CY0');
      226           fSubSub = myInsDoc('KiNG Help',fSub,'S','javascript:callHelp(roboLoc,\'viewers/king.htm\');',ICONPATH + 'question.gif');
      227           fSubSub = myInsDoc('Jmol Help',fSub,'S','javascript:callHelp(roboLoc,\'viewers/jmol.htm\');',ICONPATH + 'question.gif');
      228           fSubSub = myInsDoc('WebMol Help',fSub,'S','javascript:callHelp(roboLoc,\'viewers/webmol.htm\');',ICONPATH + 'question.gif');
      229           fSubSub = myInsDoc('Protein Workshop Help',fSub,'S','javascript:callHelp(roboLoc,\'viewers/proteinworkshop.htm\');',ICONPATH + 'question.gif');
      230           fSubSub = myInsDoc('QuickPDB',fSub,'S','javascript:callHelp(roboLoc,\'viewers/thequickpdb.htm\');',ICONPATH + 'question.gif');
      231           
      232           
      233             fSubSub = myInsDoc('Asymmetric Unit /<br> Biological Molecule',fSub,'S','/pdb/static.do?p=explorer/singleimage.jsp&amp;structureId=1cy0&amp;type=asym&amp;size=500');
      234           
      235           fSub = myInsDoc('<b>Structural Reports</b> ',f,'S','/pdb/explore/biologyAndChemistry.do');
      236           fSub = myInsDoc('<b>External Links</b> ',f,'S','/pdb/explore/externalReferences.do');
      237           
      238           fSub = myInsFolder('Structure Analysis ',f,'');
      239           fSubSub = myInsFolder('Geometry ',fSub,'');     
      240           
      241           
      242             fSubSubSub = myInsDoc('RCSB Graphics',fSubSub,'S','/pdb/explore/geometryGraph.do?structureId=1CY0');
      243             fSubSubSub = myInsDoc('RCSB Tables',fSubSub,'S','/pdb/explore/geometryDisplay.do');
      244           
      245             fSubSubSub = myInsDoc('MolProbity Ramachandran Plot',fSubSub,'B','/pdb/images/1CY0_ram_m_500.pdf');
      246
      247                 
      248                                        fSubSub = myInsFolder('Sequence Variants  ',fSub,'');
      249                 
      250                                                fSubSubSub = myInsDoc('TOP1_ECOLI Variants',fSubSub,'S','/pdb/search/smartSubquery.do?structureId=1CY0&variant=1&smartSearchSubtype=StructureVariantQuery&spId=TOP1_ECOLI');
      251                 
      252                                                fSubSubSub = myInsDoc('TOP1_ECOLI Non-Variants',fSubSub,'S','/pdb/search/smartSubquery.do?structureId=1CY0&variant=0&smartSearchSubtype=StructureVariantQuery&spId=TOP1_ECOLI');
      253                   
      254           fSub = myInsFolder('Help ',f,'');
      255           fSubSub = myInsDoc('Structure Explorer Intro',fSub,'S','javascript:callHelp(roboLoc,\'structure_explorer/introduction_to_structure_explorer.htm\');',ICONPATH + 'question.gif');
      256           fSubSub = myInsDoc('Molecular Viewers',fSub,'S','javascript:callHelp(roboLoc,\'molecular_viewers/introduction_to_molecular_viewers.htm\');',ICONPATH + 'question.gif');
      257           fSubSub = myInsDoc('Structure Summary',fSub,'S','javascript:callHelp(roboLoc,\'structure_explorer/summary_information.htm\');',ICONPATH + 'question.gif');
      258           fSubSub = myInsDoc('Biological Molecule',fSub,'S','javascript:callHelp(roboLoc,\'data_download/biological_unit/biological_unit_introduction.htm\');',ICONPATH + 'question.gif');
      259           fSubSub = myInsDoc('Biology &amp; Chemistry',fSub,'S','javascript:callHelp(roboLoc,\'quick_links/quick_links_biology_and_chemistry.htm\');',ICONPATH + 'question.gif');
      260           fSubSub = myInsDoc('Sequence Details',fSub,'S','javascript:callHelp(roboLoc,\'quick_links/quick_links_sequence_details.htm\');',ICONPATH + 'question.gif');
      261           fSubSub = myInsDoc('Structural Features',fSub,'S','javascript:callHelp(roboLoc,\'quick_links/quick_links.structural_features.htm\');',ICONPATH + 'question.gif');
      262           fSubSub = myInsDoc('Materials &amp; Methods (X-Ray)',fSub,'S','javascript:callHelp(roboLoc,\'quick_links/materials_and_methods/x-ray_materials_and_methods.htm\');',ICONPATH + 'question.gif');
      263           fSubSub = myInsDoc('Materials &amp; Methods (NMR)',fSub,'S','javascript:callHelp(roboLoc,\'quick_links/materials_and_methods/nmr_materials_and_methods.htm\');',ICONPATH + 'question.gif');
      264       
      265
      266}
      267
      268function addReportTree()
      269{
      270
      271  fSub = myInsDoc('<b>Show Query Details<\/b>',f,'S','/pdb/static.do?p=results/queryDesc.jsp');
      272  fSub = myInsDoc('Results Help',f,'S','javascript:callHelp(\'/robohelp/\',\'query_results_browser/introduction_to_results_browser.htm\');',ICONPATH + 'question.gif'); 
      273 
      274}
      275
      276function addQueriesTree()
      277{
      278   fSub = myInsDoc('Clear queries',f,'S','/pdb/queries/clearqueries.do');
      279}
      280
      281</script>
      282
      283                <script type="text/javascript" language="JavaScript">
      284                  var roboLoc = "/robohelp/";
      285                </script>
      286        </head>
      287
      288  <body bgcolor="#ffffff" style="margin:10px 10px 10px 10px;" onload="liveSearchInit();pdbBodyLoadInit();">
      289
      290
      291<!-- Universal retriever iFrame - for debugging it's a good idea to make the height 60 or so and frameborder set to one -->
      292<iframe src="/pdb/browse/menu_empty.html" name="retriever" id="retriever" width="100%" height="1" frameborder="0">
      293  <!-- This Page requires a modern browser supporting IFRAMES or ILAYERS --><p>&nbsp;</p>
      294</iframe>
      295
      296<!-- MAIN TABLE -->
      297<table border="0" cellpadding="0" cellspacing="0" align="center" ><!-- for debugging use border -->
      298<tbody>
      299
      300 <tr>
      301  <td colspan="3">   
      302
      303 
      304
      305
      306
      307
      308<script language="Javascript" type="text/javascript">
      309function checkSequenceLength()
      310{
      311if ((document.headerQueryForm.inputQuickSearch.value.substr(0,9) == 'sequence:')&&(document.headerQueryForm.inputQuickSearch.value.length < 15))
      312{
      313        alert('Sequence searches must be at least 6 characters long');
      314        return false;
      315}
      316else
      317        return liveSearchSubmit();
      318       
      319}
      320
      321</script>
      322<form action="/pdb/search/navbarsearch.do" onSubmit="return checkSequenceLength();" method="get" name="headerQueryForm">   
      323   <table border="0" cellpadding="0" cellspacing="0" width="100%">   
      324    <tr>
      325     <td width="210"><a href="/pdb"><img alt="RCSB PDB Protein Data Bank | Home" title="RCSB PDB Protein Data Bank | Home" src="/pdb/skins/pastel/images/header/pdblogo.gif" width="198" border="0"></a></td>
      326     <td align="right" class="headertop" colspan="2">
      327      <a href="http://www.wwpdb.org/" target="_blank"><img alt="A Member of the wwPDB" title="A Member of the wwPDB" src="/pdb/skins/pastel/images/header/wwpdb.gif" width="191" height="15" border="0"></a><br/>
      328      An Information Portal to Biological Macromolecular Structures
      329      <br/>
      330      <span class="body">
      331        As of <a href="/pdb/search/smartSubquery.do?smartSearchSubtype=LastLoadQuery">Tuesday Dec 26, 2006</a>&nbsp;<a href="/pdb/rss/LastLoad" title="RSS Feed for the Latest Released Structures"><img alt="RSS Feed for the Latest Released Structures" border="0" src="/pdbstatic/images/feed-icon16x16.png"></a>
      332        there are 40870 Structures
      333        <a href="javascript:callHelp(roboLoc, 'search_database/latest_release/introduction_to_latest_release.htm');"><img alt="&nbsp;&nbsp;? " title="&nbsp;&nbsp;? " src="/pdb/skins/pastel/images/tree/question.gif" border="0" style="vertical-align:middle;"></a>
      334        &nbsp;|&nbsp;
      335        <a href="/pdb/static.do?p=general_information/pdb_statistics/index.html&amp">PDB Statistics</a><a href="javascript:callHelp(roboLoc, 'web_site/pdb_statistics.htm');"><img alt="&nbsp;&nbsp;? " title="&nbsp;&nbsp;? " src="/pdb/skins/pastel/images/tree/question.gif" border="0" style="vertical-align:middle;"></a>
      336      </span>
      337     </td>
      338    </tr>
      339
      340    <tr>
      341     <td style="vertical-align:top;padding-top:0.2em;">
      342      <a href="/pdb/static.do?p=general_information/about_pdb/contact/index.html" class="tabblutxt">Contact Us</a> |
      343      <a href="javascript:callHelp(roboLoc,'site_navigation/introduction_to_site_navigation.htm');" class="tabblutxt">Help</a> |
      344      <a href="javascript:printPage('http://www.rcsb.org/pdb/explore/explore.do?structureId=1CY0');" class="tabblutxt">Print Page</a>
      345     </td>
      346     <td style="background-image:url('/pdb/skins/pastel/images/header/header_bg2.jpg');background-repeat: repeat-x;vertical-align:top;background-position: 0% 100%;" width="37" rowspan="2"><img src="/pdbstatic/images/spacer.gif" alt="" width="37" height="35" border="0"></td>
      347
      348
      349     <td nowrap style="background-image:url('/pdb/skins/pastel/images/header/header_bg3.jpg');background-repeat: repeat-x;background-color:#3333FF;background-position: 0% 100%;padding-right:2px;" class="topnavlinks" rowspan="2">
      350
      351        <table>
      352                <tr>
      353                        <td nowrap class="topnavlinks">
      354                                <input type="hidden" name="newSearch" value="yes">
      355                                <input type="hidden" name="isAuthorSearch" value="no"  >
      356                                <input type="radio" name="radioset" value="All"  checked  class="radio" onclick="javascript:document.headerQueryForm.isAuthorSearch.value='no';">PDB ID or keyword
      357                                <input type="radio" name="radioset" value="Authors"  class="radio" onclick="javascript:if(this.checked){document.headerQueryForm.isAuthorSearch.value='yes';}">Author
      358                        </td>
      359                        <td class="topnavlinks" nowrap>
      360                                <input type="text"  class="input" size="10" name="inputQuickSearch" id="livesearch" onkeypress="liveSearchStart()" onblur="setTimeout('closeResults()',10000);" >
      361                                <div id="LSResult" style="display: none;"><div id="LSShadow"></div></div>
      362                        </td>
      363                        <td class="topnavlinks" nowrap>
      364                        <input type="image" src="/pdb/skins/pastel/images/header/header_search.gif" size="61" value="Search" class="text" align="middle" name="image" alt="Search" title="Search">
      365                    <a href="javascript:callHelp(roboLoc, 'search_database/top_bar_search/top_bar_search.htm');"><img alt="&nbsp;&nbsp;? " title="&nbsp;&nbsp;? " src="/pdb/skins/pastel/images/header/mainquestion.gif" border="0" style="vertical-align:middle;"></a>
      366                                        | <a href="/pdb/search/advSearch.do" class="textwhite">Advanced Search</a>   
      367                        </td>
      368                </tr>
      369        </table>         
      370
      371     </td>
      372    </tr>
      373 
      374    <tr>
      375     <td style="background-image:url('/pdb/skins/pastel/images/header/header_bg1.jpg');text-align:left;background-repeat: repeat-x;vertical-align:top;background-position: 0% 100%;"><img src="/pdbstatic/images/spacer.gif" alt="" width="37" height="13" border="0"></td>
      376    </tr>     
      377   </table>
      378</form> 
      379
      380
      381
      382
      383
      384
      385
      386
      387  </td>
      388 </tr>
      389
      390 <tr valign="top">
      391  <td  class="navbackground" style="width:230px;">
      392
      393 
      394
      395
      396
      397
      398
      399               
      400               
      401   <table border="0" cellpadding="0" cellspacing="0">
      402    <tr>
      403     <td class="navbackground">
      404                <div id="hdrtab">
      405                  <ul>
      406                    <li><a href="/pdb/Welcome.do">Home</a></li>
      407                    <li><a href="/pdb/static.do?p=search/index.html">Search</a></li>
      408                   
      409                    <li id="current"><a>Structure</a></li>
      410                   
      411                  </ul>
      412                </div>
      413          </td>
      414    </tr>
      415    <tr>
      416     <td class="navbackground">
      417                <a style="font-size:1pt;text-decoration:none;color:#FFFF99" href="http://www.treemenu.net/" target=_blank></a>
      418                <span class="TreeviewSpanArea">
      419                <script type="text/javascript" language="JavaScript">
      420                        foldersTree = gFld('', '');
      421                        foldersTree.treeID = 'ExploreRoot';
      422                        foldersTree.xID = foldersTree.treeID;
      423                        f = foldersTree;
      424                        addExploreTree();
      425                        initializeDocument();
      426                        checkLocation();
      427                </script>
      428
      429                </span>
      430      </td>
      431    </tr>
      432    <tr>
      433     <td class="homewhite" height="1"><img src="/pdbstatic/images/spacer.gif" alt="" width="1" height="1" border="0"></td>
      434    </tr>
      435   </table>
      436
      437
      438
      439
      440
      441  </td>
      442
      443  <td valign="top" style="vertical-align:top;">  <!-- BEGIN MAIN RIGHT -->
      444  <table border="0" cellpadding="0" cellspacing="0">
      445   <tr>
      446     <td valign="top" class="maintd">
      447        <noscript><div style="padding-left:8px;font-weight:bold;color:#FF0000;font-size:16px">This browser is either not Javascript enabled or has it turned off.<br />This site will not function correctly without Javascript.</div></noscript>
      448         
      449       
      450
      451
      452
      453
      454
      455
      456
      457<div id="hdrtab">
      458                  <ul>
      459
      460                           <li><a href="/pdb/explore.do?structureId=1CY0">Structure Summary</a></li>
      461                           
      462                           <li><a href="/pdb/explore/biologyAndChemistry.do?structureId=1CY0">Biology & Chemistry</a></li>
      463                           
      464                           <li><a href="/pdb/explore/materialsAndMethods.do?structureId=1CY0">Materials & Methods</a></li>
      465                           
      466                           <li><a href="/pdb/explore/sequence.do?structureId=1CY0">Sequence Details</a></li>
      467                           
      468                           <li><a href="/pdb/explore/geometryDisplay.do?structureId=1CY0">Geometry</a></li>
      469                           
      470                  </ul>
      471                </div>
      472     </td>
      473   </tr>
      474
      475   <tr>
      476    <td>
      477     <font color="RED"><b>LIMITED FUNCTIONALITY BROWSER</b></font>
      478     <br />
      479     <span class="static_header">
      480       You are currently using a browser that is not fully compatible with this website.<br />
      481       If you would like to have full functionality, please upgrade your browser. <br />
      482       
      483                                                                       
      484        <a href="/pdb/static.do?p=home/faq.html#goodBrowsers">List of Supported & Unsupported Browsers for the RCSB Protein Data Bank Web Site</a> <br />
      485
      486       <br />
      487     </span>
      488    </td>
      489   </tr>
      490
      491   <tr>
      492    <td valign="top" class="maintd" style="padding-left:10px;">
      493
      494
      495 
      496
      497
      498
      499 
      500
      501
      502
      503
      504
      505
      506
      507
      508
      509
      510
      511
      512
      513
      514
      515
      516
      517
      518
      519
      520
      521
      522
      523
      524
      525
      526
      527
      528
      529
      530
      531
      532
      533
      534
      535<!---->
      536
      537
      538
      539
      540
      541<script type="text/javascript" language="JavaScript">
      542        
      543                function searchCitationAuthor(author, primary)
      544                {
      545                                document.queryCitationAuthorForm.elements['citation_author.name.value'].value = author;
      546                                document.queryCitationAuthorForm.elements['citation_author.name.comparator'].value = "equals";
      547                                if (primary)
      548                                        document.queryCitationAuthorForm.elements['citation_author.citation_id.value'].value="primary";
      549                                document.queryCitationAuthorForm.submit();
      550                }
      551
      552                function searchStructureAuthor(author)
      553                {
      554                                document.queryStructureAuthorForm.elements['authName'].value = author;
      555                                document.queryStructureAuthorForm.submit();
      556                }
      557               
      558                function searchPdbxKeyword(keyword)
      559                {
      560                  document.queryKeywordsForm.elements['struct_keywords.pdbx_keywords.value'].value = keyword;
      561                  document.queryKeywordsForm.submit();
      562                }
      563               
      564                function searchLigand(id)
      565                {
      566                                document.ligandQueryForm.elements['chem_comp.id.value'].value = id;
      567                                document.ligandQueryForm.elements['chem_comp.id.comparator'].value = "=";
      568                                document.ligandQueryForm.submit();
      569                }
      570                function searchEc(ec)
      571                {
      572                                document.ecQueryForm.elements['entity.pdbx_ec.value'].value = ec;
      573                                document.ecQueryForm.elements['entity.pdbx_ec.comparator'].value = "=";
      574                                document.ecQueryForm.submit();
      575                }
      576                function searchSpaceGroup(sg)
      577                {
      578                        document.sgQueryForm.elements['symmetry.space_group_name_H-M.value'].value = sg;
      579                        document.sgQueryForm.elements['symmetry.space_group_name_H-M.comparator'].value = "=";
      580                        document.sgQueryForm.submit();
      581                }
      582               
      583                function searchSource(natSci, natCommon, genSci, genCommon)
      584                {
      585                        document.srcQueryForm.elements['entity_src_nat.pdbx_organism_scientific.value'].value = natSci;
      586                        document.srcQueryForm.elements['entity_src_nat.common_name.value'].value = natCommon;
      587                        document.srcQueryForm.elements['entity_src_gen.pdbx_gene_src_scientific_name.value'].value = genSci;
      588                        document.srcQueryForm.elements['entity_src_gen.gene_src_common_name.value'].value = genCommon;
      589                        document.srcQueryForm.submit();
      590                }
      591               
      592        </script>
      593                                       
      594
      595
      596
      597<script type="text/javascript" language="JavaScript">
      598
      599        function queryByExample(s, t)
      600        {
      601        }
      602        function FW_startTimeout()
      603        {
      604        }
      605        function removeHighlight()
      606        {
      607        }
      608
      609</script>
      610
      611        <table cellpadding="2" cellspacing="2" border="0" style="text-align: left; width: 100%;">
      612          <tbody>
      613                <tr>
      614                  <td style="vertical-align: top;">
      615                         <table cellpadding="5" cellspacing="2" border="0" style="text-align: left; width: 100%;">
      616                           <tbody>
      617                                 <tr>
      618                                   <td>
      619                <!--div id="hdrtab">
      620                  <ul>
      621                    <li id="current"><a href="#">Structure Summary</a></li>
      622                    <li><a href="/pdb/explore/biologyAndChemistry.do">Biology & Chemistry</a></li>
      623                    <li><a href="/pdb/explore/materialsAndMethods.do">Materials & Methods</a></li>
      624                    <li><a href="/pdb/explore/sequence.do">Sequence Details</a></li>
      625                    <li><a href="/pdb/explore/geometryDisplay.do">Geometry</a></li>
      626                  </ul>
      627                </div-->
      628    </td>
      629                                   <td style="text-align: right;">
      630       
      631                                       
      632
      633
      634                                                <span class="se_pagetitle">1CY0&nbsp;</span>
      635                                                <a href="/pdb/files/1cy0.pdb" title="Display PDB file" target="_blank"><img src="/pdbstatic/images/summary.jpg" alt="Display PDB file" border='0'></a>
      636
      637                                   </td>
      638                                 </tr>
      639                           </tbody>
      640                         </table>
      641                         <table cellpadding="5" cellspacing="5" border="0"  style="text-align: left; width: 100%;">
      642                          <tbody>
      643                                <tr class="se_back1">
      644                                        <td width="15%" align="right" valign="top" class="se_item">
      645                                                Title
      646                                        </td>
      647                                        <td width="85%" valign="top" class="se_datalarge1">
      648                                                       
      649                                                        COMPLEX OF E.COLI DNA TOPOISOMERASE I WITH 3'-5'-ADENOSINE DIPHOSPHATE
      650                                                       
      651                                                        <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="StructureTitle">
      652                                        </td>
      653                                </tr>
      654                                <tr class="se_back2">
      655                                        <td width="15%" align="right" class="se_item">
      656                                                Authors
      657                                        </td>
      658                                        <td width="85%" >
      659                                         <form action="/pdb/search/smartSubquery.do" method="get" name="queryStructureAuthorForm">
      660                                                 <input type="hidden" name="authName" value="">
      661                                                 <input type="hidden" name="smartSearchSubtype" value="AuthorQuery">
      662                                                 <input type="hidden" name="display" value="true">
      663                                                  <a class="seAuthors" onmouseover="this.className='seAuthorsHover';" onmouseout="this.className='seAuthors';" onclick="searchStructureAuthor('Feinberg, H.');">Feinberg, H.</a>,&nbsp;&nbsp;<a class="seAuthors" onmouseover="this.className='seAuthorsHover';" onmouseout="this.className='seAuthors';" onclick="searchStructureAuthor('Changela, A.');">Changela, A.</a>,&nbsp;&nbsp;<a class="seAuthors" onmouseover="this.className='seAuthorsHover';" onmouseout="this.className='seAuthors';" onclick="searchStructureAuthor('Mondragon, A.');">Mondragon, A.</a>
      664                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="StructureExperimentAuthors">
      665                                        </form>
      666                                        </td>
      667                                </tr>
      668                                <tr class="se_back1">
      669                                        <td width="15%" align="right" class="se_item">
      670                                         <form action="/pdb/search/smartSubquery.do" method="get" name="queryCitationAuthorForm">
      671                                                 <input type="hidden" name="citation_author.name.value" value="">
      672                                                 <input type="hidden" name="citation_author.name.comparator" value="contains">
      673                                                 <input type="hidden" name="citation_author.citation_id.value" value="">
      674                                                 <input type="hidden" name="smartSearchSubtype" value="CitationAuthorQuery">
      675                                                 <input type="hidden" name="display" value="true">
      676                                        </form>
      677                                                Primary Citation&nbsp;&nbsp;
      678                                        </td>
      679                                        <td width="85%" class="se_datasmall1">
      680                                                <a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchCitationAuthor('Feinberg, H.', true);">Feinberg, H.</a>,&nbsp;&nbsp;<a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchCitationAuthor('Changela, A.', true);">Changela, A.</a>,&nbsp;&nbsp;<a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchCitationAuthor('Mondragon, A.', true);">Mondragon, A.</a>
      681                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="CitationArticleAuthors">
      682                                               
      683                                                Protein-nucleotide interactions in E. coli DNA topoisomerase I.
      684                                               
      685                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="CitationArticleTitle">
      686                                               
      687                                                <span class="se_journal">Nat.Struct.Biol.</span>
      688                                               
      689
      690                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="CitationJournalName">
      691                                               
      692                                                <span class="se_journal">v6</span>
      693                                               
      694                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="CitationJournalVolume">
      695                                               
      696                                                <span class="se_journal">pp.961-968</span>
      697                                               
      698                                                ,
      699                                                        <span class="se_journal">1999</span>
      700                                               
      701
      702                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="CitationJournalYear">
      703                                                       
      704                                               
      705                                                <br>
      706                                                [&nbsp;<a class="se_datalarge" href="/pdb/explore/pubmed.do?structureId=1CY0" name="Abstract" ALT="View Searchable PubMed Abstract" TITLE="View Searchable PubMed Abstract">Abstract</a>&nbsp;]&nbsp;&nbsp;&nbsp;
      707                                <a class="se_datalarge" href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=PubMed&amp;dopt=Abstract&amp;list_uids=10504732" target="resource_window">
      708                                        <img src="/pdbstatic/explorer/images/abstract_icon.gif" BORDER="0" ALT="View PubMed Abstract at NCBI" TITLE="View PubMed Abstract at NCBI">
      709                                               
      710                                        </td>
      711                                </tr>
      712                                <tr class="se_back2">
      713                                        <td width="15%" align="right" class="se_item">
      714                                                History
      715                                        </td>
      716                                        <td width="85%" class="se_datalarge2">
      717                                                <span class="se_subitem">Deposition&nbsp;&nbsp;</span>
      718                                                1999-08-31
      719                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="DepositionDate">
      720                                                       
      721                                                <span class="se_subitem">&nbsp;Release&nbsp;</span>
      722                                                2000-03-08
      723                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="ReleaseDate">
      724
      725                                         </td>
      726                                </tr>
      727                                <tr class="se_back1">
      728                                        <td width="15%" align="right" class="se_item">
      729                                                Experimental Method
      730                                        </td>
      731                                        <td width="85%" class="se_datalarge1">
      732                                                <span class="se_subitem">Type&nbsp;&nbsp;</span>
      733                                                X-RAY DIFFRACTION
      734                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="">
      735                                                <span class="se_subitem">Data</span>
      736
      737
      738                <a class="se_datasmall1">N/A</a>
      739       
      740
      741
      742                                                </td></tr>
      743
      744
      745                <tr class="se_back2">
      746                        <td width="15%" align="right" class="se_item">
      747                                Parameters&nbsp;&nbsp;
      748                        </td>
      749                        <td width="85%" class="se_datalarge2">
      750                       
      751                         <form action="/pdb/search/smartSubquery.do" method="get" name="sgQueryForm">
      752                                 <input type="hidden" name="smartSearchSubtype" value="SpaceGroupQuery">
      753                                 <input type="hidden" name="display" value="true">
      754                                <input type="hidden" name="symmetry.space_group_name_H-M.value" value="">
      755                                <input type="hidden" name="symmetry.space_group_name_H-M.comparator" value="=">
      756                       
      757                                <table border="0" cellpadding="1" cellspacing="1" width="100%">
      758                                        <tr class="se_subitem2">
      759                                                <td width="20%">
      760                                                        Resolution[&Aring;]
      761                                                    <a href='/pdb/statistics/histogram.do?mdcat=refine&amp;mditem=ls_d_res_high&amp;minLabel=0&amp;maxLabel=5&amp;numOfbars=10'>
      762                                                      <img src='/pdbstatic/images/histogram16x16.jpg' border=0 title='View a histogram of Resolution' alt='View a histogram of Resolution'>
      763                                                    </a>
      764                                                </td>
      765                                                <td width="20%">
      766                                                        R-Value
      767                                                </td>
      768                                                <td width="20%">
      769                                                        R-Free
      770                                                <td width="25%">
      771                                                        Space Group
      772                                                </td>
      773                                        </tr>
      774                                        <tr class="se_subitem2">
      775                                            <td width="20%" class="se_datalarge2">
      776                                                           2.45
      777                                                        <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="Resolution">
      778                                                </td>
      779                                                <td width="20%" align="left" class="se_datalarge2">
      780                                                        0.220
      781                                                        (obs.)
      782                                                </td>
      783                                                <td width="20%" align="left" class="se_datalarge2">
      784                                                        0.274
      785                                                       
      786                                                </td>
      787                                                <td width="25%" class="se_datalarge2">
      788                                                               
      789                                                  <a class="se_datasmall" onclick="searchSpaceGroup('P 21 21 21');" onmouseover="this.className='se_datasmallHover'" onmouseout="this.className='se_datasmall'">
      790                                                  P 2<sub>1</sub> 2<sub>1</sub> 2<sub>1</sub>
      791                                                  </a>
      792                                                           
      793                                                        <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="SpaceGroup">
      794                                                </td>
      795                                   </tr>
      796                        </table>
      797                        </form>
      798                        </td>
      799                </tr>
      800                <tr class="se_back1">
      801                        <td width="15%" align="right" class="se_item">
      802                                Unit Cell&nbsp;&nbsp;
      803                        </td>
      804                        <td width="85%" class="se_datalarge1" valign="top">
      805                                <table border="0" cellpadding="1" cellspacing="1"  width="100%">
      806                                        <tr class="se_subitem1">
      807                                                <td width="20%">
      808                                                        <span class="se_unitcellitem">Length [&Aring;]</span>
      809                                                </td>
      810                                                <td width="13%">
      811                                                        a
      812                                                </td>
      813                                                <td width="13%" >
      814                                                       
      815                                                        <span class="se_datasmall1">63.04</span>
      816                                                       
      817                                                </td>
      818                                                <td width="13%" >
      819                                                        b
      820                                                </td>
      821                                                <td width="13%">
      822                                                       
      823                                                        <span class="se_datasmall1">73.31</span>
      824                                                       
      825                                                </td>
      826                                                <td width="13%" >
      827                                                        c
      828                                                </td>
      829                                                <td width="15%" >
      830                                                       
      831                                                        <span class="se_datasmall1">134.46</span>
      832                                                       
      833                                                </td>
      834                                        </tr>
      835                                        <tr class="se_subitem1">
      836                                                <td width="20%">
      837                                                        <span class="se_unitcellitem">Angles [&#176;]</span>
      838                                                </td>
      839                                                <td width="13%" >
      840                                                        alpha
      841                                                </td>
      842                                                <td width="13%" >
      843                                                       
      844                                                        <span class="se_datasmall1">90.00</span>&nbsp;
      845                                                       
      846                                                </td>
      847                                                <td width="13%">
      848                                                        beta
      849                                                </td>
      850                                                <td width="13%" >
      851                                                       
      852                                                        <span class="se_datasmall1">90.00</span>&nbsp;
      853                                                       
      854                                                </td>
      855                                                <td width="13%" >
      856                                                        gamma
      857                                                </td>
      858                                                <td width="15%" >
      859                                                       
      860                                                        <span class="se_datasmall1">90.00</span>&nbsp;
      861                                                       
      862                                                </td>
      863                                        </tr>
      864                                </table>
      865                        </td>
      866                </tr>
      867
      868               
      869            <tr class="se_back2">
      870                        <td width="15%" align="right" valign="top" class="se_item">
      871                                Molecular Description  Asymmetric Unit
      872                        </td>
      873                        <td width="85%" class="se_datalarge2" valign="top">
      874                       
      875                         <form action="/pdb/search/smartSubquery.do" method="get" name="ecQueryForm">
      876                                 <input type="hidden" name="smartSearchSubtype" value="EnzymeClassificationQuery">
      877                                 <input type="hidden" name="display" value="true">
      878                                <input type="hidden" name="entity.pdbx_ec.value" value="">
      879                                <input type="hidden" name="entity.pdbx_ec.comparator" value="=">
      880
      881                                <!-- %=org.pdb.util.middle.MoleculeDescription.getDescription(myStructureId)%><br-->
      882
      883       
      884                                <span class="se_subitem"><br>Polymer:</span>&nbsp;1&nbsp;&nbsp;
      885<span class="se_subitem">Molecule:</span>&nbsp;DNA TOPOISOMERASE I&nbsp;&nbsp;
      886<span class="se_subitem">Fragment:</span>&nbsp;67 KDA N-TERMINAL FRAGMENT OF E.COLI TOPOISOMERASE I&nbsp;&nbsp;
      887<span class="se_subitem">Chains:</span>&nbsp;A&nbsp;&nbsp;
      888<span class="se_subitem">EC no.:</span>&nbsp;<a class="se_datasmall" onclick="searchEc('5.99.1.2');" onmouseover="this.className='se_datasmallHover'" onmouseout="this.className='se_datasmall'">5.99.1.2</a>&nbsp;<a class="se_datalarge" href="http://www.chem.qmul.ac.uk/iubmb/enzyme/EC5/99/1/2.html" target="resource_window"><img src="/pdbstatic/explorer/images/iubmb_icon.gif" BORDER="0" ALT="Go to IUBMB EC entry" TITLE="Go to IUBMB EC entry"></a>&nbsp;
      889&nbsp;
      890                        </form>                                 
      891
      892                       
      893                                         <form action="/pdb/search/smartSubquery.do" method="get" name="queryKeywordsForm">
      894                                                 <input type="hidden" name="smartSearchSubtype" value="StructureKeywordsQuery">
      895                                                 <input type="hidden" name="display" value="true">
      896                                                 <input type="hidden" name="struct_keywords.pdbx_keywords.value" value="">
      897                                                 <input type="hidden" name="struct_keywords.pdbx_keywords.comparator" value="startswith">
      898                                        </form>
      899
      900
      901                      <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="Compound">
      902                                        </td>
      903                                </tr>
      904                                <tr class="se_back1">
      905                                        <td width="15%" align="right" valign="top" class="se_item">
      906                                                Classification
      907                                        </td>
      908                                        <td width="40%" class="se_datalarge1">
      909                                               
      910                                                <span class="qrb_value">
      911                                                  <a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchPdbxKeyword('ISOMERASE');">
      912                                                    Isomerase
      913                                                  </a>
      914                                                </span>
      915                                               
      916                                                <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="StructureSummary">
      917
      918                                        </td>
      919                                </tr>
      920                        </tbody>
      921                  </table>
      922                  </td>
      923                  <td style="vertical-align: top; text-align: right; width: 250px;">
      924                               
      925
      926
      927
      928
      929
      930
      931
      932
      933
      934
      935<script type="text/javascript" language="JavaScript">
      936        
      937        var isImage = "bio";
      938        function switchStructureImage()
      939        {
      940                if (isImage == "bio") {
      941                        document.switchImageForm.structureImageButton.value = "Asymmetric Unit";
      942                        document.switchImageForm.structureImage.src = '/pdb/images/1cy0_asym_r_250.jpg';
      943                        isImage = "asym";
      944                }
      945                else {
      946                        document.switchImageForm.structureImageButton.value = "Biological Molecule";
      947                        //structureImageText.innerText = "Biological Molecule";
      948                        document.switchImageForm.structureImage.src = '/pdb/images/1cy0_bio_r_250.jpg';
      949                        isImage = "bio";
      950                }
      951        }
      952</script>
      953
      954
      955
      956<form name="switchImageForm" action="">
      957
      958
      959<table border="0" cellpadding="0" cellspacing="0" width="256">
      960        <tr class="homedark">
      961                <td class="putih4">&nbsp;Images and Visualization</td>
      962                <td align="right" valign="top"><img
      963                        src="/pdbstatic/home/tablecorner.gif" alt="" border="0"></td>
      964        </tr>
      965        <tr>
      966                <td colspan="2">
      967                <table border="0" cellpadding="1" cellspacing="0" width="100%"
      968                        class="homedark">
      969                        <tr>
      970                                <td>
      971                                <table border="0" cellpadding="1" cellspacing="0" width="100%"
      972                                        class="homewhite">
      973
      974
      975
      976
      977                                        <!--table border="0" width="250" align="right" bgcolor="#9999cc"-->
      978                                       
      979                                        <tr>
      980                                                <td align="center"><font size="2" face="Arial, Arial, Helvetica">Biological
      981                                                Molecule / Asymmetric Unit</font></td>
      982                                        </tr>
      983                                        <tr>
      984                                                <td align="center"><img id="structureImage" name="structureImage"
      985                                                        src="/pdb/images/1cy0_asym_r_250.jpg" border="0"
      986                                                        alt="Biological Molecule / Asymmetric Unit Image for 1CY0">
      987                                                </td>
      988                                        </tr>
      989                                       
      990                                        <tr>
      991                                                <td align="center" class="it_item">
      992                                                <table>
      993                                                        <tr>
      994                                                                <td class="it_item" colspan="4" align="center">Display Options</td>
      995                                                        </tr>
      996                                                        <tr>
      997                                                                <td align="center"><a class="imagetable"
      998                                                                        href="/pdb/static.do?p=explorer/viewers/king.jsp"
      999                                                                        title="KiNG requires Java">KiNG</a></td>
      1000                                                        </tr>
      1001                                                        <tr>
      1002                                                                <td align="center"><a class="imagetable"
      1003                                                                        href="/pdb/static.do?p=explorer/viewers/jmol.jsp"
      1004                                                                        title="Jmol requires Java">Jmol</a></td>
      1005                                                        </tr>
      1006                                                        <tr>
      1007                                                                <td align="center"><a class="imagetable"
      1008                                                                        href="/pdb/static.do?p=explorer/viewers/webmol.jsp"
      1009                                                                        title="WebMol requires Java">WebMol</a></td>
      1010                                                        </tr>
      1011                                                        <tr>
      1012                                                                <td align="center"><a class="imagetable"
      1013                                                                        href="/pdb/Viewers/ProteinWorkshop/protein_workshop_launch.jsp"
      1014                                                                        title="ProteinWorkshop requires Java">Protein Workshop</a></td>
      1015                                                        </tr>
      1016                                                        <tr><td align="center"><a class="imagetable" href="/pdb/static.do?p=Viewers/QuickPDB/quickPDBApplet.jsp" title="QuickPDB requires Java">QuickPDB</a></td></tr>
      1017                                                        <tr>
      1018                                                                <td align="center"><a class="imagetable"
      1019                                                                        href="/pdb/explore/images.do?structureId=1CY0">All
      1020                                                                Images</a></td>
      1021                                                        </tr>
      1022
      1023
      1024                                                        <!--
      1025                                <tr>
      1026                                        <td class="it_item">Web Start&nbsp;&nbsp;</td>
      1027                                        <td><a class="imagetable" href="/pdb/Viewers/king.jsp" title="King requires Java">KiNG</a></td>
      1028                                        <td><a class="imagetable" href="/pdb/Viewers/jmol.jsp" title="Jmol requires Java">Jmol</a></td>
      1029                                        <td><a class="imagetable" href="/pdb/Viewers/webmol.jsp" title="WebMol requires Java">WebMol</a></td>
      1030                                </tr>
      1031                                -->
      1032                                                </table>
      1033                                                </td>
      1034                                        </tr>
      1035
      1036
      1037                                </table>
      1038                                </td>
      1039
      1040                        </tr>
      1041                </table>
      1042                </td>
      1043        </tr>
      1044</table>
      1045
      1046</form>
      1047
      1048                  </td>
      1049                </tr>
      1050          </tbody>
      1051        </table>
      1052
      1053
      1054        <table border="0" cellpadding="4" cellspacing="4" width="100%">
      1055                                        <tr class="se_back2">
      1056                                                <td width="15%" align="right" valign="top" class="se_item">
      1057                                                        Source
      1058                                                 <form action="/pdb/search/smartSubquery.do" method="get" name="srcQueryForm">
      1059                                                        <!--  searchSource(natSci, natCommon, genSci, genCommon) -->
      1060                                                         <input type="hidden" name="smartSearchSubtype" value="CifFieldsQuery">
      1061                                                         <input type="hidden" name="entity_src_nat.pdbx_organism_scientific.value" value="">
      1062                                                         <input type="hidden" name="entity_src_nat.common_name.value" value="">
      1063                                                         <input type="hidden" name="entity_src_gen.pdbx_gene_src_scientific_name.value" value="">
      1064                                                         <input type="hidden" name="entity_src_gen.gene_src_common_name.value" value="">
      1065                                                </form>
      1066                                                </td>
      1067                                                <td width="85%" class="se_datalarge2" valign="top">
      1068               
      1069                        <span class="se_subitem">Polymer:</span>
      1070                                        &nbsp;1 &nbsp;&nbsp;
      1071                                        <span class="se_subitem">Scientific Name:</span>
      1072                                        <span class="qrb_value">
      1073                                          <a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchSource('', '', 'ESCHERICHIA COLI', '');">
      1074                                            &nbsp;Escherichia coli&nbsp;&nbsp;
      1075                                          </a>
      1076                                        </span>
      1077                                        <a class="se_datalarge" href="http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=562" target="resource_window"><img src="/pdbstatic/explorer/images/taxonomy_icon.gif" BORDER="0" ALT="Go to NCBI Taxonomy entry" TITLE="Go to NCBI Taxonomy entry"></a>
      1078               
      1079                                        <span class="se_subitem">Common Name:</span>
      1080                                        <span class="qrb_value">
      1081                                          <a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchSource('', '', '', 'BACTERIA');">
      1082                                            &nbsp;Bacteria&nbsp;&nbsp;
      1083                                          </a>
      1084                                        </span>
      1085               
      1086                                        <span class="se_subitem">Expression system:</span>
      1087                                        <span class="qrb_value">
      1088                                          <a class="sePrimarycitations" onmouseover="this.className='sePrimarycitationsHover';" onmouseout="this.className='sePrimarycitations';" onclick="searchSource('', '', 'ESCHERICHIA COLI', '');">
      1089                                            &nbsp;Escherichia coli&nbsp;&nbsp;
      1090                                          </a>
      1091                                        </span>
      1092
      1093       
      1094           <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="Source">
      1095                                        </td>
      1096                                </tr>
      1097                                       
      1098                                <tr class="se_back1">
      1099                                        <td width="15%" align="right" class="se_item">
      1100                                                Related PDB Entries
      1101                                        </td>
      1102                                        <td width="85%" class="se_datalarge1">
      1103                                        <table border="0" cellpadding="1" cellspacing="1" width="100%">
      1104                                                <tr>
      1105                                                        <td width="20%">
      1106                                                                <span class="se_subitem">Id</span>
      1107                                                        </td>
      1108                                                        <td width="80%">
      1109                                                                <span class="se_subitem">Details</span>
      1110                                                        </td>
      1111                                                </tr>
      1112                 
      1113                                <tr>
      1114                                         <td width="15%" class="se_datalarge1">
      1115                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CYY" >1CYY</a>&nbsp;
      1116                                         </td>
      1117                                         <td width="65%" class="se_datalarge1">
      1118                                                 Crystal structure of the 30 kDa fragment of E. coli DNA topoisomerase I. Hexagonal form&nbsp;
      1119                                         </td>
      1120                                 </tr>
      1121               
      1122                                <tr>
      1123                                         <td width="15%" class="se_datalarge1">
      1124                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY9" >1CY9</a>&nbsp;
      1125                                         </td>
      1126                                         <td width="65%" class="se_datalarge1">
      1127                                                 Crystal structure of the 30 kDa fragment of E. coli DNA topoisomerase I. Monoclinic form&nbsp;
      1128                                         </td>
      1129                                 </tr>
      1130               
      1131                                <tr>
      1132                                         <td width="15%" class="se_datalarge1">
      1133                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY8" >1CY8</a>&nbsp;
      1134                                         </td>
      1135                                         <td width="65%" class="se_datalarge1">
      1136                                                 Complex of E.coli DNA topoisomerase I with 5'-thymidine monophosphate and 3'-thymidine monophosphate&nbsp;
      1137                                         </td>
      1138                                 </tr>
      1139               
      1140                                <tr>
      1141                                         <td width="15%" class="se_datalarge1">
      1142                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY7" >1CY7</a>&nbsp;
      1143                                         </td>
      1144                                         <td width="65%" class="se_datalarge1">
      1145                                                 Complex of E.coli DNA topoisomerase I with 5'-thymidine monophosphate&nbsp;
      1146                                         </td>
      1147                                 </tr>
      1148               
      1149                                <tr>
      1150                                         <td width="15%" class="se_datalarge1">
      1151                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY6" >1CY6</a>&nbsp;
      1152                                         </td>
      1153                                         <td width="65%" class="se_datalarge1">
      1154                                                 Complex of E.coli DNA topoisomerase I with 3'-thymidine monophosphate&nbsp;
      1155                                         </td>
      1156                                 </tr>
      1157               
      1158                                <tr>
      1159                                         <td width="15%" class="se_datalarge1">
      1160                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY4" >1CY4</a>&nbsp;
      1161                                         </td>
      1162                                         <td width="65%" class="se_datalarge1">
      1163                                                 Complex of E.coli DNA topoisomerase I with 5'pTpTpTp3'&nbsp;
      1164                                         </td>
      1165                                 </tr>
      1166               
      1167                                <tr>
      1168                                         <td width="15%" class="se_datalarge1">
      1169                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY2" >1CY2</a>&nbsp;
      1170                                         </td>
      1171                                         <td width="65%" class="se_datalarge1">
      1172                                                 Complex of E.coli DNA topoisomerase I with TpTpTp3'&nbsp;
      1173                                         </td>
      1174                                 </tr>
      1175               
      1176                                <tr>
      1177                                         <td width="15%" class="se_datalarge1">
      1178                                                <a class="se_datalarge" href="/pdb/explore.do?structureId=1CY1" >1CY1</a>&nbsp;
      1179                                         </td>
      1180                                         <td width="65%" class="se_datalarge1">
      1181                                                 COMPLEX OF E.COLI DNA TOPOISOMERASE I WITH 5'pTpTpT&nbsp;
      1182                                         </td>
      1183                                 </tr>
      1184                               
      1185                         </table>
      1186                        </td>
      1187                </tr>                           
      1188                       
      1189        <!-- Display one or more non - polymers such as ligands here -->
      1190               
      1191                <tr class="se_back2">
      1192                        <td width="15%" align="right" valign="top" class="se_item">
      1193                                Chemical Component&nbsp;&nbsp;
      1194                        </td>
      1195                        <td width="85%" valign="top">
      1196                                <table border="0" cellpadding="1" cellspacing="1"  width="100%" >
      1197                                 <tr class="se_subitem2">
      1198                                         <td width="10%">
      1199                                                 Identifier
      1200                                         </td>
      1201                                         <td width="35%">
      1202                                                 Name
      1203                                         </td>
      1204                                         <td width="25%">
      1205                                                 Formula
      1206                                         </td>
      1207                                         <td width="20%">
      1208                                                 Drug Similarity
      1209                                         </td>
      1210                                         <td width="20%">
      1211                                                 Ligand Structure
      1212                                         </td>
      1213                                         
      1214                                         <td width="20%">
      1215                                                 Ligand Interaction
      1216                                         </td>
      1217                                         
      1218                                         <td>
      1219                                                <form action="/pdb/search/smartSubquery.do" method="get" name="ligandQueryForm">
      1220                                                 <input type="hidden" name="smartSearchSubtype" value="LigandIdQuery">
      1221                                                 <input type="hidden" name="display" value="true">
      1222                                                        <input type="hidden" name="chem_comp.id.value" value="">
      1223                                                        <input type="hidden" name="chem_comp.id.comparator" value="=">
      1224                                                </form>
      1225                                         </td>
      1226                                 </tr>
      1227                                 
      1228                 
      1229                                 <tr>
      1230                                         <td width="5%" class="se_datalarge2" valign="middle">
      1231                                                        <a class="se_datalarge" onclick="searchLigand('A3P');" onmouseover="this.className='se_datalargeHover'" onmouseout="this.className='se_datalarge'">A3P</a>
      1232                                            <img src="/pdbstatic/explorer/images/spacer.gif" alt="" name="NonPolymerEntities">&nbsp;
      1233                                         </td>
      1234                                         <td width="30%" class="se_datalarge2">
      1235                                                ADENOSINE-3'-5'-DIPHOSPHATE&nbsp;
      1236                                         </td>
      1237                                         <td width="20%" class="se_formula2">
      1238                                                C<sub>1</sub><sub>0</sub> H<sub>1</sub><sub>5</sub> N<sub>5</sub> O<sub>1</sub><sub>0</sub> P<sub>2</sub> &nbsp;
      1239                                         </td>
      1240                                         <td width="10%" class="se_datalarge2">
      1241                                                 <a class="se_datasmall" href="http://bioinformatics.charite.de/superligands/drug_similarity.php?hetero=A3P" target=resource_window>
      1242                                                     [ View ]
      1243                                                 </a>
      1244                                         </td>
      1245                                         <td width="15%" class="se_datalarge2">
      1246                                                 <a class="se_datasmall" href="/pdb/explore/marvin.do?handler=structureExplorer&amp;hetId=A3P&amp;sid=1CY0">
      1247                                                     [ View ]
      1248                                                 </a>
      1249                                         </td>
      1250                                         
      1251                                         <td width="20%" class="se_datalarge2">
      1252                                                 <a class="se_datasmall" href="/pdb/explore/ligand3d.jnlp?hetId=A3P">
      1253                                                     [ View ]
      1254                                                 </a>
      1255                                         </td>
      1256                                         
      1257                                 </tr>
      1258                       
      1259                       
      1260                                </table>
      1261                         </td>
      1262                    </tr>
      1263   
      1264     
      1265
      1266 <tr class="se_back1">
      1267                                        <td width="15%" align="right" valign="top" class="se_item">
      1268                                                <span class="external_ref">SCOP Classification <font size="-2">(version&nbsp;1.69)</font></span>
      1269                                        </td>
      1270                                        <td width="85%" valign="top">
      1271                                    <table border="0" cellpadding="1" cellspacing="1"  width="100%" >
      1272                                             <tr class="se_subitem1">
      1273                                                    <td width="12%">
      1274                                                           Domain Info
      1275                                                   </td>
      1276                                                    <td width="13%">
      1277                                                           Class
      1278                                                   </td>
      1279                                                    <td width="15%">
      1280                                                           Fold
      1281                                                   </td>
      1282                                                   <td width="15%">
      1283                                                          Superfamily
      1284                                                   </td>
      1285                                                   <td width="15%">
      1286                                                          Family
      1287                                                   </td>
      1288                                                   <td width="15%">
      1289                                                          Domain
      1290                                                   </td>
      1291                                                   <td width="15%">
      1292                                                         Species
      1293                                                    </td>
      1294                                         </tr>
      1295
      1296                                         <tr>
      1297                                        <td width="12%" class="se_datasmall1">
      1298                                                d1cy0a_
      1299                                        </td>
      1300
      1301                                                          <td width="13%" class="se_datasmall1">
      1302                                                                          <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=11&amp;n=56572"> Multi-domain proteins (alpha and beta)</a>
      1303                                                          </td>
      1304
      1305                                                          <td width="15%" class="se_datalarge1">
      1306                                                                          <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=11&amp;n=56711"> Prokaryotic type I DNA topoisomerase</a>
      1307                                                          </td>
      1308
      1309                                                          <td width="15%" class="se_datalarge1">
      1310                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=11&amp;n=56712"> Prokaryotic type I DNA topoisomerase</a>
      1311                                                          </td>
      1312
      1313                                                          <td width="15%" class="se_datalarge1">
      1314                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=11&amp;n=56713"> Prokaryotic type I DNA topoisomerase</a>
      1315                                                          </td>
      1316
      1317                                                          <td width="15%" class="se_datalarge1">
      1318                                                                          <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=11&amp;n=56714"> DNA topoisomerase I, 67K N-terminal domain</a>
      1319                                                          </td>
      1320
      1321                                                          <td width="15%" class="se_datalarge1">
      1322                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=11&amp;n=56715"> Escherichia coli</a>
      1323                                                          </td>
      1324                                           </tr>
      1325
      1326                        </table>
      1327                      </td>
      1328                        </tr>         
      1329
      1330
      1331
      1332                                <tr class="se_back2">
      1333                                        <td width="15%" align="right" valign="top" class="se_item">
      1334                                                <span class="external_ref">CATH Classification <font size="-2">(version v2.6.0)</font></span>
      1335                                        </td>
      1336                                        <td width="85%" valign="top">
      1337                                            <table border="0" cellpadding="1" cellspacing="1"  width="100%" >
      1338                                             <tr class="se_subitem2">
      1339                                                            <td width="20%">
      1340                                                                   Domain
      1341                                                           </td>
      1342                                                           <td width="20%">
      1343                                                                  Class
      1344                                                           </td>
      1345                                                           <td width="20%">
      1346                                                                  Architecture
      1347                                                           </td>
      1348                                                           <td width="20%">
      1349                                                                  Topology
      1350                                                           </td>
      1351                                                           <td width="20%">
      1352                                                                 Homology
      1353                                                            </td>
      1354                                              </tr>
      1355
      1356                                          <tr>
      1357                                          <td width="20%" class="se_datasmall2">
      1358                                                                           1cy0A1
      1359                                                          </td>
      1360
      1361                                                          <td width="20%" class="se_datasmall2">
      1362                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1274">Alpha Beta</a>
      1363                                                          </td>
      1364
      1365                                                          <td width="20%" class="se_datasmall2">
      1366                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1842">3-Layer(aba) Sandwich</a>
      1367                                                          </td>
      1368       
      1369                                                          <td width="20%" class="se_datasmall2">
      1370                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1978">Rossmann fold</a>
      1371                                                          </td>
      1372
      1373                                                          <td width="20%" class="se_datasmall2">
      1374                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=2009">ISOMERASE</a>
      1375                                                          </td>
      1376                                                </tr>       
      1377
      1378                                          <tr>
      1379                                          <td width="20%" class="se_datasmall2">
      1380                                                                           1cy0A2
      1381                                                          </td>
      1382
      1383                                                          <td width="20%" class="se_datasmall2">
      1384                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1">Mainly Alpha</a>
      1385                                                          </td>
      1386
      1387                                                          <td width="20%" class="se_datasmall2">
      1388                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=2">Orthogonal Bundle</a>
      1389                                                          </td>
      1390       
      1391                                                          <td width="20%" class="se_datasmall2">
      1392                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=352">Topoisomerase I; domain 2</a>
      1393                                                          </td>
      1394
      1395                                                          <td width="20%" class="se_datasmall2">
      1396                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=353">Topoisomerase I, domain 2</a>
      1397                                                          </td>
      1398                                                </tr>       
      1399
      1400                                          <tr>
      1401                                          <td width="20%" class="se_datasmall2">
      1402                                                                           1cy0A3
      1403                                                          </td>
      1404
      1405                                                          <td width="20%" class="se_datasmall2">
      1406                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=762">Mainly Beta</a>
      1407                                                          </td>
      1408
      1409                                                          <td width="20%" class="se_datasmall2">
      1410                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1229">Distorted Sandwich</a>
      1411                                                          </td>
      1412       
      1413                                                          <td width="20%" class="se_datasmall2">
      1414                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1248">Topoisomerase I; domain 3</a>
      1415                                                          </td>
      1416
      1417                                                          <td width="20%" class="se_datasmall2">
      1418                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1249">Topoisomerase I, domain 3</a>
      1419                                                          </td>
      1420                                                </tr>       
      1421
      1422                                          <tr>
      1423                                          <td width="20%" class="se_datasmall2">
      1424                                                                           1cy0A4
      1425                                                          </td>
      1426
      1427                                                          <td width="20%" class="se_datasmall2">
      1428                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=1">Mainly Alpha</a>
      1429                                                          </td>
      1430
      1431                                                          <td width="20%" class="se_datasmall2">
      1432                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=2">Orthogonal Bundle</a>
      1433                                                          </td>
      1434       
      1435                                                          <td width="20%" class="se_datasmall2">
      1436                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=307">Topoisomerase I; domain 4</a>
      1437                                                          </td>
      1438
      1439                                                          <td width="20%" class="se_datasmall2">
      1440                                                                           <a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=12&amp;n=308">Topoisomerase I, domain 4</a>
      1441                                                          </td>
      1442                                                </tr>       
      1443     
      1444                        </table>
      1445                      </td>
      1446                        </tr>                   
      1447
      1448                <tr class="se_back1">
      1449                                        <td width="15%" align="right" valign="top" class="se_item">
      1450                                                <span class="external_ref">PFAM Classification </span>
      1451                                        </td>
      1452                                        <td width="85%" valign="top">
      1453                                            <table border="0" cellpadding="1" cellspacing="1"  width="100%" >
      1454                                             <tr class="se_subitem1">
      1455                                                            <td width="5%">
      1456                                                                   Chain
      1457                                                           </td>
      1458                                                           <td width="20%">
      1459                                                                  PFAM Accession
      1460                                                           </td>
      1461                                                           <td width="15%">
      1462                                                                  PFAM ID
      1463                                                           </td>
      1464                                                           <td width="25%">
      1465                                                                  Description
      1466                                                           </td>
      1467                                                           <td width="15%">
      1468                                                                 Type
      1469                                                            </td>
      1470                                                           <td width="20%">
      1471                                                                 Clan ID                                                           
      1472                                              </tr>
      1473
      1474
      1475                                                <tr>
      1476                                          <td width="5%" class="se_datasmall1">
      1477                                                                           A
      1478                                                          </td>
      1479                                                          <td width="20%" class="se_datasmall1">
      1480                                                                           <a class="se_datalarge" href="http://www.sanger.ac.uk/cgi-bin/Pfam/getacc?PF01131" target=resource_window>PF01131</a>
      1481                                                          </td>
      1482                                                          <td width="15%" class="se_datasmall1">
      1483                                                                           Topoisom_bac
      1484                                                          </td>
      1485                                                          <td width="25%" class="se_datasmall1">
      1486                                                                           DNA topoisomerase
      1487                                                          </td>
      1488                                                          <td width="15%" class="se_datasmall1">
      1489                                                                           Family
      1490                                                          </td>
      1491                                                          <td width="20%" class="se_datasmall1" title="Clan Description: n/a">
      1492                                                                           n/a</a>
      1493                                                          </td>
      1494                                                </tr>       
      1495
      1496                                                <tr>
      1497                                          <td width="5%" class="se_datasmall1">
      1498                                                                           A
      1499                                                          </td>
      1500                                                          <td width="20%" class="se_datasmall1">
      1501                                                                           <a class="se_datalarge" href="http://www.sanger.ac.uk/cgi-bin/Pfam/getacc?PF01751" target=resource_window>PF01751</a>
      1502                                                          </td>
      1503                                                          <td width="15%" class="se_datasmall1">
      1504                                                                           Toprim
      1505                                                          </td>
      1506                                                          <td width="25%" class="se_datasmall1">
      1507                                                                           Toprim domain
      1508                                                          </td>
      1509                                                          <td width="15%" class="se_datasmall1">
      1510                                                                           Family
      1511                                                          </td>
      1512                                                          <td width="20%" class="se_datasmall1" title="Clan Description: n/a">
      1513                                                                           n/a</a>
      1514                                                          </td>
      1515                                                </tr>       
      1516
      1517                                        </table>
      1518                      </td>
      1519                        </tr>             
      1520
      1521
      1522                                  <tr class="se_back2">
      1523                                        <td width="15%" align="right" valign="top" class="se_item">
      1524                                                <span class="external_ref">GO Terms</span>
      1525                                        </td>
      1526                                        <td width="85%" valign="top">
      1527                                    <table border="0" cellpadding="1" cellspacing="1"  width="100%" >
      1528                                     <tr class="se_subitem1">
      1529                                            <td width="25%">
      1530                                                        Polymer
      1531                                           </td>
      1532                                           <td width="25%">
      1533                                                   Molecular Function
      1534                                           </td>
      1535                                           <td width="25%">
      1536                                                   Biological Process
      1537                                           </td>
      1538                                           <td width="25%">
      1539                                                   Cellular Component
      1540                                            </td>
      1541                                  </tr>
      1542                                 
      1543
      1544                <tr>
      1545                                         <td width="25%" class="se_datasmall1">
      1546                                                        DNA TOPOISOMERASE I (1CY0:A)
      1547                                         </td>
      1548                                         <td width="25%" class="se_datasmall1">
      1549                                               <ul>
      1550
      1551                         <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=6&amp;n=3676">nucleic acid binding</a>
      1552
      1553                         <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=6&amp;n=3677">DNA binding</a>
      1554
      1555                         <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=6&amp;n=3916">DNA topoisomerase activity</a>
      1556
      1557                         <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=6&amp;n=3917">DNA topoisomerase type I activity</a>
      1558
      1559                      </ul>
      1560                   </td>
      1561                   <td width="25%" class="se_datasmall1">
      1562                                               <ul>
      1563
      1564                           <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=4&amp;n=6265">DNA topological change</a>
      1565
      1566                           <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=4&amp;n=6268">DNA unwinding during replication</a>
      1567
      1568                           <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=4&amp;n=6304">DNA modification</a>
      1569
      1570                      </ul>
      1571                   </td>
      1572                    <td width="25%" class="se_datasmall1">
      1573                                               <ul>
      1574
      1575                           <li><a class="se_datasmall" href="/pdb/search/smartSubquery.do?smartSearchSubtype=TreeQuery&t=5&amp;n=5694">chromosome</a>
      1576
      1577                      </ul>
      1578                   </td>
      1579                </tr>
      1580
      1581                        </table>
      1582                        </td>
      1583                  </tr>
      1584                  <tr>
      1585                          <td>
      1586                          <!-- Form is setup for the PDF Creator to grab the data -->
      1587                                <FORM NAME="PDFCREATOR" ACTION="/pdb/sepdf" method="post" target="sepdfwin">
      1588                                        <input type="hidden" name="strId" value="1CY0">
      1589                                        <input type="hidden" name="strTitle" value="COMPLEX OF E.COLI DNA TOPOISOMERASE I WITH 3'-5'-ADENOSINE DIPHOSPHATE">
      1590                                        <input type="hidden" name="strAuthors" value="Feinberg, H., Changela, A., Mondragon, A.">
      1591                                        <input type="hidden" name="strPrimaryCitations" value="Feinberg, H., Changela, A., Mondragon, A.">
      1592                                        <input type="hidden" name="strCitationTitle" value="Protein-nucleotide interactions in E. coli DNA topoisomerase I.">
      1593                                        <input type="hidden" name="strJournalAbbrev" value="Nat.Struct.Biol.">
      1594                                        <input type="hidden" name="strJounralVolume" value="v6">
      1595                                        <input type="hidden" name="strJournalPage" value="961-968">
      1596                                        <input type="hidden" name="strJournalYear" value="1999">
      1597                                        <input type="hidden" name="strDeposition" value="1999-08-31">
      1598                                        <input type="hidden" name="strRelease" value="2000-03-08">
      1599                                        <input type="hidden" name="strExpMethod" value="X-RAY DIFFRACTION">
      1600                                        <input type="hidden" name="strResolution" value="2.450000047683716">
      1601                                        <input type="hidden" name="strRValue" value="0.2199999988079071">
      1602                                        <input type="hidden" name="strRValueType" value="(obs.)">
      1603                                        <input type="hidden" name="strRFree" value="0.27399998903274536">
      1604
      1605                                                                               
      1606                                        <input type="hidden" name="strSpaceGroup" value="P 21 21 21">
      1607                                       
      1608                                       
      1609                                       
      1610                                        <input type="hidden" name="strLengthA" value="63.040000915527344">
      1611                                       
      1612                                       
      1613                                       
      1614                                       
      1615                                        <input type="hidden" name="strLengthB" value="73.30999755859375">                                       
      1616                                                                               
      1617
      1618                                       
      1619                                       
      1620                                        <input type="hidden" name="strLengthC" value="134.4600067138672">                                       
      1621                                                                               
      1622                                       
      1623                                       
      1624                                        <input type="hidden" name="strAngleA" value="90.0">                                     
      1625                                                                               
      1626                                       
      1627                                       
      1628                                        <input type="hidden" name="strAngleB" value="90.0">                                     
      1629                                                                               
      1630                                       
      1631                                       
      1632                                        <input type="hidden" name="strAngleC" value="90.0">                                     
      1633                                                       
      1634                                       
      1635                                                               
      1636                                        <input type="hidden" name="strMolDesc" value="">
      1637                                        <input type="hidden" name="strKeywords" value="ISOMERASE">
      1638                                        <input type="hidden" name="strSourceLine" value="Polymer: 1, Scientific Name: ESCHERICHIA COLI
      1639Common Name: BACTERIA     Expression System: ESCHERICHIA COLI">
      1640                                        <input type="hidden" name="strChemCompIdList" value="A3P,">
      1641                                        <input type="hidden" name="strChemCompNameList" value="ADENOSINE-3'-5'-DIPHOSPHATE,">
      1642                                        <input type="hidden" name="strChemCompFormulaList" value="C10 H15 N5 O10 P2,">
      1643                                        <input type="hidden" name="strChemCompListLen" value="1">
      1644                                        <input type="hidden" name="strScopFoldDesc" value="Prokaryotic type I DNA topoisomerase">
      1645                                        <input type="hidden" name="strScopSFDesc" value="Prokaryotic type I DNA topoisomerase">
      1646                                        <input type="hidden" name="strScopFamDesc" value="Prokaryotic type I DNA topoisomerase">
      1647                                        <input type="hidden" name="strScopDomDesc" value="DNA topoisomerase I, 67K N-terminal domain">
      1648                                        <input type="hidden" name="strScopSpeciesDesc" value="Escherichia coli">
      1649                                        <input type="hidden" name="strCathDomainList" value="1cy0A1,1cy0A2,1cy0A3,1cy0A4,">
      1650                                        <input type="hidden" name="strCathClassList" value="Alpha Beta,Mainly Alpha,Mainly Beta,Mainly Alpha,">
      1651                                        <input type="hidden" name="strCathArchitectureList" value="3-Layer(aba) Sandwich,Orthogonal Bundle,Distorted Sandwich,Orthogonal Bundle,">
      1652                                        <input type="hidden" name="strCathTopologyList" value="Rossmann fold,Topoisomerase I; domain 2,Topoisomerase I; domain 3,Topoisomerase I; domain 4,">
      1653                                        <input type="hidden" name="strCathHomologyList" value="ISOMERASE,Topoisomerase I, domain 2,Topoisomerase I, domain 3,Topoisomerase I, domain 4,">
      1654                                        <input type="hidden" name="strCathListLen" value="4">
      1655                                        <input type="hidden" name="strGoMoleculeList" value="DNA TOPOISOMERASE I*,*">                                   
      1656                                        <input type="hidden" name="strGoMolecularFunctionList" value="nucleic acid binding,DNA binding,DNA topoisomerase activity,DNA topoisomerase type I activity,||DNA topological change,DNA unwinding during replication,DNA modification,chromosome,">                                   
      1657                                        <input type="hidden" name="strGoBiologicalProcessList" value="||">                                     
      1658                                        <input type="hidden" name="strGoCellularComponentList" value="||">                                     
      1659                                        <input type="hidden" name="strGoListLen" value="1">                                     
      1660
      1661                                       
      1662                                       
      1663                                       
      1664                                        <!--a href="#" onClick="javascript:document.PDFCREATOR.submit();">|PDF|</a-->
      1665                                </form>
      1666               
      1667                          </td>
      1668                  </tr>
      1669        </table>
      1670
      1671
      1672</td>
      1673   </tr>
      1674   <tr>
      1675    <td valign="top" class="maintd"> </td>
      1676   </tr>
      1677  </table>
      1678
      1679  </td>
      1680 </tr>  <!-- END MAIN RIGHT -->
      1681
      1682
      1683 
      1684 <tr>
      1685  <td colspan="3">   
      1686
      1687 
      1688
      1689<table width="100%" border="0" cellpadding="0" cellspacing="0">
      1690 <tr>  <!-- BEGIN BOTTOM BORDER -->
      1691  <td class="foothomelight"><img src="/pdbstatic/images/spacer.gif" alt="" height="15" border="0"></td>
      1692  <td class="foothomelight" colspan="2"></td>
      1693 </tr>
      1694 <tr>
      1695  <td class="foothomedark1" colspan="3">
      1696    <a class="foothomedark1" href="http://home.rcsb.org/" target="_blank"><i>&copy; RCSB Protein Data Bank &nbsp;&nbsp;</i></a>
      1697  </td>
      1698 </tr>  <!-- END BOTTOM BORDER -->
      1699
      1700<tr>
      1701 <td colspan="3"><br></td>
      1702</tr>
      1703</table>
      1704
      1705  </td>
      1706 </tr>
      1707
      1708</tbody>
      1709</table>
      1710
      1711<script type="text/javascript" language="JavaScript" src="/pdbstatic/common/lib/wz_tooltip.js"></script>
      1712<script type="text/javascript" language=javascript src="/pdbstatic/common/lib/awstats_misc_tracker.js"></script>
      1713<script type="text/javascript" language="JavaScript">
      1714var htmlHttpLoader = new RemoteFileLoader('htmlHttpLoader');
      1715// Props to Simon Willison:
      1716// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
      1717var oldhandler = window.onload;
      1718window.onload = (typeof oldhandler == "function")
      1719    ? function() { oldhandler(); initExpandableLists(); } : initExpandableLists;
      1720</script>
      1721</body>
      1722</html>
      -
      - - - -
      - -
      - - - - - - - - - - - diff --git a/vendor/gems/hpricot-0.6/test/files/immob.html b/vendor/gems/hpricot-0.6/test/files/immob.html deleted file mode 100644 index b510e63..0000000 --- a/vendor/gems/hpricot-0.6/test/files/immob.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Immobiliensuche - hier sind sie richtig! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - -
      -
      - - - - - - - - - - - - - Wir haben - - 30 - - Immobilien für Sie gefunden. -

      - - - - - - - - -
      - - - - - - - - -
      Listenansicht  - Galerieansicht
      -
      - - Seiten: 1 -2 -> - -
      - - - -
      - - - - - -
      nach:  - - - - - -
      -
      - -
      - - - - - - - - -
      Erklärung:N Neu! Aktuell
      -
      -

      - - - - - - - - - - - - - - - -
        - Zimmer
      - Stadt/Kreis
      - - -
      - Wohnfläche
      - Stadtteil/Ort
      - - -
      - Kaltmiete
      - Straße
      - - -
      - Foto -
      ! Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       3,00
      Erlangen
      111,00 m²
      Erlangen - Zentrum
      999,45 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       3,00
      Erlangen
      110,19 m²
      Erlangen - Zentrum
      991,71 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      104,51 m²
      Erlangen - Zentrum
      940,59 EUR

      N Ideal für Rollstuhlfahrer die Wohnung und die Lage Balkon Thumbnail
       2,00
      Erlangen
      103,42 m²
      Erlangen - Zentrum
      930,78 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       3,00
      Erlangen
      103,00 m²
      Erlangen - Zentrum
      926,82 EUR

      120 m² 4ZiDesignerGaleriewohnung mit Kamin, Eckbadewanne, Fußbodenheizung, Einbauküche 920 € 1.8.06 Einbauküche Balkon Thumbnail
       4,00
      Erlangen
      125,00 m²
      Erlangen Süd
      920,00 EUR
      Wohnanlage Nahe Erlangen in Möhrendorf
      120 m² 4ZiDesignerGaleriewohnung mit Kamin, Eckbadewanne, Fußbodenheizung, Einbauküche 920 € 1.8.06 Einbauküche Balkon Thumbnail
       4,00
      Erlangen
      125,00 m²
      Erlangen Süd
      890,00 EUR
      Wohnanlage Nahe Erlangen in Möhrendorf
      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      94,95 m²
      Erlangen - Zentrum
      854,55 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      92,00 m²
      Erlangen - Zentrum
      827,64 EUR

      N Ideal für Rollstuhlfahrer die Wohnung und die Lage Balkon Thumbnail
       3,00
      Erlangen
      83,00 m²
      Erlangen Süd
      825,00 EUR
      Nahe Unistr
      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      87,16 m²
      Erlangen - Zentrum
      784,44 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      79,46 m²
      Erlangen - Zentrum
      715,14 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      74,02 m²
      Erlangen - Zentrum
      666,18 EUR

      N Ideal für Rollstuhlfahrer die Wohnung und die Lage Balkon Thumbnail
       2,00
      Erlangen
      74,00 m²
      Erlangen - Zentrum
      665,28 EUR

      Schön Wohnen Nahe der Universitätsstr. mit kurzen Wegen zu allem Balkon Thumbnail
       2,00
      Erlangen
      74,00 m²
      Erlangen - Zentrum
      665,28 EUR


      - - - - - - - - - - - - - - - -
      - Seiten: - 1 -2 -> - -
      - nach: - - - - - - -

      - - - - - - - -
      -
      -
      - powered by ImmobilienScout24 - -
      - - - diff --git a/vendor/gems/hpricot-0.6/test/files/pace_application.html b/vendor/gems/hpricot-0.6/test/files/pace_application.html deleted file mode 100644 index 38d1427..0000000 --- a/vendor/gems/hpricot-0.6/test/files/pace_application.html +++ /dev/null @@ -1,1320 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
      - First Health Services Corporation logo - - Pennsylvania Department of Aging logo -
      - - PACE/PACENET Enrollment - - - Need Assistance?
      - Call: Inside PA 1-800-225-7223 Outside PA 717-651-3600
      - Email: PACECares@fhsc.com -
      -
      - - -
      - - -
      - - - - - - - - - - - - - - - - - -

      - - Check if same - as Applicant -
      Preparer's Name - - Preparer's Phone - () - - - - - - - -

      - Please enter the Preparer's Name & Phone #.
      - When you are done, click on 'Continue'.
      -


      - - - -

      -
      -
      - - - - - -
      -
      The USGenWeb Project, Free Genealogy Online
      - -
      - -
      - -
      - - Home - About Us - States - Projects - Researchers - Volunteers - -
      - -
      - -
      -
      -

       

      -

      Keeping Internet Genealogy Free
      -
      -

      -
      -
      - - - - -
      -

      -

      Welcome to The USGenWeb Project! We are a group of volunteers working together to provide free genealogy websites for genealogical research in every county and every state of the United States. This Project is non-commercial and fully committed to free genealogy access for everyone.

      -

      Organization is by county and state, and this website provides you with links to all the state genealogy websites which, in turn, provide gateways to the counties. The USGenWeb Project also sponsors important Special Projects at the national level and this website provides an entry point to all of those pages, as well.

      -

      Clicking on a State Link (on the left) will take you to the State's website. Clicking on the tabs above will take you to additional information and links.

      -

      All of the volunteers who make up The USGenWeb Project are very proud of this endeavor and hope that you will find their hard work both beneficial and rewarding. Thank you for visiting!

      -

      The USGenWeb Project Team -

      -

      10th Anniversary

      -

      -
      -

      2006 marks the 10th Anniversary of the USGenWeb Project and I have been looking back over those past 10 years. When the USGenWeb Project began, it was one of the few (if not the only) centralized places on the internet to find genealogy information and post a query. Those early state and county sites began with links to the small amount of on-line information of interest to a family historian and a query page. The only Special Project was the Archives. How far the Project has come during the past 10 years! Now there are several special projects and the states, counties and special projects sites of the Project not only contain links; they are filled with information and transcribed records, and more is being added every day by our wonderful, dedicated and hard working volunteers.

      -

      Ten years ago the internet, as we know it today, was in its infancy. The things we take for granted today--e-mail, PCs, cell phones, digital cameras, etc., were not in the average person's world. Family historians and professional genealogists not only didn't use the internet, most had never heard of it.

      -

      Over the past 10 years the internet has gone from obscurity to commonplace. As the internet became an every day tool for millions of people. it changed the way family historians do research. The availability of on-line, easily accessible genealogy and historical information has fueled the phenomenal growth of Genealogy as a hobby and, I'm proud to say, the Project has been right there every step of the way.

      -

      Everywhere we look we see genealogy reported as the fastest growing hobby in the country. Now the internet is the first stop for beginning family historians and is used extensively by experienced researchers. New "How To" genealogy books devote chapters to using the internet, and it is a rare book that does not recommend The USGenWeb Project as one of the first places to visit.

      -

      While subscription sites have popped up everywhere on the web, The Project has continued to offer free access to its vast wealth of information. The USGenWeb Project is recognized as the premier site of free information, and the Project's websites welcome well over a million visitors each day.

      -

      The Project is where it is today because of the thousands of volunteers, both past and present, who cared enough to devote, collectively, millions of hours to gathering, transcribing and uploading information.

      -

      To each and every volunteer, past and present, a heartfelt Thank You, because you are ones who have made The Project the fabulous resource it is today.

      -

      Linda Haas Davenport
      - National Coordinator
      - The USGenWeb Project

      - - - -

      -
      -

      -
      - -
      -
      -
      - -
      -
      - -
      - - - - -
      -
      - -
      - - -
      -
      - -
      -

      The USGenWeb Project, Free Genealogy Online

      - - -
      -
      -
      -
      -

      Comments and administrative-type problems should be emailed to the National Coordinator. - For complaints regarding a specific web site within the USGenWeb Project, please include the URL when emailing the National Coordinator.

      -

      Direct comments or suggestions about this web site to the Webmaster.

      -
      -

      Visit Rootsweb

      -
      -

      -Home
      -About Us
      -Projects
      -for Researchers
      -for Volunteers
      -Site Map

      -
      - - -
      - - - diff --git a/vendor/gems/hpricot-0.6/test/files/utf8.html b/vendor/gems/hpricot-0.6/test/files/utf8.html deleted file mode 100644 index 841eab4..0000000 --- a/vendor/gems/hpricot-0.6/test/files/utf8.html +++ /dev/null @@ -1,1054 +0,0 @@ - -UTF-8 Sampler - - -

      UTF-8 SAMPLER

      - -  Â¥ Â· Â£ Â· â‚¬ Â· $ Â· Â¢ Â· â‚¡ Â· â‚¢ Â· â‚£ Â· â‚¤ Â· â‚¥ Â· â‚¦ Â· â‚§ Â· â‚¨ Â· â‚© Â· â‚ª Â· â‚« Â· â‚­ Â· â‚® Â· â‚¯ - -

      -

      -Frank da Cruz
      -The Kermit Project - Columbia University
      -New York City
      -fdc@columbia.edu - -

      -Last update: -Wed Apr 12 16:54:07 2006 -

      -

      -


      -[ PEACE ] -[ Poetry ] -[ I Can Eat Glass ] -[ The Quick Brown Fox ] -[ HTML Features ] -[ Credits, Tools, Commentary ] -

      - -UTF-8 is an ASCII-preserving encoding method for -Unicode (ISO 10646), the Universal Character Set -(UCS). The UCS encodes most of the world's writing systems in a single -character set, allowing you to mix languages and scripts within a document -without needing any tricks for switching character sets. This web page is -encoded directly in UTF-8. - -

      - -As shown HERE, -Columbia University's Kermit 95 terminal emulation -software can display UTF-8 plain text in Windows 95, 98, ME, NT, XP, or 2000 -when using a monospace Unicode font like Andale Mono WT J or Everson Mono Terminal, or the lesser -populated Courier New, Lucida Console, or Andale Mono. C-Kermit can handle it too, -if you have a Unicode -display. As many languages as are representable in your font can be seen -on the screen at the same time. - -

      - -This, however, is a Web page. Some Web browsers can handle UTF-8, some can't. -And those that can might not have a sufficiently populated font to work with -(some browsers might pick glyphs dynamically from multiple fonts; Netscape 6 -seems to do this). -CLICK HERE -for a survey of Unicode fonts for Windows. - -

      - -The subtitle above shows currency symbols of many lands. If they don't -appear as blobs, we're off to a good start! - -


      -

      Poetry

      - -From the Anglo-Saxon Rune Poem (Rune version): -

      - ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠá›áš±ášªá›«áš·á›–ᚻᚹᛦᛚᚳᚢᛗ
      - ᛋᚳᛖᚪᛚ᛫ᚦᛖᚪᚻ᛫ᛗᚪᚾᚾᚪ᛫ᚷᛖᚻᚹᛦᛚᚳ᛫ᛗá›áš³á›šáš¢áš¾á›«áš»á›¦á›á›«á›žáš«á›šášªáš¾
      - áš·á›áš á›«áš»á›–᛫ᚹá›á›šá›–᛫ᚠᚩᚱ᛫ᛞᚱá›áš»á›áš¾á›–᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇá›ášªáš¾á›¬
      -
      -

      - -From LaÈamon's Brut -(The Chronicles of England, Middle English, West Midlands): -

      -

      -An preost wes on leoden, LaÈamon was ihoten
      -He wes Leovenaðes sone -- liðe him be Drihten.
      -He wonede at ErnleÈe at æðelen are chirechen,
      -Uppen Sevarne staþe, sel þar him þuhte,
      -Onfest Radestone, þer he bock radde. -
      -

      - -(The third letter in the author's name is Yogh, missing from many fonts; -CLICK HERE for another Middle English sample -with some explanation of letters and encoding). - -

      - -From the Tagelied of - - -Wolfram von Eschenbach (Middle High German): -

      -Sîne klâwen durh die wolken sint geslagen,
      -er stîget ûf mit grôzer kraft,
      -ich sih in grâwen tägelîch als er wil tagen,
      -den tac, der im geselleschaft
      -erwenden wil, dem werden man,
      -den ich mit sorgen în verliez.
      -ich bringe in hinnen, ob ich kan.
      -sîn vil manegiu tugent michz leisten hiez.
      -

      - -Some lines of - -Odysseus Elytis (Greek): - -

      -Τη γλώσσα μου έδωσαν ελληνική
      -το σπίτι φτωχικό στις αμμουδιές του ΟμήÏου.
      -Μονάχη έγνοια η γλώσσα μου στις αμμουδιές του ΟμήÏου.
      -

      -από το Άξιον Εστί
      -του Οδυσσέα ΕλÏτη -

      - -

      - -The first stanza of -Pushkin's Bronze Horseman (Russian):
      -

      -Ðа берегу пуÑтынных волн
      -СтоÑл он, дум великих полн,
      -И вдаль глÑдел. Пред ним широко
      -Река неÑлаÑÑ; бедный чёлн
      -По ней ÑтремилÑÑ Ð¾Ð´Ð¸Ð½Ð¾ÐºÐ¾.
      -По мшиÑтым, топким берегам
      -Чернели избы здеÑÑŒ и там,
      -Приют убогого чухонца;
      -И леÑ, неведомый лучам
      -Ð’ тумане ÑпрÑтанного Ñолнца,
      -Кругом шумел.
      -

      - -Šota Rustaveli's Veṗxis Ṭq̇aosani, -̣︡Th, The Knight in the Tiger's Skin (Georgian):

      -

      -ვეპხის ტყáƒáƒáƒ¡áƒáƒœáƒ˜ -შáƒáƒ—რრუსთáƒáƒ•ელი -

      -ღმერთსი შემვედრე, ნუთუ კვლრდáƒáƒ›áƒ®áƒ¡áƒœáƒáƒ¡ სáƒáƒ¤áƒšáƒ˜áƒ¡áƒ შრáƒáƒ›áƒáƒ¡áƒ, -ცეცხლს, წყáƒáƒšáƒ¡áƒ დრმიწáƒáƒ¡áƒ, ჰáƒáƒ”რთრთáƒáƒœáƒ მრáƒáƒ›áƒáƒ¡áƒ; -მáƒáƒ›áƒªáƒœáƒ”ს ფრთენი დრáƒáƒ¦áƒ•ფრინდე, მივჰხვდე მáƒáƒ¡ ჩემსრნდáƒáƒ›áƒáƒ¡áƒ, -დღისით დრღáƒáƒ›áƒ˜áƒ— ვჰხედვიდე მზისრელვáƒáƒ—რკრთáƒáƒ›áƒáƒáƒ¡áƒ. -

      -

      - -Tamil poetry of Cupiramaniya Paarathiyar, - -சà¯à®ªà¯à®°à®®à®£à®¿à®¯ பாரதியார௠(1882-1921): - -

      -

      - -யாமறிநà¯à®¤ மொழிகளிலே தமிழà¯à®®à¯Šà®´à®¿ போல௠இனிதாவத௠எஙà¯à®•à¯à®®à¯ காணோமà¯,
      -பாமரராய௠விலஙà¯à®•à¯à®•ளாயà¯, உலகனைதà¯à®¤à¯à®®à¯ இகழà¯à®šà¯à®šà®¿à®šà¯Šà®²à®ªà¯ பானà¯à®®à¯ˆ கெடà¯à®Ÿà¯,
      -நாமமத௠தமிழரெனக௠கொணà¯à®Ÿà¯ இஙà¯à®•௠வாழà¯à®¨à¯à®¤à®¿à®Ÿà¯à®¤à®²à¯ நனà¯à®±à¯‹? சொலà¯à®²à¯€à®°à¯!
      - -
      - -
      -

      I Can Eat Glass

      - -And from the sublime to the ridiculous, here is a -certain phrase¹ in an assortment of languages: - -

      -

        -
      1. Sanskrit: काचं शकà¥à¤¨à¥‹à¤®à¥à¤¯à¤¤à¥à¤¤à¥à¤®à¥ । नोपहिनसà¥à¤¤à¤¿ मामॠ॥ - -
      2. Sanskrit (standard transcription): kÄcaṃ Å›aknomyattum; nopahinasti mÄm. -
      3. Classical Greek: ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει. -
      4. Greek: ΜποÏÏŽ να φάω σπασμένα γυαλιά χωÏίς να πάθω τίποτα. -
        Etruscan: (NEEDED) -
      5. Latin: Vitrum edere possum; mihi non nocet. -
      6. Old French: Je puis mangier del voirre. Ne me nuit. -
      7. French: Je peux manger du verre, ça ne me fait pas de mal. -
      8. Provençal / Occitan: Pòdi manjar de veire, me nafrariá pas. -
      9. Québécois: J'peux manger d'la vitre, ça m'fa pas mal. -
      10. Walloon: Dji pou magnî do vêre, çoula m' freut nén må. -
        Champenois: (NEEDED) -
        Lorrain: (NEEDED) -
      11. Picard: Ch'peux mingi du verre, cha m'foé mie n'ma. -
        Corsican: (NEEDED) -
        Jèrriais: (NEEDED) -
      12. Kreyòl Ayisyen: Mwen kap manje vè, li pa blese'm. -
      13. Basque: Kristala jan dezaket, ez dit minik ematen. -
      14. Catalan / Català: Puc menjar vidre, que no em fa mal. -
      15. Spanish: Puedo comer vidrio, no me hace daño. -
      16. Aragones: Puedo minchar beire, no me'n fa mal . -
      17. Galician: Eu podo xantar cristais e non cortarme. -
      18. Portuguese: Posso comer vidro, não me faz mal. -
      19. Brazilian Portuguese (7): - Posso comer vidro, não me machuca. -
      20. Caboverdiano: M' podê cumê vidru, ca ta maguâ-m'. -
      21. Papiamentu: Ami por kome glas anto e no ta hasimi daño. -
      22. Italian: Posso mangiare il vetro e non mi fa male. -
      23. Milanese: Sôn bôn de magnà el véder, el me fa minga mal. -
      24. Roman: Me posso magna' er vetro, e nun me fa male. -
      25. Napoletano: M' pozz magna' o'vetr, e nun m' fa mal. -
      26. Sicilian: Puotsu mangiari u vitru, nun mi fa mali. -
      27. Venetian: Mi posso magnare el vetro, no'l me fa mae. -
      28. Zeneise (Genovese): Pòsso mangiâ o veddro e o no me fà mâ. -
        Rheto-Romance / Romansch: (NEEDED) -
        Romany / Tsigane: (NEEDED) -
      29. Romanian: Pot să mănânc sticlă și ea nu mă rănește. -
      30. Esperanto: Mi povas manÄi vitron, Äi ne damaÄas min. -
        Pictish: (NEEDED) -
        Breton: (NEEDED) -
      31. Cornish: Mý a yl dybry gwéder hag éf ny wra ow ankenya. -
      32. Welsh: Dw i'n gallu bwyta gwydr, 'dyw e ddim yn gwneud dolur i mi. -
      33. Manx Gaelic: Foddym gee glonney agh cha jean eh gortaghey mee. -
      34. Old Irish (Ogham): ᚛᚛ᚉᚑᚅᚔᚉᚉᚔᚋ ᚔᚈᚔ ášáš‚ášáš…ᚑ ᚅᚔᚋᚌᚓᚅášášœ -
      35. Old Irish (Latin): Con·iccim ithi nglano. Ním·géna. - -
      36. Irish: Is féidir liom gloinne a ithe. Ní dhéanann sí dochar ar bith dom. - -
      37. Scottish Gaelic: S urrainn dhomh gloinne ithe; cha ghoirtich i mi. -
      38. Anglo-Saxon (Runes): -á›áš³á›«á›—ᚨᚷ᛫ᚷᛚᚨᛋ᛫ᛖᚩá›ášªáš¾á›«áš©áš¾á›žá›«áš»á›á›á›«áš¾á›–᛫ᚻᛖᚪᚱᛗá›ášªáš§á›«á›—ᛖ᛬ -
      39. Anglo-Saxon (Latin): Ic mæg glæs eotan ond hit ne hearmiað me. -
      40. Middle English: Ich canne glas eten and hit hirtiþ me nouÈt. -
      41. English: I can eat glass and it doesn't hurt me. -
      42. English (IPA): [aɪ kæn iËt glÉ‘Ës ænd ɪt dÉz nÉ’t hÉœËt miË] (Received Pronunciation) -
      43. English (Braille): ⠊⠀⠉â â â €â ‘â â žâ €â ›â ‡â â Žâ Žâ €â â â ™â €â Šâ žâ €â ™â •â ‘â Žâ â žâ €â “⠥⠗⠞⠀â â ‘ -
      44. Lalland Scots / Doric: Ah can eat gless, it disnae hurt us. -
        Glaswegian: (NEEDED) -
      45. Gothic (4): -ðŒ¼ðŒ°ðŒ² -ðŒ²ðŒ»ðŒ´ðƒ -ðŒ¹Ìˆð„ðŒ°ðŒ½, -ðŒ½ðŒ¹ -ðŒ¼ðŒ¹ðƒ -ð…ðŒ¿ -ðŒ½ðŒ³ðŒ°ðŒ½ -ðŒ±ð‚ðŒ¹ðŒ²ðŒ²ðŒ¹ðŒ¸. -
      46. Old Norse (Runes): á›–áš´ áš·á›–á› á›–á›á› -áš§ ᚷᛚᛖᚱ ᛘᚾ -ᚦᛖᛋᛋ ᚨᚧ ᚡᛖ -ᚱᚧᚨ ᛋᚨᚱ - -
      47. Old Norse (Latin): Ek get etið gler án þess að verða sár. - -
      48. Norsk / Norwegian (Nynorsk): Eg kan eta glas utan å skada meg. -
      49. Norsk / Norwegian (Bokmål): Jeg kan spise glass uten å skade meg. -
        Føroyskt / Faroese: (NEEDED) -
      50. Ãslenska / Icelandic: Ég get etið gler án þess að meiða mig. -
      51. Svenska / Swedish: Jag kan äta glas utan att skada mig. -
      52. Dansk / Danish: Jeg kan spise glas, det gør ikke ondt på mig. -
      53. Soenderjysk: Æ ka æe glass uhen at det go mæ naue. -
      54. Frysk / Frisian: Ik kin glês ite, it docht me net sear. - - - -
      55. Nederlands / Dutch: Ik kan glas eten, het doet -mij -geen kwaad. - - -
      56. Kirchröadsj/Bôchesserplat: Iech ken glaas èèse, mer 't deet miech -jing pieng.
      57. - -
      58. Afrikaans: Ek kan glas eet, maar dit doen my nie skade nie. -
      59. Lëtzebuergescht / Luxemburgish: Ech kan Glas iessen, daat deet mir nët wei. -
      60. Deutsch / German: Ich kann Glas essen, ohne mir weh zu tun. -
      61. Ruhrdeutsch: Ich kann Glas verkasematuckeln, ohne dattet mich wat jucken tut. -
      62. Langenfelder Platt: -Isch kann Jlaas kimmeln, uuhne datt mich datt weh dääd. -
      63. Lausitzer Mundart ("Lusatian"): Ich koann Gloos assn und doas -dudd merr ni wii. -
      64. Odenwälderisch: Iech konn glaasch voschbachteln ohne dass es mir ebbs daun doun dud. -
      65. Sächsisch / Saxon: 'sch kann Glos essn, ohne dass'sch mer wehtue. -
      66. Pfälzisch: Isch konn Glass fresse ohne dasses mer ebbes ausmache dud. -
      67. Schwäbisch / Swabian: I kå Glas frässa, ond des macht mr nix! -
      68. Bayrisch / Bavarian: I koh Glos esa, und es duard ma ned wei. -
      69. Allemannisch: I kaun Gloos essen, es tuat ma ned weh. -
      70. Schwyzerdütsch: Ich chan Glaas ässe, das tuet mir nöd weeh. -
      71. Hungarian: Meg tudom enni az üveget, nem lesz tőle bajom. -
      72. Suomi / Finnish: Voin syödä lasia, se ei vahingoita minua. -
      73. Sami (Northern): Sáhtán borrat lása, dat ii leat bávÄÄas. -
      74. Erzian: Мон ÑÑ€Ñан -Ñуликадо, ды -зыÑн -ÑйÑÑ‚ÑÐ½Ð·Ñ Ð° -ули. -
        Karelian: (NEEDED) -
        Vepsian: (NEEDED) -
        Votian: (NEEDED) -
        Livonian: (NEEDED) -
      75. Estonian: Ma võin klaasi süüa, see ei tee mulle midagi. -
      76. Latvian: Es varu ēst stiklu, tas man nekaitē. -
      77. Lithuanian: Aš galiu valgyti stiklą ir jis manęs nežeidžia -
        Old Prussian: (NEEDED) -
        Sorbian (Wendish): (NEEDED) -
      78. Czech: Mohu jíst sklo, neublíží mi. -
      79. Slovak: Môžem jesť sklo. Nezraní ma. -
      80. Polska / Polish: Mogę jeść szkło i mi nie szkodzi. -
      81. Slovenian: Lahko jem steklo, ne da bi mi škodovalo. -
      82. Croatian: Ja mogu jesti staklo i ne boli me. -
      83. Serbian (Latin): Mogu jesti staklo a da mi ne škodi. -
      84. Serbian (Cyrillic): Могу јеÑти Ñтакло -а -да ми -не -шкоди. -
      85. Macedonian: Можам да јадам Ñтакло, а не ме штета. -
      86. Russian: Я могу еÑть Ñтекло, оно мне не вредит. -
      87. Belarusian (Cyrillic): Я магу еÑці шкло, Ñно мне не шкодзіць. -
      88. Belarusian (Lacinka): Ja mahu jeści škło, jano mne ne škodzić. -
      89. Ukrainian: Я можу Ñ—Ñти шкло, й воно мені не пошкодить. - -
      90. Bulgarian: Мога да Ñм Ñтъкло, то не ми вреди. - -
      91. Georgian: მინáƒáƒ¡ ვჭáƒáƒ› დრáƒáƒ áƒ მტკივáƒ. -
      92. Armenian: Ô¿Ö€Õ¶Õ¡Õ´ Õ¡ÕºÕ¡Õ¯Õ« Õ¸Ö‚Õ¿Õ¥Õ¬ Ö‡ Õ«Õ¶Õ®Õ« Õ¡Õ¶Õ°Õ¡Õ¶Õ£Õ«Õ½Õ¿ Õ¹Õ¨Õ¶Õ¥Ö€Ö‰ -
      93. Albanian: Unë mund të ha qelq dhe nuk më gjen gjë. -
      94. Turkish: Cam yiyebilirim, bana zararı dokunmaz. -
      95. Turkish (Ottoman): جام ييه بلورم بڭا ضررى طوقونمز -
      96. Bangla / Bengali: -আমি কাà¦à¦š খেতে পারি, তাতে আমার কোনো কà§à¦·à¦¤à¦¿ হয় না। -
      97. Marathi: मी काच खाऊ शकतो, मला ते दà¥à¤–त नाही. -
      98. Hindi: मैं काà¤à¤š खा सकता हूà¤, मà¥à¤à¥‡ उस से कोई पीडा नहीं होती. -
      99. Tamil: நான௠கணà¯à®£à®¾à®Ÿà®¿ சாபà¯à®ªà®¿à®Ÿà¯à®µà¯‡à®©à¯, அதனால௠எனகà¯à®•௠ஒர௠கேடà¯à®®à¯ வராதà¯. - -
      100. Urdu(2): - میں کانچ کھا سکتا ÛÙˆÚº اور مجھے تکلی٠نÛیں Ûوتی Û” -
      101. Pashto(2): زه شيشه Ø®ÙˆÚ“Ù„Û Ø´Ù…ØŒ هغه ما نه خوږوي -
      102. Farsi / Persian: .من می توانم بدون٠احساس درد شيشه بخورم -
      103. Arabic(2): أنا قادر على أكل الزجاج و هذا لا يؤلمني. -
        Aramaic: (NEEDED) -
      104. Hebrew(2): ×× ×™ יכול ל×כול זכוכית וזה ×œ× ×ž×–×™×§ לי. -
      105. Yiddish(2): ×יך קען עסן גל×ָז ×ון עס טוט מיר נישט װײ. -
        Judeo-Arabic: (NEEDED) -
        Ladino: (NEEDED) -
        GÇʼÇz: (NEEDED) -
        Amharic: (NEEDED) -
      106. Twi: Metumi awe tumpan, ɜnyɜ me hwee. -
      107. Hausa (Latin): Inā iya taunar gilāshi kuma in gamā lāfiyā. -
      108. Hausa (Ajami) (2): -Ø¥Ùنا Ø¥ÙÙ‰ÙŽ تَونَر غÙلَاش٠كÙÙ…ÙŽ Ø¥ÙÙ† غَمَا لَاÙÙىَا -
      109. Yoruba(3): Mo lè je̩ dígí, kò ní pa mí lára. -
      110. (Ki)Swahili: Naweza kula bilauri na sikunyui. - -
      111. Malay: Saya boleh makan kaca dan ia tidak mencederakan saya. -
      112. Tagalog: Kaya kong kumain nang bubog at hindi ako masaktan. -
      113. Chamorro: Siña yo' chumocho krestat, ti ha na'lalamen yo'. -
      114. Javanese: Aku isa mangan beling tanpa lara. -
      115. Burmese: -က္ယ္á€á€”္‌á€á€±á€¬á€¹â€ŒáŠá€€á€¹á€šá€¹á€á€”္‌မ မ္ယက္‌စားနုိင္‌သည္‌ዠáŽá€€á€¹á€›á€±á€¬á€„္‌့ -ထိá€á€¯á€­á€€á€¹â€Œá€™á€¹á€Ÿá€¯ မရ္ဟိပာዠ-(7) - -
      116. Vietnamese (quốc ngữ): Tôi có thể ăn thủy tinh mà không hại gì. -
      117. Vietnamese (nôm) (4): 些 𣎠世 咹 水 晶 𦓡 空 𣎠害 咦 -
        Khmer: (NEEDED) -
        Lao: (NEEDED) -
      118. Thai: ฉันà¸à¸´à¸™à¸à¸£à¸°à¸ˆà¸à¹„ด้ à¹à¸•่มันไม่ทำให้ฉันเจ็บ -
      119. Mongolian (Cyrillic): Би шил идÑй чадна, надад хортой биш -
      120. Mongolian (Classic) (5): - ᠪᠢ ᠰᠢᠯᠢ ᠢᠳᠡᠶᠦ ᠴᠢᠳᠠᠨᠠ ᠂ ᠨᠠᠳᠤᠷ ᠬᠣᠤᠷᠠᠳᠠᠢ ᠪᠢᠰᠢ -
        Dzongkha: (NEEDED) -
        Nepali: (NEEDED) -
      121. Tibetan: ཤེལ་སྒོ་ཟ་ནས་ང་ན་གི་མ་རེད༠-
      122. Chinese: 我能åžä¸‹çŽ»ç’ƒè€Œä¸ä¼¤èº«ä½“。 -
      123. Chinese (Traditional): 我能åžä¸‹çŽ»ç’ƒè€Œä¸å‚·èº«é«”。 - -
      124. Taiwanese(6): Góa Ä“-tàng chiaÌh po-lê, mÄ bÄ“ tioÌh-siong. -
      125. Japanese: ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™ã€‚ãれã¯ç§ã‚’å‚·ã¤ã‘ã¾ã›ã‚“。 -
      126. Korean: 나는 유리를 ë¨¹ì„ ìˆ˜ 있어요. ê·¸ëž˜ë„ ì•„í”„ì§€ 않아요 -
      127. Bislama: Mi save kakae glas, hemi no save katem mi.
        -
      128. Hawaiian: Hiki iaÊ»u ke Ê»ai i ke aniani; Ê»aÊ»ole nÅ lÄ au e Ê»eha.
        -
      129. Marquesan: E koÊ»ana e kai i te karahi, mea Ê»Ä, Ê»aÊ»e hauhau. -
      130. Chinook Jargon: Naika məkmək kakshət labutay, pi weyk ukuk munk-sik nay. -
      131. Navajo: Tsésǫʼ yishÄ…ÌÄ…go bííníshghah dóó doo shiÅ‚ neezgai da. -
        Cherokee (and Cree, Ojibwa, Inuktitut, and other Native American languages): (NEEDED) -
        Garifuna: (NEEDED) -
        Gullah: (NEEDED) -
      132. Lojban: mi kakne le nu citka le blaci .iku'i le se go'i na xrani mi -
      133. Nórdicg: Ljœr ye caudran créneþ ý jor cẃran. -
      -

      - -(Additions, corrections, completions, -gratefully accepted.) - -

      -For testing purposes, some of these are repeated in a monospace font . . . -

      -

        -
      1. Euro Symbol: €. -
      2. Greek: ΜποÏÏŽ να φάω σπασμένα γυαλιά χωÏίς να πάθω τίποτα. -
      3. Ãslenska / Icelandic: Ég get etið gler án þess að meiða mig. - -
      4. Polish: Mogę jeść szkło, i mi nie szkodzi. -
      5. Romanian: Pot să mănânc sticlă și ea nu mă rănește. -
      6. Ukrainian: Я можу Ñ—Ñти шкло, й воно мені не пошкодить. -
      7. Armenian: Ô¿Ö€Õ¶Õ¡Õ´ Õ¡ÕºÕ¡Õ¯Õ« Õ¸Ö‚Õ¿Õ¥Õ¬ Ö‡ Õ«Õ¶Õ®Õ« Õ¡Õ¶Õ°Õ¡Õ¶Õ£Õ«Õ½Õ¿ Õ¹Õ¨Õ¶Õ¥Ö€Ö‰ -
      8. Georgian: მინáƒáƒ¡ ვჭáƒáƒ› დრáƒáƒ áƒ მტკივáƒ. -
      9. Hindi: मैं काà¤à¤š खा सकता हूà¤, मà¥à¤à¥‡ उस से कोई पीडा नहीं होती. -
      10. Hebrew(2): ×× ×™ יכול ל×כול זכוכית וזה ×œ× ×ž×–×™×§ לי. -
      11. Yiddish(2): ×יך קען עסן גל×ָז ×ון עס טוט מיר נישט װײ. -
      12. Arabic(2): أنا قادر على أكل الزجاج و هذا لا يؤلمني. -
      13. Japanese: ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™ã€‚ãれã¯ç§ã‚’å‚·ã¤ã‘ã¾ã›ã‚“。 -
      14. Thai: ฉันà¸à¸´à¸™à¸à¸£à¸°à¸ˆà¸à¹„ด้ à¹à¸•่มันไม่ทำให้ฉันเจ็บ -
      -

      - -Notes: - -

      -

        - -
      1. The "I can eat glass" phrase and initial translations (about 30 of them) -were borrowed from Ethan Mollick's I Can Eat Glass page -(which disappeared on or about June 2004) and converted to UTF-8. Since -Ethan's original page is gone, I should mention that his purpose was to offer -travelers a phrase they could use in any country that would command a -certain kind of respect, or at least get attention. See Credits for the many additional contributions since -then. When submitting new entries, the word "hurt" (if you have a choice) -is used in the sense of "cause harm", "do damage", or "bother", rather than -"inflict pain" or "make sad". In this vein Otto Stolz comments (as do -others further down; personally I think it's better for the purpose of this -page to have extra entries and/or to show a greater repertoire of characters -than it is to enforce a strict interpretation of the word "hurt"!): - -

        - -
        - - -This is the meaning I have translated to the Swabian dialect. - -However, I just have noticed that most of the German variants -translate the "inflict pain" meaning. The German example should rather -read: - -

        -

        -"Ich kann Glas essen ohne mir zu schaden." -
        -

        - -(The comma fell victim to the 1996 orthographic reform, -cf. http://www.ids-mannheim.de/reform/e3-1.html#P76. - -

        - -You may wish to contact the contributors of the following translations -to correct them: - -

        -

          - -
        • Lëtzebuergescht / Luxemburgish: Ech kan Glas iessen, daat deet mir nët wei. -
        • Lausitzer Mundart ("Lusatian"): Ich koann Gloos assn und doas dudd merr ni wii. -
        • Sächsisch / Saxon: 'sch kann Glos essn, ohne dass'sch mer wehtue. -
        • Bayrisch / Bavarian: I koh Glos esa, und es duard ma ned wei. -
        • Allemannisch: I kaun Gloos essen, es tuat ma ned weh. -
        • Schwyzerdütsch: Ich chan Glaas ässe, das tuet mir nöd weeh. -
        -

        - -In contrast, I deem the following translations *alright*: - -

        -

          - -
        • Ruhrdeutsch: Ich kann Glas verkasematuckeln, ohne dattet mich wat jucken tut. -
        • Pfälzisch: Isch konn Glass fresse ohne dasses mer ebbes ausmache dud. -
        • Schwäbisch / Swabian: I kÃ¥ Glas frässa, ond des macht mr nix! -
        -

        - -(However, you could remove the commas, on account of -http://www.ids-mannheim.de/reform/e3-1.html#P76 -and - -http://www.ids-mannheim.de/reform/e3-1.html#P72, respectively.) - -

        - -I guess, also these examples translate the wrong sense of "hurt", -though I do not know these languages well enough to assert them -definitely: - -

        -

          - -
        • Nederlands / Dutch: Ik kan glas eten; het doet mij geen -pijn. (This one has been changed) -
        • Kirchröadsj/Bôchesserplat: Iech ken glaas èèse, mer 't deet miech jing pieng. - -
        -

        - -In the Romanic languages, the variations on "fa male" (it) are probably -wrong, whilst the variations on "hace daño" (es) and "damaÄas" (Esperanto) are probably correct; "nocet" (la) is definitely right. - -

        - -The northern Germanic variants of "skada" are probably right, as are -the Slavic variants of "škodi/шкоди" (se); however the Slavic variants -of " boli" (hv) are probably wrong, as "bolena" means "pain/ache", IIRC. - - -

        -
        -

        - -The numbering of the samples is arbitrary, done only to keep track of how -many there are, and can change any time a new entry is added. The -arrangement is also arbitrary but with some attempt to group related -examples together. Note: All languages not listed are wanted, not just the -ones that say (NEEDED). - -

      2. Correct right-to-left display of these languages -depends on the capabilities of your browser. The period should -appear on the left. In the monospace Yiddish example, the Yiddish digraphs -should occupy one character cell. - -
      3. Yoruba: The third word is Latin letter small 'j' followed by -small 'e' with U+0329, Combining Vertical Line Below. This displays -correctly only if your Unicode font includes the U+0329 glyph and your -browser supports combining diacritical marks. The Indic examples -also include combining sequences. - -
      4. Includes Unicode 3.1 (or later) characters beyond Plane 0. - -
      5. The Classic Mongolian example should be vertical, top-to-bottom and -left-to-right. But such display is almost impossible. Also no font yet -exists which provides the proper ligatures and positional variants for the -characters of this script, which works somewhat like Arabic. - -
      6. Taiwanese is also known as Holo or Hoklo, and is related to Southern -Min dialects such as Amoy. -Contributed by Henry H. Tan-Tenn, who comments, "The above is -the romanized version, in a script current among Taiwanese Christians since -the mid-19th century. It was invented by British missionaries and saw use in -hundreds of published works, mostly of a religious nature. Most Taiwanese did -not know Chinese characters then, or at least not well enough to read. More -to the point, though, a written standard using Chinese characters has never -developed, so a significant minority of words are represented with different -candidate characters, depending on one's personal preference or etymological -theory. In this sentence, for example, "-tàng", "chiaÌh", -"mÄ" and "bÄ“" are problematic using Chinese characters. -"Góa" (I/me) and "po-lê" (glass) are as written in other Sinitic -languages (e.g. Mandarin, Hakka)." - -
      7. Wagner Amaral of Pinese & Amaral Associados notes that -the Brazilian Portuguese sentence for -"I can eat glass" should be identical to the Portuguese one, as the word -"machuca" means "inflict pain", or rather "injuries". The words "faz -mal" would more correctly translate as "cause harm". - -
      8. Burmese: In English the first person pronoun "I" stands for both -genders, male and female. In Burmese (except in the central part of Burma) -kyundaw (က္ယ္á€á€”္‌á€á€±á€¬á€¹â€Œ) for male and kyanma (က္ယ္á€á€”္‌မ) for female. -Using here a fully-compliant Unicode Burmese font -- sadly one and only Padauk -Graphite font exists -- rendering using graphite engine. -CLICK HERE to test Burmese -characters. - -
      - -
      -

      The Quick Brown Fox

      - -The "I can eat glass" sentences do not necessarily show off the orthography of -each language to best advantage. In many alphabetic written languages it is -possible to include all (or most) letters (or "special" characters) in -a single (often nonsense) pangram. These were traditionally used in -typewriter instruction; now they are useful for stress-testing computer fonts -and keyboard input methods. Here are a few examples (SEND MORE): - -

      -

        - -
      1. English: The quick brown fox jumps over the lazy dog. -
      2. Irish: "An ḃfuil do Ä‹roí ag bualaḋ ó ḟaitíos an Ä¡rá a á¹eall lena ṗóg éada ó -ṡlí do leasa ṫú?" -"D'ḟuascail Ãosa Úrá¹ac na hÓiÄ¡e Beannaiṫe pór Éava agus Ãḋaiá¹." -
      3. Dutch: Pa's wijze lynx bezag vroom het fikse aquaduct. -
      4. German: Falsches Üben von Xylophonmusik quält jeden -größeren Zwerg. (1) -
      5. German: Im finſteren Jagdſchloß am offenen Felsquellwaſſer patzte der affig-flatterhafte kauzig-höf‌liche Bäcker über ſeinem verſifften kniffligen C-Xylophon. (2) -
      6. Swedish: Flygande bäckasiner söka strax hwila på mjuka tuvor. -
      7. Icelandic: Sævör grét áðan því úlpan var ónýt. -
      8. Polish: Pchnąć w tę łódź jeża lub ośm skrzyń fig. -
      9. Czech: PříliÅ¡ -žluÅ¥ouÄký kůň úpÄ›l -Äábelské kódy. -
      10. Slovak: Starý kôň na hÅ•be -kníh žuje tíško povädnuté -ruže, na stĺpe sa Äateľ -uÄí kvákaÅ¥ novú ódu o -živote. -
      11. Russian: Ð’ чащах -юга жил-был -цитруÑ? Да, -но -фальшивый -ÑкземплÑÑ€! -ёъ. - -
      12. Bulgarian: Жълтата Ð´ÑŽÐ»Ñ Ð±ÐµÑˆÐµ щаÑтлива, че пухът, който цъфна, замръзна като гьон. - -
      13. Sami (Northern): Vuol Ruoŧa geÄ‘ggiid leat máŋga luosa ja Äuovžža. -
      14. Hungarian: ÃrvíztűrÅ‘ tükörfúrógép. -
      15. Spanish: El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su querido cachorro. -
      16. Portuguese: O próximo vôo à noite sobre o Atlântico, põe freqüentemente o único médico. (3) -
      17. French: Les naïfs ægithales hâtifs pondant à Noël où il gèle sont sûrs d'être -déçus et de voir leurs drôles d'œufs abîmés. - -
      18. Esperanto: EÄ¥oÅanÄo -ĉiuĵaÅ­de. - -
      19. Hebrew: ×–×” ×›×™×£ ×¡×ª× ×œ×©×ž×•×¢ ×יך תנצח קרפד ×¢×¥ טוב בגן. - -
      20. Japanese (Hiragana):
        -ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹ã‚’
        -ã‚ãŒã‚ˆãŸã‚Œãžã€€ã¤ã­ãªã‚‰ã‚€
        -ã†ã‚ã®ãŠãã‚„ã¾ã€€ã‘ãµã“ãˆã¦
        -ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš -(4) -
        - -
      -

      -Notes: -

      -

        - -
      1. Other phrases commonly used in Germany include: "Ein wackerer Bayer -vertilgt ja bequem zwo Pfund Kalbshaxe" and, more recently, "Franz jagt im -komplett verwahrlosten Taxi quer durch Bayern", but both lack umlauts and -esszet. Previously, going for the shortest sentence that has all the -umlauts and special characters, I had -"Grüße aus Bärenhöfe -(und Óechtringen)!" -Acute accents are not used in native German words, so I was surprised to -discover "Óechtringen" in the Deutsche Bundespost -Postleitzahlenbuch: -

        -

        -Click for full-size image (2.8MB) -
        -

        -It's a small village in eastern Lower Saxony. -The "oe" in this case -turns out to be the Lower Saxon "lengthening e" (Dehnungs-e), which makes the -previous vowel long (used in a number of Lower Saxon place names such as Soest -and Itzehoe), not the "e" that indicates umlaut of the preceding vowel. -Many thanks to the Óechtringen-Namenschreibungsuntersuchungskomitee -(Alex Bochannek, Manfred Erren, Asmus Freytag, Christoph Päper, plus -Werner Lemberg who serves as -Óechtringen-Namenschreibungsuntersuchungskomiteerechtschreibungsprüfer) - -for their relentless pursuit of the facts in this case. Conclusion: the -accent almost certainly does not belong on this (or any other native German) -word, but neither can it be dismissed as dirt on the page. To add to the -mystery, it has been reported that other copies of the same edition of the -PLZB do not show the accent! UPDATE (March 2006): David Krings was -intrigued enough by this report to contact the mayor of Ebstorf, of which -Oechtringen is a borough, who responded: - -

        -

        -Sehr geehrter Mr. Krings,
        -wenn Oechtringen irgendwo mit einem Akzent auf dem O geschrieben wurde, -dann kann das nur ein Fehldruck sein. Die offizielle Schreibweise lautet -jedenfalls „Oechtringen“.
        -Mit freundlichen Grüssen
        -Der Samtgemeindebürgermeister
        -i.A. Lothar Jessel - -
        - - -

        -

      2. From Karl Pentzlin (Kochel am See, Bavaria, Germany): -"This German phrase is suited for display by a Fraktur (broken letter) -font. It contains: all common three-letter ligatures: ffi ffl fft and all -two-letter ligatures required by the Duden for Fraktur typesetting: ch ck ff -fi fl ft ll ſch ſi ſſ ſt tz (all in a -manner such they are not part of a three-letter ligature), one example of f-l -where German typesetting rules prohibit ligating (marked by a ZWNJ), and all -German letters a...z, ä,ö,ü,ß, ſ [long s] -(all in a manner such that they are not part of a two-letter Fraktur -ligature)." - -Otto Stolz notes that "'Schloß' is now spelled 'Schloss', in -contrast to 'größer' (example 4) which has kept its -'ß'. Fraktur has been banned from general use, in 1942, and long-s -(ſ) has ceased to be used with Antiqua (Roman) even earlier (the -latest Antiqua-ſ I have seen is from 1913, but then -I am no expert, so there may well be a later instance." Later Otto confirms -the latter theory, "Now I've run across a book “Deutsche -Rechtschreibung†(edited by Lutz Mackensen) from 1954 (my reprint -is from 1956) that has kept the Antiqua-ſ in its dictionary part (but -neither in the preface nor in the appendix)." - -

        - -

      3. Diaeresis is not used in Iberian Portuguese. - -

        - -

      4. From Yurio Miyazawa: "This poetry contains all the sounds in the -Japanese language and used to be the first thing for children to learn in -their Japanese class. The Hiragana version is particularly neat because it -covers every character in the phonetic Hiragana character set." Yurio also -sent the Kanji version: - -

        -

        -色ã¯åŒ‚ã¸ã© 散りã¬ã‚‹ã‚’
        -我ãŒä¸–誰㞠常ãªã‚‰ã‚€
        -有為ã®å¥¥å±± 今日越ãˆã¦
        -æµ…ã夢見㘠酔ã²ã‚‚ã›ãš -
        - -
      -

      -Accented Cyrillic: -

      - -(This section contributed by Vladimir Marinov.) - -

      - -In Bulgarian it is desirable, customary, or in some cases required to -write accents over vowels. Unfortunately, no computer character sets -contain the full repertoire of accented Cyrillic letters. With Unicode, -however, it is possible to combine any Cyrillic letter with any combining -accent. The appearance of the result depends on the font and the rendering -engine. Here are two examples. - -

      -

        - -
      1. Той Ð²Ð¸Ð´Ñ Ð±Ñлата коÑÐ°Ì Ð¿Ð¾ главата Ð¸Ì Ð¸ коÌÑа на рамото иÌ, и реÌче да Ð¸Ì -речеÌ: "ПараÌта Ð¿Ð¾Ì Ð¿Ð°Ìри от паÌрата, не ща париÌ!", но Ñи помиÌÑли: "Хей, -помиÑÐ»Ð¸Ì Ñи! ÐÌ Ð¸Ì Ñ€ÐµÐºÐ°, Ð°Ì Ðµ Ñкочила в тази река, коÑто щеше да течеÌ, -а не теÌче." - -

        - -

      2. По пъÌÑ‚Ñ Ð¿ÑŠÑ‚ÑƒÌват кюÌрди и югоÑлавÑÌни. - -
      - -
      -

      HTML Features

      - -Here is the Russian alphabet (uppercase only) coded in three -different ways, which should look identical: - -

      -

        -
      1. ÐБВГДЕЖЗИЙКЛМÐОПРСТУФХЦЧШЩЪЫЬЭЮЯ -  (Literal UTF-8) -
      2. АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ -  (Decimal numeric character reference) -
      3. АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ -  (Hexadecimal numeric character reference) -
      - -

      - -In another test, we use HTML language tags to distinguish Bulgarian, Russian, -and Serbian, -which have different italic forms for lowercase -б, г, д, п, and/or т: -

      -

      - - - - -
      Bulgarian:   -[ Ð±Ð³Ð´Ð¿Ñ‚ ]   -бгдпт ]   - Мога да Ñм Ñтъкло и не ме боли. -
      Russian: -[ Ð±Ð³Ð´Ð¿Ñ‚ ]   -бгдпт ]   -Я могу еÑть Ñтекло, Ñто мне не вредит. -
      Serbian: -[ Ð±Ð³Ð´Ð¿Ñ‚ ]   -бгдпт ]   - Могу јеÑти Ñтакло -а -да ми -не -шкоди. -
      -
      -

      - -


      -

      Credits, Tools, and Commentary

      - -
      -
      Credits:
      -
      -The "I can eat glass" phrase and the initial collection of translations: -Ethan Mollick. -Transcription / conversion to UTF-8: Frank da Cruz. -Albanian: Sindi Keesan. -Afrikaans: Johan Fourie, Kevin Poalses. -Anglo Saxon: Frank da Cruz. -Arabic: Najib Tounsi. -Armenian: Vaçe Kundakçı. -Belarusian: Alexey Chernyak. -Bengali: Somnath Purkayastha, Deepayan Sarkar. -Bislama: Dan McGarry. -Braille: Frank da Cruz. -Bulgarian: Sindi Keesan, Guentcho Skordev, Vladimir Marinov. -Burmese: "cetanapa". -Cabo Verde Creole: Cláudio Alexandre Duarte. -Catalán: Jordi Bancells. -Chinese: Jack Soo, Wong Pui Lam. -Chinook Jargon: David Robertson. -Cornish: Chris Stephens. -Croatian: Marjan Baće. -Czech: Stanislav Pecha, Radovan Garabík. -Dutch: Peter Gotink. Pim Blokland, Rob Daniel, Rob de Wit. -Erzian: Jack Rueter. -Esperanto: Franko Luin, Radovan Garabík. -Estonian: Meelis Roos. -Farsi/Persian: Payam Elahi. -Finnish: Sampsa Toivanen. -French: Luc Carissimo, Anne Colin du Terrail, Sean M. Burke. -Galician: Laura Probaos. -Georgian: Giorgi Lebanidze. -German: Christoph Päper, Otto Stolz, Karl Pentzlin, David Krings, -Frank da Cruz. -Gothic: Aurélien Coudurier. -Greek: Ariel Glenn, Constantine Stathopoulos, Siva Nataraja. -Hebrew: Jonathan Rosenne, Tal Barnea. -Hausa: Malami Buba, Tom Gewecke. -Hawaiian: na HauÊ»oli Motta, Anela de Rego, Kaliko Trapp. -Hindi: Shirish Kalele. -Hungarian: András Rácz, Mark Holczhammer. -Icelandic: Andrés Magnússon, Sveinn Baldursson. -International Phonetic Alphabet (IPA): Siva Nataraja / Vincent Ramos. -Irish: Michael Everson, Marion Gunn, James Kass, Curtis Clark. -Italian: Thomas De Bellis. -Japanese: Makoto Takahashi, Yurio Miyazawa. -Kirchröadsj: Roger Stoffers. -Kreyòl: Sean M. Burke. -Korean: Jungshik Shin. -Langenfelder Platt: David Krings. -Lëtzebuergescht: Stefaan Eeckels. -Lithuanian: Gediminas Grigas. -Lojban: Edward Cherlin. -Lusatian: Ronald Schaffhirt. -Macedonian: Sindi Keesan. -Malay: Zarina Mustapha. -Manx: Éanna Ó Brádaigh. -Marathi: Shirish Kalele. -Marquesan: Kaliko Trapp. -Middle English: Frank da Cruz. -Milanese: Marco Cimarosti. -Mongolian: Tom Gewecke. -Napoletano: Diego Quintano. -Navajo: Tom Gewecke. -Nórdicg: -Yẃlyan Rott. -Norwegian: Herman Ranes. -Odenwälderisch: Alexander Heß. -Old Irish: Michael Everson. -Old Norse: Andrés Magnússon. -Papiamentu: Bianca and Denise Zanardi. -Pashto: N.R. Liwal. -Pfälzisch: Dr. Johannes Sander. -Picard: Philippe Mennecier. -Polish: Juliusz Chroboczek, PaweÅ‚ Przeradowski. -Portuguese: "Cláudio" Alexandre Duarte, Bianca and Denise -Zanardi, Pedro Palhoto Matos, Wagner Amaral. -Québécois: Laurent Detillieux. -Roman: Pierpaolo Bernardi. -Romanian: Juliusz Chroboczek, Ionel Mugurel. -Ruhrdeutsch: "Timwi". -Russian: Alexey Chernyak, Serge Nesterovitch. -Sami: Anne Colin du Terrail, Luc Carissimo. -Sanskrit: Siva Nataraja / Vincent Ramos. -Sächsisch: André Müller. -Schwäbisch: Otto Stolz. -Scots: Jonathan Riddell. -Serbian: Sindi Keesan, Ranko Narancic, Boris Daljevic, Szilvia Csorba. -Slovak: G. Adam Stanislav, Radovan Garabík. -Slovenian: Albert Kolar. -Spanish: Aleida -Muñoz, Laura Probaos. -Swahili: Ronald Schaffhirt. -Swedish: Christian Rose, Bengt Larsson. -Taiwanese: Henry H. Tan-Tenn. -Tagalog: Jim Soliven. -Tamil: Vasee Vaseeharan. -Tibetan: D. Germano, Tom Gewecke. -Thai: Alan Wood's wife. -Turkish: Vaçe Kundakçı, Tom Gewecke, Merlign Olnon. -Ukrainian: Michael Zajac. -Urdu: Mustafa Ali. -Vietnamese: Dixon Au, -[James] Äá»— Bá Phước -杜 伯 福. -Walloon: Pablo Saratxaga. -Welsh: Geiriadur Prifysgol Cymru (Andrew). -Yiddish: Mark David, -Zeneise: Angelo Pavese. - -

      - -

      Tools Used to Create This Web Page:
      - -
      The UTF8-aware Kermit 95 terminal emulator on -Windows, to a Unix host with the EMACS text editor. Kermit -95 displays UTF-8 and also allows keyboard entry of arbitrary Unicode BMP -characters as 4 hex digits, as shown HERE. Hex codes -for Unicode values can be found in The Unicode -Standard (recommended) and the online code charts. When -submissions arrive by email encoded in some other character set (Latin-1, -Latin-2, KOI, various PC code pages, JEUC, etc), I use the TRANSLATE command -of C-Kermit on the Unix host (where I read my mail) to convert the character set to -UTF-8 (I could also use Kermit 95 for this; it has the same TRANSLATE -command). That's it -- no "Web authoring" tools, no locales, no "smart" -anything. It's just plain text, nothing more. By the way, there's nothing -special about EMACS -- any text editor will do, providing it allows entry of -arbitrary 8-bit bytes as text, including the 0x80-0x9F "C1" range. EMACS 21.1 -actually supports UTF-8; earlier versions don't know about it and display the -octal codes; either way is OK for this purpose. - -

      - -

      Commentary: -
      Date: Wed, 27 Feb 2002 13:21:59 +0100
      -From: "Bruno DEDOMINICIS" <b.dedominicis@cite-sciences.fr>
      -Subject: Je peux manger du verre, cela ne me fait pas mal. - -

      - -I just found out your website and it makes me feel like proposing an -interpretation of the choice of this peculiar phrase. - -

      - -Glass is transparent and can hurt as everyone knows. The relation between -people and civilisations is sometimes effusional and more often rude. The -concept of breaking frontiers through globalization, in a way, is also an -attempt to deny any difference. Isn't "transparency" the flag of modernity? -Nothing should be hidden any more, authority is obsolete, and the new powers -are supposed to reign through loving and smiling and no more through -coercion... - -

      - -Eating glass without pain sounds like a very nice metaphor of this attempt. -That is, frontiers should become glass transparent first, and be denied by -incorporating them. On the reverse, it shows that through globalization, -frontiers undergo a process of displacement, that is, when they are not any -more speakable, they become repressed from the speech and are therefore -incorporated and might become painful symptoms, as for example what happens -when one tries to eat glass. - -

      - -The frontiers that used to separate bodies one from another tend to divide -bodies from within and make them suffer.... The chosen phrase then appears -as a denial of the symptom that might result from the destitution of -traditional frontiers. - -

      -Best,
      -Bruno De Dominicis, Paris, France -

      - -

      -Other Unicode pages onsite: -

      -

      -Unicode samplers offsite: -

      -

      -Unicode fonts: -

      - -

      -[ Kermit 95 ] -[ K95 Screen Shots ] -[ C-Kermit ] -[ Kermit Home ] -[ Display Problems? ] -[ The Unicode Consortium ] -


      -
      -UTF-8 Sampler / The Kermit Project / -Columbia University / -kermit@columbia.edu -
      - - diff --git a/vendor/gems/hpricot-0.6/test/files/week9.html b/vendor/gems/hpricot-0.6/test/files/week9.html deleted file mode 100644 index 932e2da..0000000 --- a/vendor/gems/hpricot-0.6/test/files/week9.html +++ /dev/null @@ -1,1723 +0,0 @@ - - - -NFL Football Scores - CBS SportsLine.com - - - - - - - - - - - - - - - - - - - -
      -
      - -
      - -
      -
      - - - -
      - -
      Scoreboard presented by
      XXLXXL
      XXL
      -
      -
      - - - - -
      - - - - -
      - PARTNER LINKS   NFL.com  PGATOUR.com  NCAAsports.com   -
      -
      -
      -
      -
      - - - - - -
      - - - - - - - - - - - - - -
        Register · Help 
      -
      - - - - -
      - - - - - - - - - - - - - - -
      |  powered by Google
      - -
      -
      -
      - - - - - - - - - - -
      CBS SportsLine.comNFL Football Sports News
      - -
      -
      - - - - - -
      -
       Home  NFL  NBA  MLB  NHL  Coll FB  Coll BK  PGA TOUR  Autos  Tennis  Horses  More  
      -
      - - - - - - - - -
       Fantasy  Mobile  Games  Contests  Shop 
      -
      -
      - -
      - -
      - - -
      -· Home
      -· NFL
      -· NCAA
      -· MLB
      -· NBA
      -· NHL
      -· Fantasy - -
      - - -
      - - - - - - - - - - -
      - -
       NFL HomeScoreboardStandings | Schedules | Stats | Teams | Players | Transactions | Injuries | Fantasy News
      -
      - - - - - - - - - - - - - -
        - - - - -
      - Scoreboard - - - - -
      -

      - - - - - - - - - - - -
         - -
      -
      -
      - - - - - - - -
      ALERT:
      -
      -
      -
      - -
      - -
      Preseason WeekHall of Fame · 1 · 2 · 3 · 4 -
      -Week1 · 2 · 3 · 4 · 5 · 6 · 7 · 8 · 9 · 10 · 11 · 12 · 13 · 14 · 15 · 16 · 17 -
      -
      -
      - - - - - -
      -
      - -
       
      - - - - - -
      Open Date: Arizona, Carolina, N.Y. Jets, PhiladelphiaAll times are US/Eastern
      - -
       
      - -
      -
      -
      - -
       
      - -
      Sunday, November 5, 2006
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - -
      Ford Field
      - -
      Atlanta (5-3-0)770014
      Detroit  (2-6-0) «10731030
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      ATL: M. Vick (17-32, 163), M. Vick (10-80)
      DET: J. Kitna (20-32, 321), R. Williams (6-138) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Soldier Field
      - -
      Miami  (2-6-0) «01471031
      Chicago (7-1-0)373013
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      MIA: J. Harrington (16-32, 137), R. Brown (29-157)
      CHI: R. Grossman (18-42, 210), T. Jones (20-69) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Ralph Wilson Stadium
      - -
      Green Bay (3-5-0)007310
      Buffalo  (3-5-0) «3701424
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      GB: B. Favre (28-47, 287), A. Green (23-122)
      BUF: J. Losman (8-15, 102), A. Thomas (20-95) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      M&T Bank Stadium
      - -
      Cincinnati (4-4-0)0731020
      Baltimore  (6-2-0) «1436326
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      CIN: C. Palmer (12-26, 195), C. Henry (2-79)
      BAL: S. McNair (21-31, 245), T. Heap (4-84) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      FedEx Field
      - -
      Dallas (4-4-0)0127019
      Washington  (3-5-0) «5701022
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      DAL: T. Romo (24-36, 284), P. Crayton (4-84)
      WAS: M. Brunell (14-23, 192), C. Portis (23-84) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Raymond James Stadium
      - -
      New Orleans  (6-2-0) «14314031
      Tampa Bay (2-6-0)0140014
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      NO: D. Brees (24-32, 314), M. Colston (11-123)
      TB: B. Gradkowski (18-31, 185), J. Galloway (4-97) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Edward Jones Dome
      - -
      Kansas City  (5-3-0) «7170731
      St. Louis (4-4-0)0107017
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      KC: D. Huard (10-15, 148), L. Johnson (27-172)
      STL: M. Bulger (31-42, 354), S. Jackson (13-133) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Giants Stadium
      - -
      Houston (2-6-0)037010
      NY Giants  (6-2-0) «700714
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      HOU: D. Carr (21-30, 176), A. Johnson (9-83)
      NYG: E. Manning (17-28, 179), T. Barber (17-115) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      ALLTEL Stadium
      - -
      Tennessee (2-6-0)00077
      Jacksonville  (5-3-0) «14617037
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      TEN: V. Young (15-36, 163), B. Scaife (5-70)
      JAC: D. Garrard (12-22, 177), F. Taylor (13-79) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Monster Park
      - -
      Minnesota (4-4-0)30003
      San Francisco  (3-5-0) «06039
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      MIN: B. Johnson (21-31, 136), C. Taylor (26-96)
      SF: A. Smith (13-21, 105), F. Gore (19-41) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Qualcomm Stadium
      - -
      Cleveland (2-6-0)3901325
      San Diego  (6-2-0) «3771532
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      CLE: C. Frye (25-43, 236), K. Winslow (11-78)
      SD: P. Rivers (19-28, 211), L. Tomlinson (18-172) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Heinz Field
      - -
      Denver  (6-2-0) «14071031
      Pittsburgh (2-6-0)0107320
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      DEN: J. Plummer (16-27, 227), J. Walker (6-134)
      PIT: B. Roethlisberger (38-54, 433), H. Ward (7-127) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
      - -
      Gillette Stadium
      - -
      Indianapolis  (8-0-0) «7107327
      New England (6-2-0)0143320
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      IND: P. Manning (20-36, 326), M. Harrison (8-145)
      NE: T. Brady (20-35, 201), L. Maroney (13-63) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
       

      Monday, November 6, 2006
      -
      - - - - - -
      - -
      Qwest Field
      - -
      Oakland (2-6-0)00000
      Seattle  (5-3-0) «1030316
      -
      - - - - - - -
      - - - -
      - - Game Leaders
      OAK: A. Walter (16-35, 166), R. Moss (6-76)
      SEA: S. Wallace (18-30, 176), M. Morris (30-138) -
      -
      -
      - - -
      Recap · GameCenter · Live Commentary (Glog)
      -
      -
       
       

      - -
      - - - - - - - - - - - - -
      Key:
      possession = Possession
      « = Game Winner
       = Red Zone
       = New Play
      -
      - - -
       
      - -
      - - - - - - - - -
       
       
      - -
      - - - - - - - - - - - - - - -
      -Fantasy Football at CBS SportsLine.com -
      - - - - - -
      -Help · -User Comments · -Site Index · -Privacy Policy · -About Us · -Terms of Service -
      -CBS.com · -CBSNews.com · -TheShowBuzz.com · -CBS Corporation · -Advertise With Us -
      -CBS Sports Store · -The INSIDER · -Entertainment Tonight -
      - - - -
      -Copyright © 1995 - 2006 SportsLine.com, Inc. All rights reserved. SportsLine is a registered service mark of SportsLine.com, Inc.
      -CBS "eye device" is a registered trademark of CBS Broadcasting, Inc. - -
      - - - - diff --git a/vendor/gems/hpricot-0.6/test/files/why.xml b/vendor/gems/hpricot-0.6/test/files/why.xml deleted file mode 100644 index 3dd71fb..0000000 --- a/vendor/gems/hpricot-0.6/test/files/why.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - why the lucky stiff - http://whytheluckystiff.net - hex-editing reality to give us infinite grenades!! - en-us - - 2007-01-16T22:39:04+00:00 - - hourly - 1 - 2000-01-01T12:00+00:00 - 1.3http://whytheluckystiff.net/quatrains/1.3.htmlquatrains/1.3@http://whytheluckystiff.netquatrainsquatrainswhy the lucky stiff2007-01-14T08:47:05+00:00<blockquote> - <p>That cadillac of yours and that driver of yours!<br />You and your teacups rattling away in the back seat!<br />You always took the mike, oh, and all those cowboys you shot!<br />I held your hand! And I&#8217;ll shoot a cowboy one day!</p> - </blockquote> - <blockquote> - <p>You said, &#8220;Let&#8217;s run into the woods like kids!&#8221; <br />You said, &#8220;Let&#8217;s rub our hands together super-hot!&#8221; <br />And we scalded the trees and left octagons, I think that was you and<br />You threw parties on the roof!</p> - </blockquote> - diff --git a/vendor/gems/hpricot-0.6/test/load_files.rb b/vendor/gems/hpricot-0.6/test/load_files.rb deleted file mode 100644 index d18559a..0000000 --- a/vendor/gems/hpricot-0.6/test/load_files.rb +++ /dev/null @@ -1,7 +0,0 @@ -module TestFiles - Dir.chdir(File.dirname(__FILE__)) do - Dir['files/*.{html,xhtml,xml}'].each do |fname| - const_set fname[%r!/(\w+)\.\w+$!, 1].upcase, IO.read(fname) - end - end -end diff --git a/vendor/gems/hpricot-0.6/test/test_alter.rb b/vendor/gems/hpricot-0.6/test/test_alter.rb deleted file mode 100644 index 69e9568..0000000 --- a/vendor/gems/hpricot-0.6/test/test_alter.rb +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'hpricot' -require 'load_files' - -class TestAlter < Test::Unit::TestCase - def setup - @basic = Hpricot.parse(TestFiles::BASIC) - end - - def test_before - test0 = "" - @basic.at("link").before(test0) - assert_equal 'test0.css', @basic.at("link").attributes['href'] - end - - def test_after - test_inf = "" - @basic.search("link")[-1].after(test_inf) - assert_equal 'test_inf.css', @basic.search("link")[-1].attributes['href'] - end - - def test_wrap - ohmy = (@basic/"p.ohmy").wrap("
      ") - assert_equal 'wrapper', ohmy[0].parent['id'] - assert_equal 'ohmy', Hpricot(@basic.to_html).at("#wrapper").children[0]['class'] - end - - def test_add_class - first_p = (@basic/"p:first").add_class("testing123") - assert first_p[0].get_attribute("class").split(" ").include?("testing123") - assert (Hpricot(@basic.to_html)/"p:first")[0].attributes["class"].split(" ").include?("testing123") - assert !(Hpricot(@basic.to_html)/"p:gt(0)")[0].attributes["class"].split(" ").include?("testing123") - end - - def test_change_attributes - all_ps = (@basic/"p").attr("title", "Some Title") - all_as = (@basic/"a").attr("href", "http://my_new_href.com") - all_lb = (@basic/"link").attr("href") { |e| e.name } - assert_changed(@basic, "p", all_ps) {|p| p.attributes["title"] == "Some Title"} - assert_changed(@basic, "a", all_as) {|a| a.attributes["href"] == "http://my_new_href.com"} - assert_changed(@basic, "link", all_lb) {|a| a.attributes["href"] == "link" } - end - - def test_remove_attr - all_rl = (@basic/"link").remove_attr("href") - assert_changed(@basic, "link", all_rl) { |link| link['href'].nil? } - end - - def test_remove_class - all_c1 = (@basic/"p[@class*='last']").remove_class("last") - assert_changed(@basic, "p[@class*='last']", all_c1) { |p| p['class'] == 'final' } - end - - def test_remove_all_classes - all_c2 = (@basic/"p[@class]").remove_class - assert_changed(@basic, "p[@class]", all_c2) { |p| p['class'].nil? } - end - - def assert_changed original, selector, set, &block - assert set.all?(&block) - assert Hpricot(original.to_html).search(selector).all?(&block) - end -end diff --git a/vendor/gems/hpricot-0.6/test/test_builder.rb b/vendor/gems/hpricot-0.6/test/test_builder.rb deleted file mode 100644 index 3cfe759..0000000 --- a/vendor/gems/hpricot-0.6/test/test_builder.rb +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'hpricot' - -class TestBuilder < Test::Unit::TestCase - def test_escaping_text - doc = Hpricot() { b "" } - assert_equal "<a"b>", doc.to_html - assert_equal %{}, doc.at("text()").to_s - end - - def test_no_escaping_text - doc = Hpricot() { div.test.me! { text "" } } - assert_equal %{
      }, doc.to_html - assert_equal %{}, doc.at("text()").to_s - end - - def test_latin1_entities - doc = Hpricot() { b "\200\225" } - assert_equal "ۥ", doc.to_html - assert_equal "\342\202\254\342\200\242", doc.at("text()").to_s - end -end diff --git a/vendor/gems/hpricot-0.6/test/test_parser.rb b/vendor/gems/hpricot-0.6/test/test_parser.rb deleted file mode 100644 index 88c7681..0000000 --- a/vendor/gems/hpricot-0.6/test/test_parser.rb +++ /dev/null @@ -1,379 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'hpricot' -require 'load_files' - -class TestParser < Test::Unit::TestCase - def test_set_attr - @basic = Hpricot.parse(TestFiles::BASIC) - @basic.search('//p').set('class', 'para') - assert_equal 4, @basic.search('//p').length - assert_equal 4, @basic.search('//p').find_all { |x| x['class'] == 'para' }.length - end - - # Test creating a new element - def test_new_element - elem = Hpricot::Elem.new(Hpricot::STag.new('form')) - assert_not_nil(elem) - assert_not_nil(elem.attributes) - end - - def test_scan_text - assert_equal 'FOO', Hpricot.make("FOO").first.content - end - - def test_filter_by_attr - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - - # this link is escaped in the doc - link = 'http://www.youtube.com/watch?v=TvSNXyNw26g&search=chris%20ware' - assert_equal link, @boingboing.at("a[@href='#{link}']")['href'] - end - - def test_filter_contains - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal 'Sample XHTML', @basic.search("title:contains('Sample')").to_s - end - - def test_get_element_by_id - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal 'link1', @basic.get_element_by_id('link1')['id'] - assert_equal 'link1', @basic.get_element_by_id('body1').get_element_by_id('link1').get_attribute('id') - end - - def test_get_element_by_tag_name - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal 'link1', @basic.get_elements_by_tag_name('a')[0].get_attribute('id') - assert_equal 'link1', @basic.get_elements_by_tag_name('body')[0].get_element_by_id('link1').get_attribute('id') - end - - def test_output_basic - @basic = Hpricot.parse(TestFiles::BASIC) - @basic2 = Hpricot.parse(@basic.inner_html) - scan_basic @basic2 - end - - def test_scan_basic - @basic = Hpricot.parse(TestFiles::BASIC) - scan_basic @basic - end - - def scan_basic doc - assert_kind_of Hpricot::XMLDecl, doc.children.first - assert_not_equal doc.children.first.to_s, doc.children[1].to_s - assert_equal 'link1', doc.at('#link1')['id'] - assert_equal 'link1', doc.at("p a")['id'] - assert_equal 'link1', (doc/:p/:a).first['id'] - assert_equal 'link1', doc.search('p').at('a').get_attribute('id') - assert_equal 'link2', (doc/'p').filter('.ohmy').search('a').first.get_attribute('id') - assert_equal (doc/'p')[2], (doc/'p').filter(':nth(2)')[0] - assert_equal (doc/'p')[2], (doc/'p').filter('[3]')[0] - assert_equal 4, (doc/'p').filter('*').length - assert_equal 4, (doc/'p').filter('* *').length - eles = (doc/'p').filter('.ohmy') - assert_equal 1, eles.length - assert_equal 'ohmy', eles.first.get_attribute('class') - assert_equal 3, (doc/'p:not(.ohmy)').length - assert_equal 3, (doc/'p').not('.ohmy').length - assert_equal 3, (doc/'p').not(eles.first).length - assert_equal 2, (doc/'p').filter('[@class]').length - assert_equal 'last final', (doc/'p[@class~="final"]').first.get_attribute('class') - assert_equal 1, (doc/'p').filter('[@class~="final"]').length - assert_equal 2, (doc/'p > a').length - assert_equal 1, (doc/'p.ohmy > a').length - assert_equal 2, (doc/'p / a').length - assert_equal 2, (doc/'link ~ link').length - assert_equal 3, (doc/'title ~ link').length - assert_equal 5, (doc/"//p/text()").length - assert_equal 6, (doc/"//p[a]//text()").length - assert_equal 2, (doc/"//p/a/text()").length - end - - def test_positional - h = Hpricot( "

      one

      two

      " ) - assert_equal "

      one

      ", h.search("//div/p:eq(0)").to_s - assert_equal "

      one

      ", h.search("//div/p:first").to_s - assert_equal "

      one

      ", h.search("//div/p:first()").to_s - end - - def test_pace - doc = Hpricot(TestFiles::PACE_APPLICATION) - assert_equal 'get', doc.at('form[@name=frmSect11]')['method'] - # assert_equal '2', doc.at('#hdnSpouse')['value'] - end - - def test_scan_boingboing - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - assert_equal 60, (@boingboing/'p.posted').length - assert_equal 1, @boingboing.search("//a[@name='027906']").length - assert_equal 10, @boingboing.search("script comment()").length - assert_equal 3, @boingboing.search("a[text()*='Boing']").length - assert_equal 1, @boingboing.search("h3[text()='College kids reportedly taking more smart drugs']").length - assert_equal 0, @boingboing.search("h3[text()='College']").length - assert_equal 60, @boingboing.search("h3").length - assert_equal 59, @boingboing.search("h3[text()!='College kids reportedly taking more smart drugs']").length - assert_equal 17, @boingboing.search("h3[text()$='s']").length - assert_equal 129, @boingboing.search("p[text()]").length - assert_equal 211, @boingboing.search("p").length - end - - def test_reparent - doc = Hpricot(%{
      }) - div1 = doc.search('#blurb_1') - div1.before('
      ') - - div0 = doc.search('#blurb_0') - div0.before('
      ') - - assert_equal 'div', doc.at('#blurb_1').name - end - - def test_siblings - @basic = Hpricot.parse(TestFiles::BASIC) - t = @basic.at(:title) - e = t.next_sibling - assert_equal 'test1.css', e['href'] - assert_equal 'title', e.previous_sibling.name - end - - def test_css_negation - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal 3, (@basic/'p:not(.final)').length - end - - def test_remove_attribute - @basic = Hpricot.parse(TestFiles::BASIC) - (@basic/:p).each { |ele| ele.remove_attribute('class') } - assert_equal 0, (@basic/'p[@class]').length - end - - def test_abs_xpath - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - assert_equal 60, @boingboing.search("/html/body//p[@class='posted']").length - assert_equal 60, @boingboing.search("/*/body//p[@class='posted']").length - assert_equal 18, @boingboing.search("//script").length - divs = @boingboing.search("//script/../div") - assert_equal 1, divs.length - imgs = @boingboing.search('//div/p/a/img') - assert_equal 15, imgs.length - assert_equal 17, @boingboing.search('//div').search('p/a/img').length - assert imgs.all? { |x| x.name == 'img' } - end - - def test_predicates - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - assert_equal 2, @boingboing.search('//link[@rel="alternate"]').length - p_imgs = @boingboing.search('//div/p[/a/img]') - assert_equal 15, p_imgs.length - assert p_imgs.all? { |x| x.name == 'p' } - p_imgs = @boingboing.search('//div/p[a/img]') - assert_equal 18, p_imgs.length - assert p_imgs.all? { |x| x.name == 'p' } - assert_equal 1, @boingboing.search('//input[@checked]').length - end - - def test_tag_case - @tenderlove = Hpricot.parse(TestFiles::TENDERLOVE) - assert_equal 2, @tenderlove.search('//a').length - assert_equal 3, @tenderlove.search('//area').length - assert_equal 2, @tenderlove.search('//meta').length - end - - def test_alt_predicates - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - assert_equal 1, @boingboing.search('//table/tr:last').length - - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal "

      The third paragraph

      ", - @basic.search('p:eq(2)').to_html - assert_equal '

      THE FINAL PARAGRAPH

      ', - @basic.search('p:last').to_html - assert_equal 'last final', @basic.search('//p:last-of-type').first.get_attribute('class') - end - - def test_insert_after # ticket #63 - doc = Hpricot('
      ') - (doc/'div').each do |element| - element.after('

      Paragraph 1

      Paragraph 2

      ') - end - assert_equal doc.to_html, '

      Paragraph 1

      Paragraph 2

      ' - end - - def test_insert_before # ticket #61 - doc = Hpricot('
      ') - (doc/'div').each do |element| - element.before('

      Paragraph 1

      Paragraph 2

      ') - end - assert_equal doc.to_html, '

      Paragraph 1

      Paragraph 2

      ' - end - - def test_many_paths - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - assert_equal 62, @boingboing.search('p.posted, link[@rel="alternate"]').length - assert_equal 20, @boingboing.search('//div/p[a/img]|//link[@rel="alternate"]').length - end - - def test_stacked_search - @boingboing = Hpricot.parse(TestFiles::BOINGBOING) - assert_kind_of Hpricot::Elements, @boingboing.search('//div/p').search('a img') - end - - def test_class_search - # test case sent by Chih-Chao Lam - doc = Hpricot("
      abc
      ") - assert_equal 1, doc.search(".xyz").length - doc = Hpricot("
      abc
      xyz
      ") - assert_equal 1, doc.search(".xyz").length - assert_equal 4, doc.search("*").length - end - - def test_kleene_star - # bug noticed by raja bhatia - doc = Hpricot("1
      2
      3
      4") - assert_equal 2, doc.search("*[@class*='small']").length - assert_equal 2, doc.search("*.small").length - assert_equal 2, doc.search(".small").length - assert_equal 2, doc.search(".large").length - end - - def test_empty_comment - doc = Hpricot("

      ") - assert doc.children[0].children[0].comment? - doc = Hpricot("

      ") - assert doc.children[0].children[0].comment? - end - - def test_body_newlines - @immob = Hpricot.parse(TestFiles::IMMOB) - body = @immob.at(:body) - {'background' => '', 'bgcolor' => '#ffffff', 'text' => '#000000', 'marginheight' => '10', - 'marginwidth' => '10', 'leftmargin' => '10', 'topmargin' => '10', 'link' => '#000066', - 'alink' => '#ff6600', 'hlink' => "#ff6600", 'vlink' => "#000000"}.each do |k, v| - assert_equal v, body[k] - end - end - - def test_nested_twins - @doc = Hpricot("
      Hi
      there
      ") - assert_equal 1, (@doc/"div div").length - end - - def test_wildcard - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal 3, (@basic/"*[@id]").length - assert_equal 3, (@basic/"//*[@id]").length - end - - def test_javascripts - @immob = Hpricot.parse(TestFiles::IMMOB) - assert_equal 3, (@immob/:script)[0].inner_html.scan(/
      }, - %{
      }, - %{
      }, - %{
      }]. - each do |str| - doc = Hpricot(str) - assert_equal 1, (doc/:form).length - assert_equal '/units/a/login/1,13088,779-1,00.html', doc.at("form")['action'] - end - end - - def test_procins - doc = Hpricot("\n") - assert_equal "php", doc.children[0].target - assert_equal "blah='blah'", doc.children[2].content - end - - def test_buffer_error - assert_raise Hpricot::ParseError, "ran out of buffer space on element , starting on line 3." do - Hpricot(%{

      \n\n\n\n

      }) - end - end - - def test_youtube_attr - str = <<-edoc - - Lorem ipsum. Jolly roger, ding-dong sing-a-long - - - - - - - Check out my posting, I have bright mice in large clown cars. - - - - - - - - HAI - edoc - assert_equal "HAI", doc.at("body").inner_text - end - - # Reported by Jonathan Nichols on the Hpricot list (24 May 2007) - def test_self_closed_form - doc = Hpricot(<<-edoc) - -
      - -
      - - edoc - assert_equal "button", doc.at("//form/input")['type'] - end - - def test_filters - @basic = Hpricot.parse(TestFiles::BASIC) - assert_equal 0, (@basic/"title:parent").size - assert_equal 3, (@basic/"p:parent").size - assert_equal 1, (@basic/"title:empty").size - assert_equal 1, (@basic/"p:empty").size - end - - def test_keep_cdata - str = %{} - assert_equal str, Hpricot(str).to_html - end - - def test_namespace - chunk = <<-END - - hi - - END - doc = Hpricot::XML(chunk) - assert (doc/"//t:sam").size > 0 # at least this should probably work - # assert (doc/"//sam").size > 0 # this would be nice - end -end diff --git a/vendor/gems/hpricot-0.6/test/test_paths.rb b/vendor/gems/hpricot-0.6/test/test_paths.rb deleted file mode 100644 index 7204b77..0000000 --- a/vendor/gems/hpricot-0.6/test/test_paths.rb +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'hpricot' -require 'load_files' - -class TestParser < Test::Unit::TestCase - def test_roundtrip - @basic = Hpricot.parse(TestFiles::BASIC) - %w[link link[2] body #link1 a p.ohmy].each do |css_sel| - ele = @basic.at(css_sel) - assert_equal ele, @basic.at(ele.css_path) - assert_equal ele, @basic.at(ele.xpath) - end - end -end diff --git a/vendor/gems/hpricot-0.6/test/test_preserved.rb b/vendor/gems/hpricot-0.6/test/test_preserved.rb deleted file mode 100644 index 673e980..0000000 --- a/vendor/gems/hpricot-0.6/test/test_preserved.rb +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'hpricot' -require 'load_files' - -class TestPreserved < Test::Unit::TestCase - def assert_roundtrip str - doc = Hpricot(str) - yield doc if block_given? - str2 = doc.to_original_html - [*str].zip([*str2]).each do |s1, s2| - assert_equal s1, s2 - end - end - - def assert_html str1, str2 - doc = Hpricot(str2) - yield doc if block_given? - assert_equal str1, doc.to_original_html - end - - def test_simple - str = "

      Hpricot is a you know uh fine thing.

      " - assert_html str, str - assert_html "

      Hpricot is a you know uh fine thing.

      ", str do |doc| - (doc/:p).set('class', 'new') - end - end - - def test_parent - str = "Test

      Paragraph one.

      Paragraph two.

      " - assert_html str, str - assert_html "

      Paragraph one.

      Paragraph two.

      ", str do |doc| - (doc/:head).remove - (doc/:div).set('id', 'all') - (doc/:p).wrap('
      ') - end - end - - def test_escaping_of_contents - doc = Hpricot(TestFiles::BOINGBOING) - assert_equal "Fukuda\342\200\231s Automatic Door opens around your body as you pass through it. The idea is to save energy and keep the room clean.", doc.at("img[@alt='200606131240']").next.to_s.strip - end - - def test_files - assert_roundtrip TestFiles::BASIC - assert_roundtrip TestFiles::BOINGBOING - assert_roundtrip TestFiles::CY0 - end - - def test_escaping_of_attrs - # ampersands in URLs - str = %{Google} - link = (doc = Hpricot(str)).at(:a) - assert_equal "http://google.com/search?q=hpricot&l=en", link['href'] - assert_equal "http://google.com/search?q=hpricot&l=en", link.attributes['href'] - assert_equal "http://google.com/search?q=hpricot&l=en", link.get_attribute('href') - assert_equal "http://google.com/search?q=hpricot&l=en", link.raw_attributes['href'] - assert_equal str, doc.to_html - - # alter the url - link['href'] = "javascript:alert(\"AGGA-KA-BOO!\")" - assert_equal %{Google}, doc.to_html - end -end diff --git a/vendor/gems/hpricot-0.6/test/test_xml.rb b/vendor/gems/hpricot-0.6/test/test_xml.rb deleted file mode 100644 index ac9306d..0000000 --- a/vendor/gems/hpricot-0.6/test/test_xml.rb +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env ruby - -require 'test/unit' -require 'hpricot' -require 'load_files' - -class TestParser < Test::Unit::TestCase - # normally, the link tags are empty HTML tags. - # contributed by laudney. - def test_normally_empty - doc = Hpricot::XML("this is titlehttp://fake.com") - assert_equal "this is title", (doc/:rss/:channel/:title).text - assert_equal "http://fake.com", (doc/:rss/:channel/:link).text - end - - # make sure XML doesn't get downcased - def test_casing - doc = Hpricot::XML(TestFiles::WHY) - assert_equal "hourly", (doc.at "sy:updatePeriod").inner_html - assert_equal 1, (doc/"guid[@isPermaLink]").length - end - - # be sure tags named "text" are ok - def test_text_tags - doc = Hpricot::XML("City PoisonedRita Lee has poisoned Brazil.") - assert_equal "City Poisoned", (doc/"title").text - end -end diff --git a/vendor/gems/icalendar-1.0.2/COPYING b/vendor/gems/icalendar-1.0.2/COPYING deleted file mode 100644 index 870a5f2..0000000 --- a/vendor/gems/icalendar-1.0.2/COPYING +++ /dev/null @@ -1,56 +0,0 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the GPL -(see the file GPL), or the conditions below: - - 1. You may make and give away verbatim copies of the source form of the - software without restriction, provided that you duplicate all of the - original copyright notices and associated disclaimers. - - 2. You may modify your copy of the software in any way, provided that - you do at least ONE of the following: - - a) place your modifications in the Public Domain or otherwise - make them Freely Available, such as by posting said - modifications to Usenet or an equivalent medium, or by allowing - the author to include your modifications in the software. - - b) use the modified software only within your corporation or - organization. - - c) give non-standard binaries non-standard names, with - instructions on where to get the original software distribution. - - d) make other distribution arrangements with the author. - - 3. You may distribute the software in object code or binary form, - provided that you do at least ONE of the following: - - a) distribute the binaries and library files of the software, - together with instructions (in the manual page or equivalent) - on where to get the original distribution. - - b) accompany the distribution with the machine-readable source of - the software. - - c) give non-standard binaries non-standard names, with - instructions on where to get the original software distribution. - - d) make other distribution arrangements with the author. - - 4. You may modify and include the part of the software into any other - software (possibly commercial). But some files in the distribution - are not written by the author, so that they are not under these terms. - - For the list of those files and their copying conditions, see the - file LEGAL. - - 5. The scripts and library files supplied as input to or produced as - output from the software do not automatically fall under the - copyright of the software, but belong to whomever generated them, - and may be sold commercially, and may be aggregated with this - software. - - 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. diff --git a/vendor/gems/icalendar-1.0.2/GPL b/vendor/gems/icalendar-1.0.2/GPL deleted file mode 100644 index 5b6e7c6..0000000 --- a/vendor/gems/icalendar-1.0.2/GPL +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/vendor/gems/icalendar-1.0.2/README b/vendor/gems/icalendar-1.0.2/README deleted file mode 100644 index 90091e5..0000000 --- a/vendor/gems/icalendar-1.0.2/README +++ /dev/null @@ -1,141 +0,0 @@ -= iCalendar -- Internet calendaring, Ruby style - -This is a Ruby library for dealing with iCalendar files. Rather than -explaining myself, here is the introduction from RFC-2445, which -defines the format: - -The use of calendaring and scheduling has grown considerably in the -last decade. Enterprise and inter-enterprise business has become -dependent on rapid scheduling of events and actions using this -information technology. However, the longer term growth of calendaring -and scheduling, is currently limited by the lack of Internet standards -for the message content types that are central to these knowledgeware -applications. This memo is intended to progress the level of -interoperability possible between dissimilar calendaring and -scheduling applications. This memo defines a MIME content type for -exchanging electronic calendaring and scheduling information. The -Internet Calendaring and Scheduling Core Object Specification, or -iCalendar, allows for the capture and exchange of information normally -stored within a calendaring and scheduling application; such as a -Personal Information Manager (PIM) or a Group Scheduling product. - -The iCalendar format is suitable as an exchange format between -applications or systems. The format is defined in terms of a MIME -content type. This will enable the object to be exchanged using -several transports, including but not limited to SMTP, HTTP, a file -system, desktop interactive protocols such as the use of a memory- -based clipboard or drag/drop interactions, point-to-point asynchronous -communication, wired-network transport, or some form of unwired -transport such as infrared might also be used. - -Now for some examples: - -## Probably want to start with this - - require 'rubygems' # Unless you install from the tarball or zip. - require 'icalendar' - require 'date' - - include Icalendar # Probably do this in your class to limit namespace overlap - -## Creating calendars and events is easy. - - # Create a calendar with an event (standard method) - cal = Calendar.new - cal.event do - dtstart Date.new(2005, 04, 29) - dtend Date.new(2005, 04, 28) - summary "Meeting with the man." - description "Have a long lunch meeting and decide nothing..." - klass "PRIVATE" - end - - cal.publish - -## Or you can make events like this - event = Event.new - event.start = DateTime.civil(2006, 6, 23, 8, 30) - event.summary = "A great event!" - cal.add_event(event) - - event2 = cal.event # This automatically adds the event to the calendar - event2.start = DateTime.civil(2006, 6, 24, 8, 30) - event2.summary = "Another great event!" - - # Now with support for property parameters - params = {"ALTREP" =>['"http://my.language.net"'], "LANGUAGE" => ["SPANISH"]} - - cal.event do - dtstart Date.new(2005, 04, 29) - dtend Date.new(2005, 04, 28) - summary "This is a summary with params.", params - end - - # We can output the calendar as a string to write to a file, - # network port, database etc. - cal_string = cal.to_ical - puts cal_string - -== Parsing iCalendars: - - # Open a file or pass a string to the parser - cal_file = File.open("single_event.ics") - - # Parser returns an array of calendars because a single file - # can have multiple calendars. - cals = Icalendar.parse(cal_file) - cal = cals.first - - # Now you can access the cal object in just the same way I created it - event = cal.events.first - - puts "start date-time: " + event.dtstart - puts "summary: " + event.summary - -== Finders: - -Often times in web apps and other interactive applications you'll need to -lookup items in a calendar to make changes or get details. Now you can find -everything by the unique id automatically associated with all components. - - cal = Calendar.new - 10.times { cal.event } # Create 10 events with only default data. - some_event = cal.events[5] # Grab it from the array of events - - # Use the uid as the key in your app - key = some_event.uid - - # so later you can find it. - same_event = cal.find_event(key) - -== Examples: - -Check the unit tests for examples of most things you'll want to do, but please -send me example code or let me know what's missing. - -== Download - -The latest release version of this library can be found at - -* http://rubyforge.org/projects/icalendar/ - -Documentation can be found at - -* http://icalendar.rubyforge.org/ - -== Installation - -It's all about rubygems: - -$ sudo gem install icalendar - -== License - -This library is released under the same license as Ruby itself. - -== Support & Contributions - -The iCalendar library homepage is http://icalendar.rubyforge.org/ - -There is an icalendar-devel@rubyforge.org mailing list that can be -used for asking questions, making comments or submitting patches. diff --git a/vendor/gems/icalendar-1.0.2/Rakefile b/vendor/gems/icalendar-1.0.2/Rakefile deleted file mode 100644 index 8bdef02..0000000 --- a/vendor/gems/icalendar-1.0.2/Rakefile +++ /dev/null @@ -1,110 +0,0 @@ -require 'rubygems' -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' -require 'rake/clean' -require 'rake/contrib/sshpublisher' - -PKG_VERSION = "1.0.2" - -$VERBOSE = nil -TEST_CHANGES_SINCE = Time.now - 600 # Recent tests = changed in last 10 minutes - -desc "Run all the unit tests" -task :default => [ :test, :lines ] - -desc "Run the unit tests in test" -Rake::TestTask.new(:test) { |t| - t.libs << "test" - t.test_files = FileList['test/*_test.rb', 'test/component/*_test.rb'] - t.verbose = true -} - -# rcov code coverage -rcov_path = '/usr/local/bin/rcov' -rcov_test_output = "./test/coverage" -rcov_exclude = "interactive.rb,read_write.rb,fixtures" - -# Add our created paths to the 'rake clobber' list -CLOBBER.include(rcov_test_output) - -desc 'Removes all previous unit test coverage information' -task (:reset_unit_test_coverage) do |t| - rm_rf rcov_unit_test_output - mkdir rcov_unit_test_output -end - -desc 'Run all unit tests with Rcov to measure coverage' -Rake::TestTask.new(:rcov) do |t| - t.libs << "test" - t.pattern = 'test/**/*_test.rb' - t.ruby_opts << rcov_path - t.ruby_opts << "-o #{rcov_test_output}" - t.ruby_opts << "-x #{rcov_exclude}" - t.verbose = true -end - -# Generate the RDoc documentation -Rake::RDocTask.new(:doc) { |rdoc| - rdoc.main = 'README' - rdoc.rdoc_files.include('lib/**/*.rb', 'README') - rdoc.rdoc_files.include('GPL', 'COPYING') - rdoc.rdoc_dir = 'docs/api' - rdoc.title = "iCalendar -- Internet Calendaring for Ruby" - rdoc.options << "--include=examples --line-numbers --inline-source" - rdoc.options << "--accessor=ical_component,ical_property,ical_multi_property" -} - -Gem::manage_gems -require 'rake/gempackagetask' - -spec = Gem::Specification.new do |s| - s.name = "icalendar" - s.version = PKG_VERSION - s.homepage = "http://icalendar.rubyforge.org/" - s.platform = Gem::Platform::RUBY - s.summary = "A ruby implementation of the iCalendar specification (RFC-2445)." - s.description = "Implements the iCalendar specification (RFC-2445) in Ruby. This allows for the generation and parsing of .ics files, which are used by a variety of calendaring applications." - - s.files = FileList["{test,lib,docs,examples}/**/*"].to_a - s.files += ["Rakefile", "README", "COPYING", "GPL" ] - s.require_path = "lib" - s.autorequire = "icalendar" - s.has_rdoc = true - s.extra_rdoc_files = ["README", "COPYING", "GPL"] - s.rdoc_options.concat ['--main', 'README'] - - s.author = "Jeff Rose" - s.email = "rosejn@gmail.com" -end - -Rake::GemPackageTask.new(spec) do |pkg| - pkg.gem_spec = spec - pkg.need_tar = true - pkg.need_zip = true -end - -desc 'Install the gem globally (requires sudo)' -task :install => :package do |t| - `sudo gem install pkg/icalendar-#{PKG_VERSION}.gem` -end - -task :lines do - lines = 0 - codelines = 0 - Dir.foreach("lib/icalendar") { |file_name| - next unless file_name =~ /.*rb/ - - f = File.open("lib/icalendar/" + file_name) - - while line = f.gets - lines += 1 - next if line =~ /^\s*$/ - next if line =~ /^\s*#/ - codelines += 1 - end - } - puts "\n------------------------------\n" - puts "Total Lines: #{lines}" - puts "Lines of Code: #{codelines}" -end diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/itip_notes.txt b/vendor/gems/icalendar-1.0.2/docs/rfcs/itip_notes.txt deleted file mode 100644 index 492fb39..0000000 --- a/vendor/gems/icalendar-1.0.2/docs/rfcs/itip_notes.txt +++ /dev/null @@ -1,69 +0,0 @@ -Set of methods used for transactions: - -PUBLISH: -- Publish a calendar entry to one or more users. - -REQUEST: -- Used to schedule a calendar entry with other users. -- Require REPLY messages from others. -- Used by Organizers to update status of entries. - -REPLY: -- Attendees use this to send information back to Organizers who have sent a - REQUEST message. - -ADD: -- Add one or more instances to an existing entry. - -CANCEL: -- Cancel a calendar item. - -REFRESH: -- Attendee's use this to get the latest version of an item. - -COUNTER: -- Used by an attendee to negotiate a change in a calendar entry. - -DECLINE-COUNTER: -- Used by an organizer to decline a COUNTER message. - - -Transports: - -Real-time vs. Store-and-forward? - -Entry Status: -- Only the organizer can set the STATUS property -- Attendee's use the "partstat" parameter of the ATTENDEE property to convey - their personal status. -- Initial value of "partstat" is set to "NEEDS-ACTION" by organizer -- Modifying this state is part of an attendee's REPLY message. - -Sequence Property: -- Used to tell manage different versions of an entry -- Has specific rules so look at these - -Handling messages should be done in this manner: - -1. The primary key for referencing a particular iCalendar component - is the "UID" property value. To reference an instance of a - recurring component, the primary key is composed of the "UID" and - the "RECURRENCE-ID" properties. -2. The secondary key for referencing a component is the "SEQUENCE" - property value. For components where the "UID" is the same, the - component with the highest numeric value for the "SEQUENCE" - property obsoletes all other revisions of the component with - lower values. -3. "Attendees" send "REPLY" messages to the "Organizer". For - replies where the "UID" property value is the same, the value of - the "SEQUENCE" property indicates the revision of the component - to which the "Attendee" is replying. The reply with the highest - numeric value for the "SEQUENCE" property obsoletes all other - replies with lower values. -4. In situations where the "UID" and "SEQUENCE" properties match, - the "DTSTAMP" property is used as the tie-breaker. The component - with the latest "DTSTAMP" overrides all others. Similarly, for - "Attendee" responses where the "UID" property values match and - the "SEQUENCE" property values match, the response with the - latest "DTSTAMP" overrides all others. - diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2425.pdf b/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2425.pdf deleted file mode 100644 index b87c34c..0000000 Binary files a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2425.pdf and /dev/null differ diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2426.pdf b/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2426.pdf deleted file mode 100644 index c1a75cb..0000000 Binary files a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2426.pdf and /dev/null differ diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2445.pdf b/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2445.pdf deleted file mode 100644 index ede6cb5..0000000 Binary files a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2445.pdf and /dev/null differ diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2446.pdf b/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2446.pdf deleted file mode 100644 index 0dad4f8..0000000 Binary files a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2446.pdf and /dev/null differ diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2447.pdf b/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2447.pdf deleted file mode 100644 index 17c2f90..0000000 Binary files a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc2447.pdf and /dev/null differ diff --git a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc3283.txt b/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc3283.txt deleted file mode 100644 index a1b4aca..0000000 --- a/vendor/gems/icalendar-1.0.2/docs/rfcs/rfc3283.txt +++ /dev/null @@ -1,738 +0,0 @@ - - - -RFC 3283 (rfc3283) - Guide to Internet Calendaring - - - - -

      -

      RFC 3283 (RFC3283)

      -

      Internet RFC/STD/FYI/BCP Archives

      - -
      [ RFC Index | RFC Search | Usenet FAQs | Web FAQs | Documents | Cities ] -

      -Alternate Formats: - rfc3283.txt

      -

      -

      RFC 3283 - Guide to Internet Calendaring

      -
      -
      -
      -Network Working Group                                         B. Mahoney
      -Request for Comments: 3283                                           MIT
      -Category: Informational                                        G. Babics
      -                                                                 Steltor
      -                                                                A. Taler
      -                                                               June 2002
      -
      -                     Guide to Internet Calendaring
      -
      -Status of this Memo
      -
      -   This memo provides information for the Internet community.  It does
      -   not specify an Internet standard of any kind.  Distribution of this
      -   memo is unlimited.
      -
      -Copyright Notice
      -
      -   Copyright (C) The Internet Society (2002).  All Rights Reserved.
      -
      -Abstract
      -
      -   This document describes the various Internet calendaring and
      -   scheduling standards and works in progress, and the relationships
      -   between them.  Its intent is to provide a context for these
      -   documents, assist in their understanding, and potentially aid in the
      -   design of standards-based calendaring and scheduling systems.  The
      -   standards addressed are RFC 2445 (iCalendar), RFC 2446 (iTIP), and
      -   RFC 2447 (iMIP).  The work in progress addressed is "Calendar Access
      -   Protocol" (CAP).  This document also describes issues and problems
      -   that are not solved by these protocols, and that could be targets for
      -   future work.
      -
      -Table of Contents
      -
      -   1.    Introduction . . . . . . . . . . . . . . . . . . . . . . . .  2
      -   1.1   Terminology  . . . . . . . . . . . . . . . . . . . . . . . .  2
      -   1.2   Concepts and Relationships . . . . . . . . . . . . . . . . .  4
      -   2.    Requirements . . . . . . . . . . . . . . . . . . . . . . . .  4
      -   2.1   Fundamental Needs  . . . . . . . . . . . . . . . . . . . . .  4
      -   2.2   Protocol Requirements  . . . . . . . . . . . . . . . . . . .  5
      -   3.    Solutions  . . . . . . . . . . . . . . . . . . . . . . . . .  7
      -   3.1   Examples . . . . . . . . . . . . . . . . . . . . . . . . . .  7
      -   3.2   Systems  . . . . . . . . . . . . . . . . . . . . . . . . . .  8
      -   3.2.1 Standalone Single-user System  . . . . . . . . . . . . . . .  8
      -   3.2.2 Single-user Systems Communicating  . . . . . . . . . . . . .  8
      -   3.2.3 Single-user with Multiple CUAs . . . . . . . . . . . . . . .  9
      -   3.2.4 Single-user with Multiple Calendars  . . . . . . . . . . . .  9
      -
      -   3.2.5 Users Communicating on a Multi-user System . . . . . . . . . 10
      -   3.2.6 Users Communicating through Different Multi-user Systems . . 10
      -   4.    Important Aspects  . . . . . . . . . . . . . . . . . . . . . 10
      -   4.1   Timezones  . . . . . . . . . . . . . . . . . . . . . . . . . 10
      -   4.2   Choice of Transport  . . . . . . . . . . . . . . . . . . . . 11
      -   4.3   Security . . . . . . . . . . . . . . . . . . . . . . . . . . 11
      -   4.4   Amount of data . . . . . . . . . . . . . . . . . . . . . . . 11
      -   4.5   Recurring Components . . . . . . . . . . . . . . . . . . . . 11
      -   5.    Open Issues  . . . . . . . . . . . . . . . . . . . . . . . . 11
      -   5.1   Scheduling People, not Calendars . . . . . . . . . . . . . . 12
      -   5.2   Administration . . . . . . . . . . . . . . . . . . . . . . . 12
      -   5.3   Notification . . . . . . . . . . . . . . . . . . . . . . . . 12
      -   6.    Security Considerations  . . . . . . . . . . . . . . . . . . 12
      -   6.1   Access Control . . . . . . . . . . . . . . . . . . . . . . . 12
      -   6.2   Authentication . . . . . . . . . . . . . . . . . . . . . . . 12
      -   6.3   Using E-mail . . . . . . . . . . . . . . . . . . . . . . . . 13
      -   6.4   Other Issues . . . . . . . . . . . . . . . . . . . . . . . . 13
      -         Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . 13
      -         References . . . . . . . . . . . . . . . . . . . . . . . . . 14
      -         Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 15
      -         Full Copyright Statement . . . . . . . . . . . . . . . . . . 16
      -
      -1. Introduction
      -
      -   Calendaring and scheduling protocols are intended to aid individuals
      -   in obtaining calendaring information and scheduling meetings across
      -   the Internet, to aid organizations in providing calendaring
      -   information on the Internet, and to provide for organizations looking
      -   for a calendaring and scheduling solution to deploy internally.
      -
      -   It is the intent of this document to provide a context for these
      -   documents, assist in their understanding, and potentially help in the
      -   design of standards-based calendaring and scheduling systems.
      -
      -   Problems not solved by these protocols, as well as security issues to
      -   be kept in mind, are discussed at the end of the document.
      -
      -1.1 Terminology
      -
      -   This memo uses much of the same terminology as iCalendar [RFC-2445],
      -   iTIP [RFC-2446], iMIP [RFC-2447], and [CAP].  The following
      -   definitions are provided as an introduction; the definitions in the
      -   protocol specifications themselves should be considered canonical.
      -
      -   Calendar
      -
      -      A collection of events, to-dos, journal entries, etc.  A calendar
      -      could be the content of a person or resource's agenda; it could
      -      also be a collection of data serving a more specialized need.
      -      Calendars are the basic storage containers for calendaring
      -      information.
      -
      -   Calendar Access Rights
      -
      -      A set of rules defining who may perform what operations, such as
      -      reading or writing information, on a given calendar.
      -
      -   Calendar Service
      -
      -      A running server application that provides access to a number of
      -      calendar stores.
      -
      -   Calendar Store (CS)
      -
      -      A data store of a calendar service.  A calendar service may have
      -      several calendar stores, and each store may contain several
      -      calendars, as well as properties and components outside of those
      -      calendars.
      -
      -   Calendar User (CU)
      -
      -      An entity (often a human) that accesses calendar information.
      -
      -   Calendar User Agent (CUA)
      -
      -      Software with which the calendar user communicates with a calendar
      -      service or local calendar store to access calendar information.
      -
      -   Component
      -
      -      A piece of calendar data such as an event, a to-do or an alarm.
      -      Information about components is stored as properties of those
      -      components.
      -
      -   Delegator
      -
      -      A calendar user who has assigned his or her participation in a
      -      scheduled calendar component (e.g.  a VEVENT) to another calendar
      -      user (sometimes called the delegate or delegatee).  An example of
      -      a delegator is a busy executive sending an employee to a meeting
      -      in his or her place.
      -
      -   Delegate
      -
      -      A calendar user (sometimes called the delegatee) who has been
      -      assigned to participate in a scheduled calendar component (e.g. a
      -      VEVENT) in place of one of the attendees in that component
      -      (sometimes called the delegator).  An example of a delegate is a
      -      team member sent to a particular meeting.
      -
      -   Designate
      -
      -      A calendar user authorized to act on behalf of another calendar
      -      user.  An example of a designate is an assistant scheduling
      -      meetings for his or her superior.
      -
      -   Local Store
      -
      -      A CS that is on the same device as the CUA.
      -
      -   Property
      -
      -      A description of some element of a component, such as a start
      -      time, title or location.
      -
      -   Remote Store
      -
      -      A CS that is not on the same device as the CUA.
      -
      -1.2 Concepts and Relationships
      -
      -   iCalendar is the language used to describe calendar objects.  iTIP
      -   describes a way to use the iCalendar language to do scheduling.  iMIP
      -   describes how to do iTIP scheduling via e-mail.  CAP describes a way
      -   to use the iCalendar language to access a calendar store in real-
      -   time.
      -
      -   The relationship between calendaring protocols is similar to that
      -   between e-mail protocols.  In those terms, iCalendar is analogous to
      -   RFC 2822, iTIP and iMIP are analogous to the Simple Mail Transfer
      -   Protocol (SMTP), and CAP is analogous to the Post Office Protocol
      -   (POP) or Internet Message Access Protocol (IMAP).
      -
      -2. Requirements
      -
      -2.1 Fundamental Needs
      -
      -   The following scenarios illustrate people and organizations' basic
      -   calendaring and scheduling needs:
      -
      -      a] A doctor wishes to keep track of all her appointments.
      -
      -      Need: To read and manipulate one's own calendar with only one CUA.
      -
      -      b] A busy musician wants to maintain her schedule with multiple
      -      devices, such as through an Internet-based agenda and with a PDA.
      -
      -      Need: To read and manipulate one's own calendar, possibly with
      -      solutions from different vendors.
      -
      -      c] A software development team wishes to more effectively schedule
      -      their time through viewing each other's calendar information.
      -
      -      Need: To share calendar information between users of the same
      -      calendar service.
      -
      -      d] A teacher wants his students to schedule appointments during
      -      his office hours.
      -
      -      Need: To schedule calendar events, to-dos and journals with other
      -      users of the same calendar service.
      -
      -      e] A movie theater wants to publish its schedule for prospective
      -      customers.
      -
      -      Need: To share calendar information with users of other calendar
      -      services, possibly from a number of different vendors.
      -
      -      f] A social club wants to schedule calendar entries effectively
      -      with its members.
      -
      -      Need: To schedule calendar events and to-dos with users of other
      -      calendar services, possibly from a number of different vendors.
      -
      -2.2 Protocol Requirements
      -
      -   Some of these needs can be met by proprietary solutions (a, c, d),
      -   but others can not (b, e, f).  These latter scenarios show that
      -   standard protocols are required for accessing information in a
      -   calendar store and scheduling calendar entries.  In addition, these
      -   protocols require a common data format for representing calendar
      -   information.
      -
      -   These requirements are met by the following protocol specifications.
      -
      -      - Data format: iCalendar [RFC-2445]
      -
      -      iCalendar [RFC-2445] provides a data format for representing
      -      calendar information, to be used and exchanged by other protocols.
      -      iCalendar [RFC-2445] can also be used in other contexts, such as a
      -      drag-and-drop interface, or an export/import feature.  All the
      -      other calendaring protocols depend on iCalendar [RFC-2445], so all
      -      elements of a standards-based calendaring and scheduling systems
      -      will have to be able to interpret iCalendar [RFC-2445].
      -
      -      - Scheduling protocol: iTIP [RFC-2446]
      -
      -      iTIP [RFC-2446] describes the messages used to schedule calendar
      -      events.  Within iTIP messages, events are represented in iCalendar
      -      [RFC-2445] format, and have semantics that identify the message as
      -      being an invitation to a meeting, an acceptance of an invitation,
      -      or the assignment of a task.
      -
      -      iTIP [RFC-2446] messages are used in the scheduling workflow,
      -      where users exchange messages in order to organize things such as
      -      events and to-dos.  CUAs generate and interpret iTIP [RFC-2446]
      -      messages at the direction of the calendar user.  With iTIP [RFC-
      -      2446] users can create, modify, delete, reply to, counter, and
      -      decline counters to the various iCalendar [RFC-2445] components.
      -      Furthermore, users can also request the free/busy time of other
      -      people.
      -
      -      iTIP [RFC-2446] is transport-independent, and has one specified
      -      transport binding: iMIP [RFC-2447] binds iTIP to e-mail.  In
      -      addition [CAP] will provide a real-time binding of iTIP [RFC-
      -      2446], allowing CUAs to perform calendar management and scheduling
      -      over a single connection.
      -
      -      - Calendar management protocol: [CAP]
      -
      -      [CAP] describes the messages used to manage calendars on a
      -      calendar store.  These messages use iCalendar [RFC-2445] to
      -      describe various components such as events and to-dos.  These
      -      messages make it possible to perform iTIP [RFC-2446] operations,
      -      as well as other operations relating to a calendar store such as
      -      searching, creating calendars, specifying calendar properties, and
      -      specifying calendar access rights.
      -
      -3. Solutions
      -
      -3.1 Examples
      -
      -   Returning to the scenarios presented in section 2.1, the calendaring
      -   protocols can be used in the following ways:
      -
      -      a] The doctor can use a proprietary CUA with a local store, and
      -      perhaps use iCalendar [RFC-2445] as a storage mechanism.  This
      -      would allow her to easily import her data store into another
      -      application that supports iCalendar [RFC-2445].
      -
      -      b] The musician who wishes to access her agenda from anywhere can
      -      use a [CAP]-enabled calendar service accessible over the Internet.
      -      She can then use any available [CAP] clients to access the data.
      -
      -      A proprietary system that provides access through a Web-based
      -      interface could also be employed, but the use of [CAP] would be
      -      superior in that it would allow the use of third party
      -      applications, such as PDA synchronization tools.
      -
      -      c] The development team can use a calendar service which supports
      -      [CAP], and each member can use a [CAP]-enabled CUA of their
      -      choice.
      -
      -      Alternatively, each member could use an iMIP [RFC-2447]-enabled
      -      CUA, and they could book meetings over e-mail.  This solution has
      -      the drawback that it is difficult to examine other users' agendas,
      -      making the organization of meetings more difficult.
      -
      -      Proprietary solutions are also available, but they require that
      -      all members use clients by the same vendor, and disallow the use
      -      of third party applications.
      -
      -      d] The teacher can set up a calendar service, and have students
      -      book time through any of the iTIP [RFC-2446] bindings.  [CAP]
      -      provides real-time access, but could require additional
      -      configuration.  iMIP [RFC-2447] would be the easiest to configure,
      -      but may require more e-mail processing.
      -
      -      If [CAP] access is provided then determining the state of the
      -      teacher's schedule is straightforward.  If not, this can be
      -      determined through iTIP [RFC-2446] free/busy requests.  Non-
      -      standard methods could also be employed, such as serving up
      -      iCalendar [RFC-2445], HTML, or XML over HTTP.
      -
      -      A proprietary system could also be used, but would require that
      -      all students be able to use software from a specific vendor.
      -
      -      e] [CAP] would be preferred for publishing a movie theater's
      -      schedule, since it provides advanced access and search
      -      capabilities.  It also allows easy integration with customers'
      -      calendar systems.
      -
      -      Non-standard methods such as serving data over HTTP could also be
      -      employed, but would be harder to integrate with customers'
      -      systems.
      -
      -      Using a completely proprietary solution would be very difficult,
      -      if not impossible, since it would require every user to install
      -      and use the proprietary software.
      -
      -      f] The social club could distribute meeting information in the
      -      form of iTIP [RFC-2446] messages, sent via e-mail using iMIP
      -      [RFC-2447].  The club could distribute meeting invitations, as
      -      well as a full published agenda.
      -
      -      Alternatively, the club could provide access to a [CAP]-enabled
      -      calendar service.  However, this solution would be more expensive
      -      since it requires the maintenance of a server.
      -
      -3.2 Systems
      -
      -   The following diagrams illustrate possible systems and their usage of
      -   the various protocols.
      -
      -3.2.1 Standalone Single-user System
      -
      -   A single user system that does not communicate with other systems
      -   need not employ any of the protocols.  However, it may use iCalendar
      -   [RFC-2445] as a data format in some places.
      -
      -          -----------       O
      -         | CUA w/    |     -+- user
      -         |local store|      A
      -          -----------      / \
      -
      -3.2.2 Single-user Systems Communicating
      -
      -   Users with single-user systems may schedule meetings with each others
      -   using iTIP [RFC-2446].  The easiest binding of iTIP [RFC-2446] to use
      -   would be iMIP [RFC-2447], since messages can be held in the users'
      -   mail queues, which we assume to already exist.  [CAP] could also be
      -   used.
      -
      -          O   -----------                    -----------   O
      -         -+- | CUA w/    | -----[iMIP]----- | CUA w/    | -+- user
      -          A  |local store|     Internet     |local store|  A
      -         / \  -----------                    -----------  / \
      -
      -3.2.3 Single-user with Multiple CUAs
      -
      -   A single user may use more than one CUA to access his or her
      -   calendar.  The user may use a PDA, a Web client, a PC, or some other
      -   device, depending on accessibility.  Some of these clients may have
      -   local stores and others may not.  Those with local stores need to
      -   synchronize the data on the CUA with the data on the CS.
      -
      -                -----------
      -               |   CUA w   | -----[CAP]----------+
      -               |local store|                     |
      -          O     -----------                    ----------
      -         -+-                                  |   CS     |
      -          A                                   |          |
      -         / \                                   ----------
      -                -----------                      |
      -               |  CUA w/o  | -----[CAP]----------+
      -               |local store|
      -                -----------
      -
      -3.2.4 Single-user with Multiple Calendars
      -
      -   A single user may have many independent calendars; for example, one
      -   may contain work-related information and another personal
      -   information.  The CUA may or may not have a local store.  If it does,
      -   then it needs to synchronize the data of the CUA with the data on
      -   both of the CS.
      -
      -                                               ----------
      -                     +------------[CAP]------ |   CS     |
      -                     |                        |          |
      -          O     -----------                    ----------
      -         -+-   |  CUA      |
      -          A    |           |
      -         / \    -----------
      -                     |                         ----------
      -                     +------------[CAP]------ |   CS     |
      -                                              |          |
      -                                               ----------
      -
      -3.2.5 Users Communicating on a Multi-user System
      -
      -   Users on a multi-user system may schedule meetings with each other
      -   using [CAP]-enabled CUAs and services.  The CUAs may or may not have
      -   local stores.  Those with local stores need to synchronize the data
      -   on the CUAs with the data on the CS.
      -
      -          O     -----------
      -         -+-   |   CUA w   | -----[CAP]----------+
      -          A    |local store|                     |
      -         / \    -----------                    ----------
      -                                              |   CS     |
      -                                              |          |
      -                                               ----------
      -          O     -----------                      |
      -         -+-   |  CUA w/o  | -----[CAP]----------+
      -          A    |local store|
      -         / \    -----------
      -
      -3.2.6 Users Communicating through Different Multi-user Systems
      -
      -   Users on a multi-user system may need to schedule meetings with users
      -   on a different multi-user system.  The services can communicate using
      -   [CAP] or iMIP [RFC-2447].
      -
      -          O     -----------                    ----------
      -         -+-   |   CUA w   | -----[CAP]-------|   CS     |
      -          A    |local store|                  |          |
      -         / \    -----------                    ----------
      -                                                   |
      -                                             [CAP] or [iMIP]
      -                                                   |
      -          O     -----------                    ----------
      -         -+-   |  CUA w/o  | -----[CAP]-------|   CS     |
      -          A    |local store|                  |          |
      -         / \    -----------                    ----------
      -
      -4. Important Aspects
      -
      -   There are a number of important aspects of these calendaring
      -   standards of which people, especially implementers, should be aware.
      -
      -4.1 Timezones
      -
      -   The dates and times in components can refer to a specific time zone.
      -   Time zones can be defined in a central store, or they may be defined
      -   by a user to fit his or her needs.  All users and applications should
      -   be aware of time zones and time zone differences.  New time zones may
      -
      -   need to be added, and others removed.  Two different vendors may
      -   describe the same time zone differently (such as by using a different
      -   name).
      -
      -4.2 Choice of Transport
      -
      -   There are issues to be aware of in choosing between a network
      -   protocol such as [CAP], or a store and forward protocol, such as iMIP
      -   [RFC-2447].
      -
      -   The use of a network ("on-the-wire") mechanism may require some
      -   organizations to make provisions to allow calendaring traffic to
      -   traverse a corporate firewall on the required ports.  Depending on
      -   the organizational culture, this may be a challenging social
      -   exercise.
      -
      -   The use of an email-based mechanism exposes time-sensitive data to
      -   unbounded latency.  Large or heavily utilized mail systems may
      -   experience an unacceptable delay in message receipt.
      -
      -4.3 Security
      -
      -   See the "Security Considerations" (Section 6) section below.
      -
      -4.4 Amount of data
      -
      -   In some cases, a component may be very large, for instance, a
      -   component with a very large attachment.  Some applications may be
      -   low-bandwidth or may be limited in the amount of data they can store.
      -   Maximum component size may be set in [CAP].  It can also be
      -   controlled in iMIP [RFC-2447] by restricting the maximum size of the
      -   e-mail that the application can download.
      -
      -4.5 Recurring Components
      -
      -   In iCAL [RFC-2445], one can specify complex recurrence rules for
      -   VEVENTs, VTODOs, and VJOURNALs.  One must be careful to correctly
      -   interpret these recurrence rules and pay extra attention to being
      -   able to interoperate using them.
      -
      -5. Open Issues
      -
      -   Many issues are not currently resolved by these protocols, and many
      -   desirable features are not yet provided.  Some of the more prominent
      -   ones are outlined below.
      -
      -5.1 Scheduling People, not Calendars
      -
      -   Meetings are scheduled with people; however, people may have many
      -   calendars, and may store these calendars in many places.  There may
      -   also be many routes to contact them.  The calendaring protocols do
      -   not attempt to provide unique access for contacting a given person.
      -   Instead, 'calendar addresses' are booked, which may be e-mail
      -   addresses or individual calendars.  It is up to the users themselves
      -   to orchestrate mechanisms to ensure that the bookings go to the right
      -   place.
      -
      -5.2 Administration
      -
      -   The calendaring protocols do not address the issues of administering
      -   users and calendars on a calendar service.  This must be handled by
      -   proprietary mechanisms for each implementation.
      -
      -5.3 Notification
      -
      -   People often wish to be notified of upcoming events, new events, or
      -   changes to existing events.  The calendaring protocols do not attempt
      -   to address these needs in a real-time system.  Instead, the ability
      -   to store alarm information on events is provided, which can be used
      -   to provide client-side notification of upcoming events.  To organize
      -   notification of new or changed events, clients have to poll the data
      -   store.
      -
      -6. Security Considerations
      -
      -6.1 Access Control
      -
      -   There has to be reasonable granularity in the configuration options
      -   for access to data through [CAP], so that what should be released to
      -   requesters is released, and what shouldn't is not.  Details of
      -   handling this are described in [CAP].
      -
      -6.2 Authentication
      -
      -   Access control must be coupled with a good authentication system, so
      -   that the right people get the right information.  For [CAP], this
      -   means requiring authentication before any database access can be
      -   performed, and checking access rights and authentication credentials
      -   before releasing information.  [CAP] uses the Simple Authentication
      -   Security Layer (SASL) for this authentication.  In iMIP [RFC-2447],
      -   this may present some challenges, as authentication is often not a
      -   consideration in store-and-forward protocols.
      -
      -   Authentication is also important for scheduling, in that receivers of
      -   scheduling messages should be able to validate the apparent sender.
      -   Since scheduling messages are wrapped in MIME [RFC-2045], signing and
      -   encryption are freely available.  For messages transmitted over mail,
      -   this is the only available alternative.  It is suggested that
      -   developers take care in implementing the security features in iMIP
      -   [RFC-2447], bearing in mind that the concept and need may be foreign
      -   or non-obvious to users, yet essential for the system to function as
      -   they might expect.
      -
      -   The real-time protocols provide for the authentication of users, and
      -   the preservation of that authentication information, allowing for
      -   validation by the receiving end-user or server.
      -
      -6.3 Using E-mail
      -
      -   Because scheduling information can be transmitted over mail without
      -   any authentication information, e-mail spoofing is extremely easy if
      -   the receiver is not checking for authentication.  It is suggested
      -   that implementers consider requiring authentication as a default,
      -   using mechanisms such as are described in Section 3 of iMIP [RFC-
      -   2447].  The use of e-mail, and the potential for anonymous
      -   connections, means that 'calendar spam' is possible.  Developers
      -   should consider this threat when designing systems, particularly
      -   those that allow for automated request processing.
      -
      -6.4 Other Issues
      -
      -   The current security context should be obvious to users.  Because the
      -   underlying mechanisms may not be clear to users, efforts to make
      -   clear the current state in the UI should be made.  One example of
      -   this is the 'lock' icon used in some Web browsers during secure
      -   connections.
      -
      -   With both iMIP [RFC-2447] and [CAP], the possibilities of Denial of
      -   Service attacks must be considered.  The ability to flood a calendar
      -   system with bogus requests is likely to be exploited once these
      -   systems become widely deployed, and detection and recovery methods
      -   will need to be considered.
      -
      -Acknowledgments
      -
      -   Thanks to the following, who have participated in the development of
      -   this document:
      -
      -      Eric Busboom, Pat Egen, David Madeo, Shawn Packwood, Bruce Kahn,
      -      Alan Davies, Robb Surridge.
      -
      -References
      -
      -   [RFC-2445] Dawson, F. and D. Stenerson, "Internet Calendaring and
      -              Scheduling Core Object Specification - iCalendar", RFC
      -              2445, November 1998.
      -
      -   [RFC-2446] Silverberg, S., Mansour, S., Dawson, F. and R. Hopson,
      -              "iCalendar Transport-Independent Interoperability Protocol
      -              (iTIP):  Scheduling Events, Busy Time, To-dos and Journal
      -              Entries", RFC 2446, November 1998.
      -
      -   [RFC-2447] Dawson, F., Mansour, S. and S. Silverberg, "iCalendar
      -              Message-Based Interoperability Protocol - iMIP", RFC 2447,
      -              November 1998.
      -
      -   [RFC-2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
      -              Extensions (MIME) - Part One: Format of Internet Message
      -              Bodies", RFC 2045, November 1996.
      -
      -   [CAP]      Mansour, S., Royer, D., Babics, G., and Hill, P.,
      -              "Calendar Access Protocol (CAP)", Work in Progress.
      -
      -Authors' Addresses
      -
      -   Bob Mahoney
      -   MIT
      -   E40-327
      -   77 Massachusetts Avenue
      -   Cambridge, MA  02139
      -   US
      -
      -   Phone: (617) 253-0774
      -   EMail: bobmah@mit.edu
      -
      -   George Babics
      -   Steltor
      -   2000 Peel Street
      -   Montreal, Quebec  H3A 2W5
      -   CA
      -
      -   Phone: (514) 733-8500 x4201
      -   EMail: georgeb@steltor.com
      -
      -   Alexander Taler
      -
      -   EMail: alex@0--0.org
      -
      -Full Copyright Statement
      -
      -   Copyright (C) The Internet Society (2002).  All Rights Reserved.
      -
      -   This document and translations of it may be copied and furnished to
      -   others, and derivative works that comment on or otherwise explain it
      -   or assist in its implementation may be prepared, copied, published
      -   and distributed, in whole or in part, without restriction of any
      -   kind, provided that the above copyright notice and this paragraph are
      -   included on all such copies and derivative works.  However, this
      -   document itself may not be modified in any way, such as by removing
      -   the copyright notice or references to the Internet Society or other
      -   Internet organizations, except as needed for the purpose of
      -   developing Internet standards in which case the procedures for
      -   copyrights defined in the Internet Standards process must be
      -   followed, or as required to translate it into languages other than
      -   English.
      -
      -   The limited permissions granted above are perpetual and will not be
      -   revoked by the Internet Society or its successors or assigns.
      -
      -   This document and the information contained herein is provided on an
      -   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
      -   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
      -   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
      -   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
      -   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
      -
      -Acknowledgement
      -
      -   Funding for the RFC Editor function is currently provided by the
      -   Internet Society.
      -
      -
      -


      -

       

      -
      - -
      -

      - -

      -
      - - - - diff --git a/vendor/gems/icalendar-1.0.2/examples/create_cal.rb b/vendor/gems/icalendar-1.0.2/examples/create_cal.rb deleted file mode 100644 index b51d852..0000000 --- a/vendor/gems/icalendar-1.0.2/examples/create_cal.rb +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env ruby -## Need this so we can require the library from the samples directory -$:.unshift(File.dirname(__FILE__) + '/../lib') - -require 'rubygems' # Unless you install from the tarball or zip. -require 'icalendar' -require 'date' - -include Icalendar # Probably do this in your class to limit namespace overlap - -## Creating calendars and events is easy. - -# Create a calendar with an event (standard method) -cal = Calendar.new -cal.event do - dtstart Date.new(2005, 04, 29) - dtend Date.new(2005, 04, 28) - summary "Meeting with the man." - description "Have a long lunch meeting and decide nothing..." - klass "PRIVATE" -end - -## Or you can make events like this -event = Event.new -event.start = DateTime.civil(2006, 6, 23, 8, 30) -event.summary = "A great event!" -cal.add_event(event) - -event2 = cal.event # This automatically adds the event to the calendar -event2.start = DateTime.civil(2006, 6, 24, 8, 30) -event2.summary = "Another great event!" - -# Now with support for property parameters -params = {"ALTREP" =>['"http://my.language.net"'], "LANGUAGE" => ["SPANISH"]} - -cal.event do - dtstart Date.new(2005, 04, 29) - dtend Date.new(2005, 04, 28) - summary "This is a summary with params.", params -end - -# We can output the calendar as a string to write to a file, -# network port, database etc. -cal_string = cal.to_ical -puts cal_string diff --git a/vendor/gems/icalendar-1.0.2/examples/parse_cal.rb b/vendor/gems/icalendar-1.0.2/examples/parse_cal.rb deleted file mode 100644 index 91c6e21..0000000 --- a/vendor/gems/icalendar-1.0.2/examples/parse_cal.rb +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env ruby -## Need this so we can require the library from the samples directory -$:.unshift(File.dirname(__FILE__) + '/../lib') - -require 'icalendar' -require 'date' - -# Open a file or string to parse -cal_file = File.open("../test/life.ics") - -# Parser returns an array of calendars because a single file -# can have multiple calendar objects. -cals = Icalendar::parse(cal_file) -cal = cals.first - -# Now you can access the cal object in just the same way I created it -event = cal.events.first - -puts "start date-time: " + event.dtstart.to_s -puts "summary: " + event.summary diff --git a/vendor/gems/icalendar-1.0.2/examples/single_event.ics b/vendor/gems/icalendar-1.0.2/examples/single_event.ics deleted file mode 100644 index 2f039aa..0000000 --- a/vendor/gems/icalendar-1.0.2/examples/single_event.ics +++ /dev/null @@ -1,18 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:bsprodidfortestabc123 -BEGIN:VEVENT -UID:bsuidfortestabc123 -SUMMARY:This is a really long summary - to test the method of unfolding lines - so I'm just going to ma - ke it - a whol - e - bunch of lines. -CLASS:PRIVATE -DTSTART;TZID=US-Mountain:20050120T170000 -DTEND:20050120T184500 -DTSTAMP:20050118T211523Z -END:VEVENT -END:VCALENDAR diff --git a/vendor/gems/icalendar-1.0.2/init.rb b/vendor/gems/icalendar-1.0.2/init.rb deleted file mode 100644 index 04c96ab..0000000 --- a/vendor/gems/icalendar-1.0.2/init.rb +++ /dev/null @@ -1,3 +0,0 @@ - - require File.join(File.dirname(__FILE__), 'lib', 'icalendar') - diff --git a/vendor/gems/icalendar-1.0.2/lib/hash_attrs.rb b/vendor/gems/icalendar-1.0.2/lib/hash_attrs.rb deleted file mode 100644 index 3ce71b7..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/hash_attrs.rb +++ /dev/null @@ -1,34 +0,0 @@ -# A module which adds some generators for hash based accessors. -module HashAttrs - - def hash_reader(hash_sym, syms) - syms.each do |id| - id = id.to_s.downcase - func = Proc.new do - hash = instance_variable_get(hash_sym) - hash[id.to_sym] - end - - self.send(:define_method, id, func) - end - end - - def hash_writer(hash_sym, syms) - syms.each do |id| - id = id.to_s.downcase - - func = Proc.new do |val| - hash = instance_variable_get(hash_sym) - hash[id.to_sym] = val - end - - self.send(:define_method, id+'=', func) - end - end - - def hash_accessor(hash, *syms) - hash_reader(hash, syms) - hash_writer(hash, syms) - end -end - diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar.rb deleted file mode 100644 index 7711ce8..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar.rb +++ /dev/null @@ -1,36 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -$:.unshift(File.dirname(__FILE__)) - -### Base classes and mixin modules - -# to_ical methods for built-in classes -require 'icalendar/conversions' - -# Meta-programming helper methods -require 'meta' - -# Hash attributes mixin module -require 'hash_attrs' - -require 'icalendar/base' -require 'icalendar/component' - -# Calendar and components -require 'icalendar/calendar' -require 'icalendar/component/event' -require 'icalendar/component/journal' -require 'icalendar/component/todo' -require 'icalendar/component/freebusy' -require 'icalendar/component/timezone' -require 'icalendar/component/alarm' - -# Calendar parser -require 'icalendar/parser' - diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/base.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/base.rb deleted file mode 100644 index f10bb81..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/base.rb +++ /dev/null @@ -1,43 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end -require 'logger' - -module Icalendar #:nodoc: - - # A simple error class to differentiate iCalendar library exceptions - # from ruby language exceptions or others. - class IcalendarError < StandardError #:nodoc: - end - - # Exception used when the library encounters a bogus calendar component. - class UnknownComponentClass < IcalendarError - end - - # Exception used when the library encounters a bogus property type. - class UnknownPropertyMethod< IcalendarError - end - - # Exception used when the library encounters a bogus property value. - class InvalidPropertyValue < IcalendarError - end - - # This class serves as the base class for just about everything in - # the library so that the logging system can be configured in one place. - class Base - @@logger = Logger.new(STDERR) - @@logger.level = Logger::FATAL - - def self.debug - @@logger.level = Logger::DEBUG - end - - def self.quiet - @@logger.level = Logger::FATAL - end - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/calendar.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/calendar.rb deleted file mode 100644 index a4e4c5b..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/calendar.rb +++ /dev/null @@ -1,104 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -module Icalendar - - class Calendar < Component - ical_component :events, :todos, :journals, :freebusys, :timezones - - ical_property :calscale, :calendar_scale - ical_property :prodid, :product_id - ical_property :version - ical_property :ip_method - - def initialize() - super("VCALENDAR") - - # Set some defaults - self.calscale = "GREGORIAN" # Who knows, but this is the only one in the spec. - self.prodid = "iCalendar-Ruby" # Current product... Should be overwritten by apps that use the library - self.version = "2.0" # Version of the specification - end - - def event(&block) - e = Event.new - self.add_component e - - e.instance_eval &block if block - - e - end - - def find_event(uid) - self.events.find {|e| e.uid == uid} - end - - def todo(&block) - e = Todo.new - self.add_component e - - e.instance_eval &block if block - - e - end - - def find_todo(uid) - self.todos.find {|t| t.uid == uid} - end - - def journal(&block) - e = Journal.new - self.add_component e - - e.instance_eval &block if block - - e - end - - def find_journal(uid) - self.journals.find {|j| j.uid == uid} - end - - def freebusy(&block) - e = Freebusy.new - self.add_component e - - e.instance_eval &block if block - - e - end - - def find_freebusy(uid) - self.freebusys.find {|f| f.uid == uid} - end - - def timezone(&block) - e = Timezone.new - self.add_component e - - e.instance_eval &block if block - - e - end - - # The "PUBLISH" method in a "VEVENT" calendar component is an - # unsolicited posting of an iCalendar object. Any CU may add published - # components to their calendar. The "Organizer" MUST be present in a - # published iCalendar component. "Attendees" MUST NOT be present. Its - # expected usage is for encapsulating an arbitrary event as an - # iCalendar object. The "Organizer" may subsequently update (with - # another "PUBLISH" method), add instances to (with an "ADD" method), - # or cancel (with a "CANCEL" method) a previously published "VEVENT" - # calendar component. - def publish - self.ip_method = "PUBLISH" - end - - end # class Calendar - -end # module Icalendar diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component.rb deleted file mode 100644 index a2d7bc3..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component.rb +++ /dev/null @@ -1,438 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -module Icalendar - require 'socket' - - MAX_LINE_LENGTH = 75 - - class Geo < Icalendar::Base - attr_accessor :latitude, :longitude - alias :lat :latitude - alias :long :longitude - - def initialize(lat, long) - @lat = lat - @long = long - end - - def to_ical - "#{@lat.to_ical};#{@long.to_ical}" - end - end - - # The body of the iCalendar object consists of a sequence of calendar - # properties and one or more calendar components. The calendar - # properties are attributes that apply to the calendar as a whole. The - # calendar components are collections of properties that express a - # particular calendar semantic. For example, the calendar component can - # specify an Event, a Todo, a Journal entry, Timezone information, or - # Freebusy time information, or an Alarm. - class Component < Icalendar::Base - - meta_include HashAttrs - - attr_reader :name - attr_accessor :properties - - @@multi_properties = {} - @@multiline_properties = {} - - def initialize(name) - @name = name - @components = Hash.new([]) - @properties = {} - - @@logger.info("New #{@name[1,@name.size].capitalize}...") - end - - # Add a sub-component to the current component object. - def add_component(component) - key = (component.class.to_s.downcase + 's').gsub('icalendar::', '').to_sym - - unless @components.has_key? key - @components[key] = [] - end - - @components[key] << component - end - - # Add a component to the calendar. - alias add add_component - - # Add an event to the calendar. - alias add_event add_component - - # Add a todo item to the calendar. - alias add_todo add_component - - # Add a journal item to the calendar. - alias add_journal add_component - - def remove_component(component) - key = (component.class.to_s.downcase + 's').gsub('icalendar::', '').to_sym - - if @components.has_key? key - @components[key].delete(component) - end - end - - # Remove a component from the calendar. - alias remove remove_component - - # Remove an event from the calendar. - alias remove_event remove_component - - # Remove a todo item from the calendar. - alias remove_todo remove_component - - # Remove a journal item from the calendar. - alias remove_journal remove_component - - # Used to generate unique component ids - def new_uid - "#{DateTime.now}_#{rand(999999999)}@#{Socket.gethostname}" - end - - # Output in the icalendar format - def to_ical - print_component do - s = "" - @components.each_value do |comps| - comps.each { |component| s << component.to_ical } - end - s - end - end - - # Print this icalendar component - def print_component - # Begin a new component - "BEGIN:#{@name.upcase}\r\n" + - - # Then the properties - print_properties + - - # sub components - yield + - - # End of this component - "END:#{@name.upcase}\r\n" - end - - # Print this components properties - def print_properties - s = "" - - @properties.each do |key,val| - # Take out underscore for property names that conflicted - # with built-in words. - if key =~ /ip_.*/ - key = key[3..-1] - end - - # Property name - unless multiline_property?(key) - prelude = "#{key.gsub(/_/, '-').upcase}" + - - # Possible parameters - print_parameters(val) - - # Property value - value = ":#{val.to_ical}" - escaped = prelude + value.gsub("\\", "\\\\").gsub("\n", "\\n").gsub(",", "\\,").gsub(";", "\\;") - s << escaped.slice!(0, MAX_LINE_LENGTH) << "\r\n " while escaped.size > MAX_LINE_LENGTH - s << escaped << "\r\n" - s.gsub!(/ *$/, '') - else - prelude = "#{key.gsub(/_/, '-').upcase}" - val.each do |v| - params = print_parameters(v) - value = ":#{v.to_ical}" - escaped = prelude + params + value.gsub("\\", "\\\\").gsub("\n", "\\n").gsub(",", "\\,").gsub(";", "\\;") - s << escaped.slice!(0, MAX_LINE_LENGTH) << "\r\n " while escaped.size > MAX_LINE_LENGTH - s << escaped << "\r\n" - s.gsub!(/ *$/, '') - end - end - end - s - end - - # Print the parameters for a specific property - def print_parameters(val) - s = "" - return s unless val.respond_to?(:ical_params) and not val.ical_params.nil? - - val.ical_params.each do |key,val| - s << ";#{key}" - val = [ val ] unless val.is_a?(Array) - - # Possible parameter values - unless val.empty? - s << "=" - sep = "" # First entry comes after = sign, but then we need commas - val.each do |pval| - if pval.respond_to? :to_ical - s << sep << pval.to_ical - sep = "," - end - end - end - end - s - end - - # TODO: Look into the x-property, x-param stuff... - # This would really only be needed for subclassing to add additional - # properties to an application using the API. - def custom_property(name, value) - @properties[name] = value - end - - def multi_property?(name) - @@multi_properties.has_key?(name.downcase) - end - - def multiline_property?(name) - @@multiline_properties.has_key?(name.downcase) - end - - # Make it protected so we can monitor usage... - protected - - def Component.ical_component(*syms) - hash_accessor :@components, *syms - end - - # Define a set of methods supporting a new property - def Component.ical_property(property, alias_name = nil, prop_name = nil) - property = "#{property}".strip.downcase - alias_name = "#{alias_name}".strip.downcase unless alias_name.nil? - # If a prop_name was given then we use that for the actual storage - property = "#{prop_name}".strip.downcase unless prop_name.nil? - - generate_getter(property, alias_name) - generate_setter(property, alias_name) - generate_query(property, alias_name) - end - - # Define a set of methods defining a new property, which - # supports multiple values for the same property name. - def Component.ical_multi_property(property, singular, plural) - property = "#{property}".strip.downcase.gsub(/-/, '_') - plural = "#{plural}".strip.downcase - - # Set this key so the parser knows to use an array for - # storing this property type. - @@multi_properties["#{property}"] = true - - generate_multi_getter(property, plural) - generate_multi_setter(property, plural) - generate_multi_query(property, plural) - generate_multi_adder(property, singular) - generate_multi_remover(property, singular) - end - - # Define a set of methods defining a new property, which - # supports multiple values in multiple lines with same property name - def Component.ical_multiline_property(property, singular, plural) - @@multiline_properties["#{property}"] = true - ical_multi_property(property, singular, plural) - end - - - private - - def Component.generate_getter(property, alias_name) - unless instance_methods.include? property - code = <<-code - def #{property}(val = nil, params = nil) - return @properties["#{property}"] if val.nil? - - unless val.respond_to?(:to_ical) - raise(NotImplementedError, "Value of type (" + val.class.to_s + ") does not support to_ical method!") - end - - unless params.nil? - # Extend with the parameter methods only if we have to... - unless val.respond_to?(:ical_params) - val.class.class_eval { attr_accessor :ical_params } - end - val.ical_params = params - end - - @properties["#{property}"] = val - end - code - - class_eval code, "component.rb", 219 - alias_method("#{alias_name}", "#{property}") unless alias_name.nil? - end - end - - def Component.generate_setter(property, alias_name) - setter = property + '=' - unless instance_methods.include? setter - code = <<-code - def #{setter}(val) - #{property}(val) - end - code - - class_eval code, "component.rb", 233 - alias_method("#{alias_name}=", "#{property+'='}") unless alias_name.nil? - end - end - - def Component.generate_query(property, alias_name) - query = "#{property}?" - unless instance_methods.include? query - code = <<-code - def #{query} - @properties.has_key?("#{property.downcase}") - end - code - - class_eval code, "component.rb", 226 - - alias_method("#{alias_name}\?", "#{query}") unless alias_name.nil? - end - end - - def Component.generate_multi_getter(property, plural) - # Getter for whole array - unless instance_methods.include? plural - code = <<-code - def #{plural}(a = nil) - if a.nil? - @properties["#{property}"] || [] - else - self.#{plural}=(a) - end - end - code - - class_eval code, "component.rb", 186 - end - end - - def Component.generate_multi_setter(property, plural) - # Setter for whole array - unless instance_methods.include? plural+'+' - code = <<-code - def #{plural}=(a) - if a.respond_to?(:to_ary) - a.to_ary.each do |val| - unless val.respond_to?(:to_ical) - raise(NotImplementedError, "Property values do not support to_ical method!") - end - end - - @properties["#{property}"] = a.to_ary - else - raise ArgumentError, "#{plural} is a multi-property that must be an array! Use the add_[property] method to add single entries." - end - end - code - - class_eval code, "component.rb", 198 - end - end - - def Component.generate_multi_query(property, plural) - # Query for any of these properties - unless instance_methods.include? plural+'?' - code = <<-code - def #{plural}? - @properties.has_key?("#{property}") - end - code - - class_eval code, "component.rb", 210 - end - end - - def Component.generate_multi_adder(property, singular) - adder = "add_"+singular.to_s - # Add another item to this properties array - unless instance_methods.include? adder - code = <<-code - def #{adder}(val, params = {}) - unless val.respond_to?(:to_ical) - raise(NotImplementedError, "Property value object does not support to_ical method!") - end - - unless params.nil? - # Extend with the parameter methods only if we have to... - unless val.respond_to?(:ical_params) - val.class.class_eval { attr_accessor :ical_params } - end - val.ical_params = params - end - - if @properties.has_key?("#{property}") - @properties["#{property}"] << val - else - @properties["#{property}"] = [val] - end - end - code - - class_eval code, "component.rb", 289 - alias_method("add_#{property.downcase}", "#{adder}") - end - end - - def Component.generate_multi_remover(property, singular) - # Remove an item from this properties array - unless instance_methods.include? "remove_#{singular}" - code = <<-code - def remove_#{singular}(a) - if @properties.has_key?("#{property}") - @properties["#{property}"].delete(a) - end - end - code - - class_eval code, "component.rb", 303 - alias_method("remove_#{property.downcase}", "remove_#{singular}") - end - end - - def method_missing(method_name, *args) - @@logger.debug("Inside method_missing...") - method_name = method_name.to_s.downcase - - unless method_name =~ /x_.*/ - raise NoMethodError, "Method Name: #{method_name}" - end - - # x-properties are accessed with underscore but stored with a dash so - # they output correctly and we don't have to special case the - # output code, which would require checking every property. - if args.size > 0 # Its a setter - # Pull off the possible equals - @properties[method_name[/x_[^=]*/].gsub('x_', 'x-')] = args.first - else # Or its a getter - return @properties[method_name.gsub('x_', 'x-')] - end - end - - public - - def respond_to?(method_name) - unless method_name.to_s.downcase =~ /x_.*/ - super - end - - true - end - - end # class Component -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/alarm.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component/alarm.rb deleted file mode 100644 index b109fba..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/alarm.rb +++ /dev/null @@ -1,44 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end -module Icalendar - # An Alarm calendar component is a grouping of component - # properties that is a reminder or alarm for an event or a - # to-do. For example, it may be used to define a reminder for a - # pending Event or an overdue Todo. - class Alarm < Component - - # Single properties - ical_property :action - ical_property :description - ical_property :trigger - ical_property :summary - - # Single but must appear together - ical_property :duration - ical_property :repeat - - # Single and only occurring once - - ical_property :created - ical_property :last_modified - ical_property :timestamp - ical_property :sequence - - # Multi properties - ical_multiline_property :attendee, :attendee, :attendees - ical_multi_property :attach, :attachment, :attachments - - def initialize() - super("VALARM") - - # Almost everyone just wants to display so I make it the - # default so it works for most people right away... - action "DISPLAY" - end - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/event.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component/event.rb deleted file mode 100644 index 9af938a..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/event.rb +++ /dev/null @@ -1,123 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -module Icalendar - # A Event calendar component is a grouping of component - # properties, and possibly including Alarm calendar components, that - # represents a scheduled amount of time on a calendar. For example, it - # can be an activity; such as a one-hour long, department meeting from - # 8:00 AM to 9:00 AM, tomorrow. Generally, an event will take up time - # on an individual calendar. - class Event < Component - ical_component :alarms - - ## Single instance properties - - # Access classification (PUBLIC, PRIVATE, CONFIDENTIAL...) - ical_property :ip_class, :klass - - # Date & time of creation - ical_property :created - - # Complete description of the calendar component - ical_property :description - - # Specifies date-time when calendar component begins - ical_property :dtstart, :start - - # Latitude & longitude for specified activity - ical_property :geo, :geo_location - - # Date & time this item was last modified - ical_property :last_modified - - # Specifies the intended venue for this activity - ical_property :location - - # Defines organizer of this item - ical_property :organizer - - # Defines relative priority for this item (1-9... 1 = best) - ical_property :priority - - # Indicate date & time when this item was created - ical_property :dtstamp, :timestamp - - # Revision sequence number for this item - ical_property :sequence, :seq - - # Defines overall status or confirmation of this item - ical_property :status - ical_property :summary - ical_property :transp, :transparency - - # Defines a persistent, globally unique id for this item - ical_property :uid, :unique_id - - # Defines a URL associated with this item - ical_property :url - ical_property :recurid, :recurrence_id - - ## Single but mutually exclusive properties (Not testing though) - - # Specifies a date and time that this item ends - ical_property :dtend, :end - - # Specifies a positive duration time - ical_property :duration - - ## Multi-instance properties - - # Associates a URI or binary blob with this item - ical_multi_property :attach, :attachment, :attachments - - # Defines an attendee for this calendar item - ical_multiline_property :attendee, :attendee, :attendees - - # Defines the categories for a calendar component (school, work...) - ical_multi_property :categories, :category, :categories - - # Simple comment for the calendar user. - ical_multi_property :comment, :comment, :comments - - # Contact information associated with this item. - ical_multi_property :contact, :contact, :contacts - ical_multi_property :exdate, :exception_date, :exception_dates - ical_multi_property :exrule, :exception_rule, :exception_rules - ical_multi_property :rstatus, :request_status, :request_statuses - - # Used to represent a relationship between two calendar items - ical_multi_property :related_to, :related_to, :related_tos - ical_multi_property :resources, :resource, :resources - - # Used with the UID & SEQUENCE to identify a specific instance of a - # recurring calendar item. - ical_multi_property :rdate, :recurrence_date, :recurrence_dates - ical_multi_property :rrule, :recurrence_rule, :recurrence_rules - - def initialize() - super("VEVENT") - - # Now doing some basic initialization - sequence 0 - timestamp DateTime.now - uid new_uid - end - - def alarm(&block) - a = Alarm.new - self.add a - - a.instance_eval &block if block - - a - end - - - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/freebusy.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component/freebusy.rb deleted file mode 100644 index 5f24f5a..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/freebusy.rb +++ /dev/null @@ -1,37 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end -module Icalendar - # A Freebusy calendar component is a grouping of - # component properties that represents either a request for, a reply to - # a request for free or busy time information or a published set of - # busy time information. - class Freebusy < Component - # Single properties - ical_property :contact - ical_property :dtstart, :start - ical_property :dtend, :end - ical_property :dtstamp, :timestamp - ical_property :duration - ical_property :organizer - ical_property :uid, :user_id - ical_property :url - - # Multi-properties - ical_multiline_property :attendee, :attendee, :attendees - ical_multi_property :comment, :comment, :comments - ical_multiline_property :freebusy, :freebusy, :freebusys - ical_multi_property :rstatus, :request_status, :request_statuses - - def initialize() - super("VFREEBUSY") - - timestamp DateTime.now - uid new_uid - end - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/journal.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component/journal.rb deleted file mode 100644 index 80e861b..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/journal.rb +++ /dev/null @@ -1,61 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end -module Icalendar - # A Journal calendar component is a grouping of - # component properties that represent one or more descriptive text - # notes associated with a particular calendar date. The "DTSTART" - # property is used to specify the calendar date that the journal entry - # is associated with. Generally, it will have a DATE value data type, - # but it can also be used to specify a DATE-TIME value data type. - # Examples of a journal entry include a daily record of a legislative - # body or a journal entry of individual telephone contacts for the day - # or an ordered list of accomplishments for the day. The Journal - # calendar component can also be used to associate a document with a - # calendar date. - class Journal < Component - - # Single properties - ical_property :ip_class - ical_property :created - ical_property :description - ical_property :dtstart, :start - ical_property :last_modified - ical_property :organizer - ical_property :dtstamp, :timestamp - ical_property :sequence, :seq - ical_property :status - ical_property :summary - ical_property :uid, :user_id - ical_property :url - ical_property :recurid, :recurrence_id - - # Multi-properties - ical_multi_property :attach, :attachment, :attachments - ical_multiline_property :attendee, :attendee, :attendees - ical_multi_property :categories, :category, :categories - ical_multi_property :comment, :comment, :comments - ical_multi_property :contact, :contact, :contacts - ical_multi_property :exdate, :exception_date, :exception_dates - ical_multi_property :exrule, :exception_rule, :exception_rules - ical_multi_property :rstatus, :request_status, :request_statuses - ical_multi_property :related_to, :related_to, :related_tos - ical_multi_property :resources, :resource, :resources - ical_multi_property :rdate, :recurrence_date, :recurrence_dates - ical_multi_property :rrule, :recurrence_rule, :recurrence_rules - - def initialize() - super("VJOURNAL") - - sequence 0 - timestamp DateTime.now - uid new_uid - end - - end -end - diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/timezone.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component/timezone.rb deleted file mode 100644 index baed983..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/timezone.rb +++ /dev/null @@ -1,87 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end -module Icalendar - # A Timezone is unambiguously defined by the set of time - # measurement rules determined by the governing body for a given - # geographic area. These rules describe at a minimum the base offset - # from UTC for the time zone, often referred to as the Standard Time - # offset. Many locations adjust their Standard Time forward or backward - # by one hour, in order to accommodate seasonal changes in number of - # daylight hours, often referred to as Daylight Saving Time. Some - # locations adjust their time by a fraction of an hour. Standard Time - # is also known as Winter Time. Daylight Saving Time is also known as - # Advanced Time, Summer Time, or Legal Time in certain countries. The - # following table shows the changes in time zone rules in effect for - # New York City starting from 1967. Each line represents a description - # or rule for a particular observance. - class Timezone < Component - ical_component :standard, :daylight - - # Single properties - ical_property :dtstart, :start - ical_property :tzoffsetto, :timezone_offset_to - ical_property :tzoffsetfrom, :timezone_offset_from - ical_property :tzid, :timezone_id - ical_property :tzname, :timezone_name - - ical_property :created - ical_property :last_modified - ical_property :timestamp - ical_property :sequence - - # Multi-properties - ical_multi_property :comment, :comment, :comments - ical_multi_property :rdate, :recurrence_date, :recurrence_dates - ical_multi_property :rrule, :recurrence_rule, :recurrence_rules - - # Define a custom add component method because standard and daylight - # are the only components that can occur just once with their parent. - def add_component(component) - key = component.class.to_s.downcase.gsub('icalendar::','').to_sym - @components[key] = component - end - - # Also need a custom to_ical because typically it iterates over an array - # of components. - def to_ical - print_component do - s = "" - @components.each_value do |comp| - s << comp.to_ical - end - s - end - end - - - def initialize(name = "VTIMEZONE") - super(name) - end - - end - - # A Standard component is a sub-component of the Timezone component which - # is used to describe the standard time offset. - class Standard < Timezone - - def initialize() - super("STANDARD") - end - end - - # A Daylight component is a sub-component of the Timezone component which - # is used to describe the time offset for what is commonly known as - # daylight savings time. - class Daylight < Timezone - - def initialize() - super("DAYLIGHT") - end - end - -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/todo.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/component/todo.rb deleted file mode 100644 index 2021698..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/component/todo.rb +++ /dev/null @@ -1,64 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end -module Icalendar - # A Todo calendar component is a grouping of component - # properties and possibly Alarm calendar components that represent - # an action-item or assignment. For example, it can be used to - # represent an item of work assigned to an individual; such as "turn in - # travel expense today". - class Todo < Component - ical_component :alarms - - # Single properties - ical_property :ip_class - ical_property :completed - ical_property :created - ical_property :description - ical_property :dtstamp, :timestamp - ical_property :dtstart, :start - ical_property :geo - ical_property :last_modified - ical_property :location - ical_property :organizer - ical_property :percent - ical_property :priority - ical_property :recurid, :recurrence_id - ical_property :seq, :sequence - ical_property :status - ical_property :summary - ical_property :uid, :user_id - ical_property :url - - # Single but mutually exclusive TODO: not testing anything yet - ical_property :due - ical_property :duration - - # Multi-properties - ical_multi_property :attach, :attachment, :attachments - ical_multiline_property :attendee, :attendee, :attendees - ical_multi_property :categories, :category, :categories - ical_multi_property :comment, :comment, :comments - ical_multi_property :contact, :contact, :contacts - ical_multi_property :exdate, :exception_date, :exception_dates - ical_multi_property :exrule, :exception_rule, :exception_rules - ical_multi_property :rstatus, :request_status, :request_statuses - ical_multi_property :related_to, :related_to, :related_tos - ical_multi_property :resources, :resource, :resources - ical_multi_property :rdate, :recurrence_date, :recurrence_dates - ical_multi_property :rrule, :recurrence_rule, :recurrence_rules - - def initialize() - super("VTODO") - - sequence 0 - timestamp DateTime.now - uid new_uid - end - - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/conversions.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/conversions.rb deleted file mode 100644 index a00b776..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/conversions.rb +++ /dev/null @@ -1,133 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -require 'date' - -### Add some to_ical methods to classes - -# class Object -# def to_ical -# raise(NotImplementedError, "This object does not implement the to_ical method!") -# end -# end - -require 'uri/generic' - -class String - def to_ical - self - end -end - -class Fixnum - def to_ical - "#{self}" - end -end - -class Float - def to_ical - "#{self}" - end -end - -# From the spec: "Values in a list of values MUST be separated by a COMMA -# character (US-ASCII decimal 44)." -class Array - def to_ical - map{|elem| elem.to_ical}.join ',' - end -end - -module URI - class Generic - def to_ical - "#{self}" - end - end -end - -class DateTime < Date - def to_ical(utc = false) - s = "" - - # 4 digit year - s << self.year.to_s - - # Double digit month - s << "0" unless self.month > 9 - s << self.month.to_s - - # Double digit day - s << "0" unless self.day > 9 - s << self.day.to_s - - s << "T" - - # Double digit hour - s << "0" unless self.hour > 9 - s << self.hour.to_s - - # Double digit minute - s << "0" unless self.min > 9 - s << self.min.to_s - - # Double digit second - s << "0" unless self.sec > 9 - s << self.sec.to_s - - # UTC time gets a Z suffix - if utc - s << "Z" - end - - s - end -end - -class Date - def to_ical(utc = false) - s = "" - - # 4 digit year - s << self.year.to_s - - # Double digit month - s << "0" unless self.month > 9 - s << self.month.to_s - - # Double digit day - s << "0" unless self.day > 9 - s << self.day.to_s - end -end - -class Time - def to_ical(utc = false) - s = "" - - # Double digit hour - s << "0" unless self.hour > 9 - s << self.hour.to_s - - # Double digit minute - s << "0" unless self.min > 9 - s << self.min.to_s - - # Double digit second - s << "0" unless self.sec > 9 - s << self.sec.to_s - - # UTC time gets a Z suffix - if utc - s << "Z" - end - - s - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/helpers.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/helpers.rb deleted file mode 100644 index e4da970..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/helpers.rb +++ /dev/null @@ -1,109 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - Copyright (C) 2005 Sam Roberts - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -module Icalendar - module DateProp - # date = date-fullyear date-month date-mday - # date-fullyear = 4 DIGIT - # date-month = 2 DIGIT - # date-mday = 2 DIGIT - DATE = '(\d\d\d\d)(\d\d)(\d\d)' - - # time = time-hour [":"] time-minute [":"] time-second [time-secfrac] [time-zone] - # time-hour = 2 DIGIT - # time-minute = 2 DIGIT - # time-second = 2 DIGIT - # time-secfrac = "," 1*DIGIT - # time-zone = "Z" / time-numzone - # time-numzome = sign time-hour [":"] time-minute - # TIME = '(\d\d)(\d\d)(\d\d)(Z)?' - TIME = '(\d\d)(\d\d)(\d\d)' - - # This method is called automatically when the module is mixed in. - # I guess you have to do this to mixin class methods rather than instance methods. - def self.append_features(base) - super - klass.extend(ClassMethods) - end - - # This is made a sub-module just so it can be added as class - # methods rather than instance methods. - module ClassMethods - def date_property(dp, alias_name = nil) - dp = "#{dp}".strip.downcase - getter = dp - setter = "#{dp}=" - query = "#{dp}?" - - unless instance_methods.include? getter - code = <<-code - def #{getter}(*a) - if a.empty? - @properties[#{dp.upcase}] - else - self.#{dp} = a.first - end - end - code - - module_eval code - end - - unless instance_methods.include? setter - code = <<-code - def #{setter} a - @properties[#{dp.upcase}] = a - end - code - - module_eval code - end - - unless instance_methods.include? query - code = <<-code - def #{query} - @properties.has_key?(#{dp.upcase}) - end - code - - module_eval code - end - - # Define the getter - getter = "get#{property.to_s.capitalize}" - define_method(getter.to_sym) do - puts "inside getting..." - getDateProperty(property.to_s.upcase) - end - - # Define the setter - setter = "set#{property.to_s.capitalize}" - define_method(setter.to_sym) do |*params| - date = params[0] - utc = params[1] - puts "inside setting..." - setDateProperty(property.to_s.upcase, date, utc) - end - - # Create aliases if a name was specified -# if not aliasName.nil? -# gasym = "get#{aliasName.to_s.capitalize}".to_sym -# gsym = getter.to_sym -# alias gasym gsym - -# sasym = "set#{aliasName.to_s.capitalize}".to_sym -# ssym = setter.to_sym -# alias sasym ssym -# end - end - - end - - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/parameter.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/parameter.rb deleted file mode 100644 index f456ff1..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/parameter.rb +++ /dev/null @@ -1,33 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -module Icalendar - - # A property can have attributes associated with it. These "property - # parameters" contain meta-information about the property or the - # property value. Property parameters are provided to specify such - # information as the location of an alternate text representation for a - # property value, the language of a text property value, the data type - # of the property value and other attributes. - class Parameter < Icalendar::Content - - def to_s - s = "" - - s << "#{@name}=" - if is_escapable? - s << escape(print_value()) - else - s << print_value - end - - s - end - - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/icalendar/parser.rb b/vendor/gems/icalendar-1.0.2/lib/icalendar/parser.rb deleted file mode 100644 index 19636b7..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/icalendar/parser.rb +++ /dev/null @@ -1,375 +0,0 @@ -=begin - Copyright (C) 2005 Jeff Rose - Copyright (C) 2005 Sam Roberts - - This library is free software; you can redistribute it and/or modify it - under the same terms as the ruby language itself, see the file COPYING for - details. -=end - -require 'date' -require 'uri' -require 'stringio' - -module Icalendar - def Icalendar.parse(src, single = false) - cals = Icalendar::Parser.new(src).parse - - if single - cals.first - else - cals - end - end - - class Parser < Icalendar::Base - # date = date-fullyear ["-"] date-month ["-"] date-mday - # date-fullyear = 4 DIGIT - # date-month = 2 DIGIT - # date-mday = 2 DIGIT - DATE = '(\d\d\d\d)-?(\d\d)-?(\d\d)' - - # time = time-hour [":"] time-minute [":"] time-second [time-secfrac] [time-zone] - # time-hour = 2 DIGIT - # time-minute = 2 DIGIT - # time-second = 2 DIGIT - # time-secfrac = "," 1*DIGIT - # time-zone = "Z" / time-numzone - # time-numzome = sign time-hour [":"] time-minute - TIME = '(\d\d):?(\d\d):?(\d\d)(\.\d+)?(Z|[-+]\d\d:?\d\d)?' - - def initialize(src) - # Setup the parser method hash table - setup_parsers() - - if src.respond_to?(:gets) - @file = src - elsif (not src.nil?) and src.respond_to?(:to_s) - @file = StringIO.new(src.to_s, 'r') - else - raise ArgumentError, "CalendarParser.new cannot be called with a #{src.class} type!" - end - - @prev_line = @file.gets - @prev_line.chomp! unless @prev_line.nil? - - @@logger.debug("New Calendar Parser: #{@file.inspect}") - end - - # Define next line for an IO object. - # Works for strings now with StringIO - def next_line - line = @prev_line - - if line.nil? - return nil - end - - # Loop through until we get to a non-continuation line... - loop do - nextLine = @file.gets - @@logger.debug "new_line: #{nextLine}" - - if !nextLine.nil? - nextLine.chomp! - end - - # If it's a continuation line, add it to the last. - # If it's an empty line, drop it from the input. - if( nextLine =~ /^[ \t]/ ) - line << nextLine[1, nextLine.size] - elsif( nextLine =~ /^$/ ) - else - @prev_line = nextLine - break - end - end - line - end - - # Parse the calendar into an object representation - def parse - calendars = [] - - @@logger.debug "parsing..." - # Outer loop for Calendar objects - while (line = next_line) - fields = parse_line(line) - - # Just iterate through until we find the beginning of a calendar object - if fields[:name] == "BEGIN" and fields[:value] == "VCALENDAR" - cal = parse_component - @@logger.debug "Added parsed calendar..." - calendars << cal - end - end - - calendars - end - - private - - # Parse a single VCALENDAR object - # -- This should consist of the PRODID, VERSION, option METHOD & CALSCALE, - # and then one or more calendar components: VEVENT, VTODO, VJOURNAL, - # VFREEBUSY, VTIMEZONE - def parse_component(component = Calendar.new) - @@logger.debug "parsing new component..." - - while (line = next_line) - fields = parse_line(line) - - name = fields[:name].upcase - - # Although properties are supposed to come before components, we should - # be able to handle them in any order... - if name == "END" - break - elsif name == "BEGIN" # New component - case(fields[:value]) - when "VEVENT" # Event - component.add_component parse_component(Event.new) - when "VTODO" # Todo entry - component.add_component parse_component(Todo.new) - when "VALARM" # Alarm sub-component for event and todo - component.add_component parse_component(Alarm.new) - when "VJOURNAL" # Journal entry - component.add_component parse_component(Journal.new) - when "VFREEBUSY" # Free/Busy section - component.add_component parse_component(Freebusy.new) - when "VTIMEZONE" # Timezone specification - component.add_component parse_component(Timezone.new) - when "STANDARD" # Standard time sub-component for timezone - component.add_component parse_component(Standard.new) - when "DAYLIGHT" # Daylight time sub-component for timezone - component.add_component parse_component(Daylight.new) - else # Uknown component type, skip to matching end - until ((line = next_line) == "END:#{fields[:value]}"); end - next - end - else # If its not a component then it should be a property - params = fields[:params] - value = fields[:value] - - # Lookup the property name to see if we have a string to - # object parser for this property type. - if @parsers.has_key?(name) - value = @parsers[name].call(name, params, value) - end - - name = name.downcase - - # TODO: check to see if there are any more conflicts. - if name == 'class' or name == 'method' - name = "ip_" + name - end - - # Replace dashes with underscores - name = name.gsub('-', '_') - - if component.multi_property?(name) - adder = "add_" + name - if component.respond_to?(adder) - component.send(adder, value, params) - else - raise(UnknownPropertyMethod, "Unknown property type: #{adder}") - end - else - if component.respond_to?(name) - component.send(name, value, params) - else - raise(UnknownPropertyMethod, "Unknown property type: #{name}") - end - end - end - end - - component - end - - # 1*(ALPHA / DIGIT / "=") - NAME = '[-a-z0-9]+' - - # <"> <"> - QSTR = '"[^"]*"' - - # Contentline - LINE = "(#{NAME})(.*(?:#{QSTR})|(?:[^:]*))\:(.*)" - - # * - PTEXT = '[^";:,]*' - - # param-value = ptext / quoted-string - PVALUE = "#{QSTR}|#{PTEXT}" - - # param = name "=" param-value *("," param-value) - PARAM = ";(#{NAME})(=?)((?:#{PVALUE})(?:,#{PVALUE})*)" - - def parse_line(line) - unless line =~ %r{#{LINE}}i # Case insensitive match for a valid line - raise "Invalid line in calendar string!" - end - - name = $1.upcase # The case insensitive part is upcased for easier comparison... - paramslist = $2 - value = $3.gsub("\\;", ";").gsub("\\,", ",").gsub("\\n", "\n").gsub("\\\\", "\\") - - # Parse the parameters - params = {} - if paramslist.size > 1 - paramslist.scan( %r{#{PARAM}}i ) do - - # parameter names are case-insensitive, and multi-valued - pname = $1 - pvals = $3 - - # If their isn't an '=' sign then we need to do some custom - # business. Defaults to 'type' - if $2 == "" - pvals = $1 - case $1 - when /quoted-printable/i - pname = 'encoding' - - when /base64/i - pname = 'encoding' - - else - pname = 'type' - end - end - - # Make entries into the params dictionary where the name - # is the key and the value is an array of values. - unless params.key? pname - params[pname] = [] - end - - # Save all the values into the array. - pvals.scan( %r{(#{PVALUE})} ) do - if $1.size > 0 - params[pname] << $1 - end - end - end - end - - {:name => name, :value => value, :params => params} - end - - ## Following is a collection of parsing functions for various - ## icalendar property value data types... First we setup - ## a hash with property names pointing to methods... - def setup_parsers - @parsers = {} - - # Integer properties - m = self.method(:parse_integer) - @parsers["PERCENT-COMPLETE"] = m - @parsers["PRIORITY"] = m - @parsers["REPEAT"] = m - @parsers["SEQUENCE"] = m - - # Dates and Times - m = self.method(:parse_datetime) - @parsers["COMPLETED"] = m - @parsers["DTEND"] = m - @parsers["DUE"] = m - @parsers["DTSTART"] = m - @parsers["RECURRENCE-ID"] = m - @parsers["EXDATE"] = m - @parsers["RDATE"] = m - @parsers["CREATED"] = m - @parsers["DTSTAMP"] = m - @parsers["LAST-MODIFIED"] = m - - # URI's - m = self.method(:parse_uri) - @parsers["TZURL"] = m - @parsers["ATTENDEE"] = m - @parsers["ORGANIZER"] = m - @parsers["URL"] = m - - # This is a URI by default, and if its not a valid URI - # it will be returned as a string which works for binary data - # the other possible type. - @parsers["ATTACH"] = m - - # GEO - m = self.method(:parse_geo) - @parsers["GEO"] = m - - end - - # Booleans - # NOTE: It appears that although this is a valid data type - # there aren't any properties that use it... Maybe get - # rid of this in the future. - def parse_boolean(name, params, value) - if value.upcase == "FALSE" - false - else - true - end - end - - # Dates, Date-Times & Times - # NOTE: invalid dates & times will be returned as strings... - def parse_datetime(name, params, value) - begin - DateTime.parse(value) - rescue Exception - value - end - - end - - # Durations - # TODO: Need to figure out the best way to represent durations - # so just returning string for now. - def parse_duration(name, params, value) - value - end - - # Floats - # NOTE: returns 0.0 if it can't parse the value - def parse_float(name, params, value) - value.to_f - end - - # Integers - # NOTE: returns 0 if it can't parse the value - def parse_integer(name, params, value) - value.to_i - end - - # Periods - # TODO: Got to figure out how to represent periods also... - def parse_period(name, params, value) - value - end - - # Calendar Address's & URI's - # NOTE: invalid URI's will be returned as strings... - def parse_uri(name, params, value) - begin - URI.parse(value) - rescue Exception - value - end - end - - # Geographical location (GEO) - # NOTE: returns an array with two floats (long & lat) - # if the parsing fails return the string - def parse_geo(name, params, value) - strloc = value.split(';') - if strloc.size != 2 - return value - end - - Geo.new(strloc[0].to_f, strloc[1].to_f) - end - - end -end diff --git a/vendor/gems/icalendar-1.0.2/lib/meta.rb b/vendor/gems/icalendar-1.0.2/lib/meta.rb deleted file mode 100644 index 9457fe3..0000000 --- a/vendor/gems/icalendar-1.0.2/lib/meta.rb +++ /dev/null @@ -1,32 +0,0 @@ -# A set of methods to help create meta-programming gizmos. -class Object - # The metaclass is the singleton behind every object. - def metaclass - class << self - self - end - end - - # Evaluates the block in the context of the metaclass - def meta_eval &blk - metaclass.instance_eval &blk - end - - # Acts like an include except it adds the module's methods - # to the metaclass so they act like class methods. - def meta_include mod - meta_eval do - include mod - end - end - - # Adds methods to a metaclass - def meta_def name, &blk - meta_eval { define_method name, &blk } - end - - # Defines an instance method within a class - def class_def name, &blk - class_eval { define_method name, &blk } - end -end diff --git a/vendor/gems/icalendar-1.0.2/test/calendar_test.rb b/vendor/gems/icalendar-1.0.2/test/calendar_test.rb deleted file mode 100644 index dc546a3..0000000 --- a/vendor/gems/icalendar-1.0.2/test/calendar_test.rb +++ /dev/null @@ -1,71 +0,0 @@ -$:.unshift(File.dirname(__FILE__) + '/../lib') - -require 'test/unit' -require 'icalendar' - -require 'date' - -class TestCalendar < Test::Unit::TestCase - include Icalendar - # Generate a calendar using the raw api, and then spit it out - # as a string. Parse the string and make sure everything matches up. - def test_raw_generation - # Create a fresh calendar - cal = Calendar.new - - cal.calscale = "GREGORIAN" - cal.version = "3.2" - cal.prodid = "test-prodid" - - # Now generate the string and then parse it so we can verify - # that everything was set, generated and parsed correctly. - calString = cal.to_ical - - cals = Parser.new(calString).parse - - cal2 = cals.first - assert_equal("GREGORIAN", cal2.calscale) - assert_equal("3.2", cal2.version) - assert_equal("test-prodid", cal2.prodid) - end - - def test_block_creation - cal = Calendar.new - cal.event do - self.dtend = "19970903T190000Z" - self.summary = "This is my summary" - end - - event = cal.event - event.dtend "19970903T190000Z", {:TZID => "Europe/Copenhagen"} - event.summary "This is my summary" - - ev = cal.events.each do |ev| - assert_equal("19970903T190000Z", ev.dtend) - assert_equal("This is my summary", ev.summary) - end - end - - def test_find - cal = Calendar.new - - # add some events so we actually have to search - 10.times do - cal.event - cal.todo - cal.journal - cal.freebusy - end - event = cal.events[5] - assert_equal(event, cal.find_event(event.uid)) - - todo = cal.todos[5] - assert_equal(todo, cal.find_todo(todo.uid)) - - journal = cal.journals[5] - assert_equal(journal, cal.find_journal(journal.uid)) - - freebusy = cal.freebusys[5] - assert_equal(freebusy, cal.find_freebusy(freebusy.uid)) - end -end diff --git a/vendor/gems/icalendar-1.0.2/test/component/event_test.rb b/vendor/gems/icalendar-1.0.2/test/component/event_test.rb deleted file mode 100644 index 2ab1644..0000000 --- a/vendor/gems/icalendar-1.0.2/test/component/event_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) - -require 'test/unit' -require 'icalendar' - -# Define a test event -testEvent = <['"http://my.language.net"'], "LANGUAGE" => ["SPANISH"]} - @event.summary("This is a test summary.", params) - - assert_equal params, @event.summary.ical_params - - @cal.add_event @event - cal_str = @cal.to_ical - - cals = Icalendar::Parser.new(cal_str).parse - event = cals.first.events.first - assert_equal params, event.summary.ical_params - end -end diff --git a/vendor/gems/icalendar-1.0.2/test/parser_test.rb b/vendor/gems/icalendar-1.0.2/test/parser_test.rb deleted file mode 100644 index c513986..0000000 --- a/vendor/gems/icalendar-1.0.2/test/parser_test.rb +++ /dev/null @@ -1,84 +0,0 @@ -$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') - -require 'test/unit' -require 'icalendar' - -# This is a test class for the calendar parser. -class TestIcalendarParser < Test::Unit::TestCase - - TEST_CAL = File.join(File.dirname(__FILE__), 'fixtures', 'single_event.ics') - - # First make sure that we can run the parser and get back objects. - def test_new - # Make sure we don't take invalid object types. - assert_raise(ArgumentError) { Icalendar::Parser.new(nil) } - - # Make sure we get an object back from parsing a file - calFile = File.open(TEST_CAL) - cals = Icalendar::Parser.new(calFile).parse - assert(cals) - calFile.close - - # Make sure we get an object back from parsing a string - calString = File.open(TEST_CAL).read - cals = Icalendar::Parser.new(calString).parse - assert(cals) - end - - # Now go through and make sure the object is correct using the - # dynamically generated raw interfaces. - def test_zzfile_parse - calFile = File.open(TEST_CAL) - cals = Icalendar.parse(calFile) - calFile.close - do_asserts(cals) - - Icalendar::Base.quiet - end - - def test_string_parse - # Make sure we get an object back from parsing a string - calString = File.open(TEST_CAL).read - cals = Icalendar::Parser.new(calString).parse - do_asserts(cals) - end - - # Just a helper method so we don't have to repeat the same tests. - def do_asserts(cals) - # Should just get one calendar back. - assert_equal(1, cals.size) - - cal = cals.first - - # Calendar properties - assert_equal("2.0", cal.version) - assert_equal("bsprodidfortestabc123", cal.prodid) - - # Now the event - assert_equal(1, cal.events.size) - - event = cal.events.first - assert_equal("bsuidfortestabc123", event.uid) - - summary = "This is a really long summary to test the method of unfolding lines, so I'm just going to make it a whole bunch of lines." - - assert_equal(summary, event.summary) - - start = DateTime.parse("20050120T170000") - daend = DateTime.parse("20050120T184500") - stamp = DateTime.parse("20050118T211523Z") - assert_equal(start, event.dtstart) - assert_equal(daend, event.dtend) - assert_equal(stamp, event.dtstamp) - - organizer = URI.parse("mailto:joebob@random.net") - assert_equal(organizer, event.organizer) - - ats = event.attachments - assert_equal(2, ats.size) - attachment = URI.parse("http://bush.sucks.org/impeach/him.rhtml") - assert_equal(attachment, ats[0]) - attachment = URI.parse("http://corporations-dominate.existence.net/why.rhtml") - assert_equal(attachment, ats[1]) - end -end diff --git a/vendor/gems/icalendar-1.0.2/test/read_write.rb b/vendor/gems/icalendar-1.0.2/test/read_write.rb deleted file mode 100644 index fdf16ce..0000000 --- a/vendor/gems/icalendar-1.0.2/test/read_write.rb +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/ruby - -# NOTE: you must have installed ruby-breakpoint in order to use this script. -# Grab it using gem with "gem install ruby-breakpoint --remote" or download -# from the website (http://ruby-breakpoint.rubyforge.org/) then run setup.rb - -$:.unshift(File.dirname(__FILE__) + '/../lib') - -require 'breakpoint' -require 'icalendar' - -cals = Icalendar::Parser.new(File.new(ARGV[0])).parse -puts "Parsed #{cals.size} calendars" - -cal = cals.first -puts "First calendar has:" -puts "#{cal.events.size} events" -puts "#{cal.todos.size} todos" -puts "#{cal.journals.size} journals" - -test = File.new("rw.ics", "w") -test.write(cal.to_ical) -test.close diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/.specification b/vendor/gems/thoughtbot-shoulda-2.10.1/.specification new file mode 100644 index 0000000..c6247c0 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/.specification @@ -0,0 +1,258 @@ +--- !ruby/object:Gem::Specification +name: thoughtbot-shoulda +version: !ruby/object:Gem::Version + version: 2.10.1 +platform: ruby +authors: +- Tammer Saleh +autorequire: +bindir: bin +cert_chain: [] + +date: 2009-03-05 00:00:00 -03:00 +default_executable: convert_to_should_syntax +dependencies: [] + +description: +email: tsaleh@thoughtbot.com +executables: +- convert_to_should_syntax +extensions: [] + +extra_rdoc_files: +- README.rdoc +- CONTRIBUTION_GUIDELINES.rdoc +files: +- CONTRIBUTION_GUIDELINES.rdoc +- MIT-LICENSE +- Rakefile +- README.rdoc +- bin/convert_to_should_syntax +- lib/shoulda +- lib/shoulda/action_controller +- lib/shoulda/action_controller/helpers.rb +- lib/shoulda/action_controller/macros.rb +- lib/shoulda/action_controller/matchers +- lib/shoulda/action_controller/matchers/assign_to_matcher.rb +- lib/shoulda/action_controller/matchers/filter_param_matcher.rb +- lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb +- lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb +- lib/shoulda/action_controller/matchers/respond_with_matcher.rb +- lib/shoulda/action_controller/matchers/route_matcher.rb +- lib/shoulda/action_controller/matchers/set_session_matcher.rb +- lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb +- lib/shoulda/action_controller/matchers.rb +- lib/shoulda/action_controller.rb +- lib/shoulda/action_mailer +- lib/shoulda/action_mailer/assertions.rb +- lib/shoulda/action_mailer.rb +- lib/shoulda/action_view +- lib/shoulda/action_view/macros.rb +- lib/shoulda/action_view.rb +- lib/shoulda/active_record +- lib/shoulda/active_record/assertions.rb +- lib/shoulda/active_record/helpers.rb +- lib/shoulda/active_record/macros.rb +- lib/shoulda/active_record/matchers +- lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +- lib/shoulda/active_record/matchers/allow_value_matcher.rb +- lib/shoulda/active_record/matchers/association_matcher.rb +- lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +- lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +- lib/shoulda/active_record/matchers/have_db_column_matcher.rb +- lib/shoulda/active_record/matchers/have_index_matcher.rb +- lib/shoulda/active_record/matchers/have_named_scope_matcher.rb +- lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +- lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +- lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +- lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +- lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +- lib/shoulda/active_record/matchers/validation_matcher.rb +- lib/shoulda/active_record/matchers.rb +- lib/shoulda/active_record.rb +- lib/shoulda/assertions.rb +- lib/shoulda/autoload_macros.rb +- lib/shoulda/context.rb +- lib/shoulda/helpers.rb +- lib/shoulda/macros.rb +- lib/shoulda/private_helpers.rb +- lib/shoulda/proc_extensions.rb +- lib/shoulda/rails.rb +- lib/shoulda/rspec.rb +- lib/shoulda/tasks +- lib/shoulda/tasks/list_tests.rake +- lib/shoulda/tasks/yaml_to_shoulda.rake +- lib/shoulda/tasks.rb +- lib/shoulda/test_unit.rb +- lib/shoulda.rb +- rails/init.rb +- test/fail_macros.rb +- test/fixtures +- test/fixtures/addresses.yml +- test/fixtures/friendships.yml +- test/fixtures/posts.yml +- test/fixtures/products.yml +- test/fixtures/taggings.yml +- test/fixtures/tags.yml +- test/fixtures/users.yml +- test/functional +- test/functional/posts_controller_test.rb +- test/functional/users_controller_test.rb +- test/matchers +- test/matchers/active_record +- test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb +- test/matchers/active_record/allow_value_matcher_test.rb +- test/matchers/active_record/association_matcher_test.rb +- test/matchers/active_record/ensure_inclusion_of_matcher_test.rb +- test/matchers/active_record/ensure_length_of_matcher_test.rb +- test/matchers/active_record/have_db_column_matcher_test.rb +- test/matchers/active_record/have_index_matcher_test.rb +- test/matchers/active_record/have_named_scope_matcher_test.rb +- test/matchers/active_record/have_readonly_attributes_matcher_test.rb +- test/matchers/active_record/validate_acceptance_of_matcher_test.rb +- test/matchers/active_record/validate_numericality_of_matcher_test.rb +- test/matchers/active_record/validate_presence_of_matcher_test.rb +- test/matchers/active_record/validate_uniqueness_of_matcher_test.rb +- test/matchers/controller +- test/matchers/controller/assign_to_matcher_test.rb +- test/matchers/controller/filter_param_matcher_test.rb +- test/matchers/controller/render_with_layout_matcher_test.rb +- test/matchers/controller/respond_with_content_type_matcher_test.rb +- test/matchers/controller/respond_with_matcher_test.rb +- test/matchers/controller/route_matcher_test.rb +- test/matchers/controller/set_session_matcher_test.rb +- test/matchers/controller/set_the_flash_matcher.rb +- test/model_builder.rb +- test/other +- test/other/autoload_macro_test.rb +- test/other/context_test.rb +- test/other/convert_to_should_syntax_test.rb +- test/other/helpers_test.rb +- test/other/private_helpers_test.rb +- test/other/should_test.rb +- test/rails_root +- test/rails_root/app +- test/rails_root/app/controllers +- test/rails_root/app/controllers/application.rb +- test/rails_root/app/controllers/posts_controller.rb +- test/rails_root/app/controllers/users_controller.rb +- test/rails_root/app/helpers +- test/rails_root/app/helpers/application_helper.rb +- test/rails_root/app/helpers/posts_helper.rb +- test/rails_root/app/helpers/users_helper.rb +- test/rails_root/app/models +- test/rails_root/app/models/address.rb +- test/rails_root/app/models/flea.rb +- test/rails_root/app/models/friendship.rb +- test/rails_root/app/models/pets +- test/rails_root/app/models/pets/dog.rb +- test/rails_root/app/models/post.rb +- test/rails_root/app/models/product.rb +- test/rails_root/app/models/tag.rb +- test/rails_root/app/models/tagging.rb +- test/rails_root/app/models/treat.rb +- test/rails_root/app/models/user.rb +- test/rails_root/app/views +- test/rails_root/app/views/layouts +- test/rails_root/app/views/layouts/posts.rhtml +- test/rails_root/app/views/layouts/users.rhtml +- test/rails_root/app/views/layouts/wide.html.erb +- test/rails_root/app/views/posts +- test/rails_root/app/views/posts/edit.rhtml +- test/rails_root/app/views/posts/index.rhtml +- test/rails_root/app/views/posts/new.rhtml +- test/rails_root/app/views/posts/show.rhtml +- test/rails_root/app/views/users +- test/rails_root/app/views/users/edit.rhtml +- test/rails_root/app/views/users/index.rhtml +- test/rails_root/app/views/users/new.rhtml +- test/rails_root/app/views/users/show.rhtml +- test/rails_root/config +- test/rails_root/config/boot.rb +- test/rails_root/config/database.yml +- test/rails_root/config/environment.rb +- test/rails_root/config/environments +- test/rails_root/config/environments/test.rb +- test/rails_root/config/initializers +- test/rails_root/config/initializers/new_rails_defaults.rb +- test/rails_root/config/initializers/shoulda.rb +- test/rails_root/config/routes.rb +- test/rails_root/db +- test/rails_root/db/migrate +- test/rails_root/db/migrate/001_create_users.rb +- test/rails_root/db/migrate/002_create_posts.rb +- test/rails_root/db/migrate/003_create_taggings.rb +- test/rails_root/db/migrate/004_create_tags.rb +- test/rails_root/db/migrate/005_create_dogs.rb +- test/rails_root/db/migrate/006_create_addresses.rb +- test/rails_root/db/migrate/007_create_fleas.rb +- test/rails_root/db/migrate/008_create_dogs_fleas.rb +- test/rails_root/db/migrate/009_create_products.rb +- test/rails_root/db/migrate/010_create_friendships.rb +- test/rails_root/db/migrate/011_create_treats.rb +- test/rails_root/db/schema.rb +- test/rails_root/log +- test/rails_root/log/sqlite3.log +- test/rails_root/log/test.log +- test/rails_root/public +- test/rails_root/public/404.html +- test/rails_root/public/422.html +- test/rails_root/public/500.html +- test/rails_root/script +- test/rails_root/script/console +- test/rails_root/script/generate +- test/rails_root/test +- test/rails_root/test/shoulda_macros +- test/rails_root/test/shoulda_macros/custom_macro.rb +- test/rails_root/vendor +- test/rails_root/vendor/gems +- test/rails_root/vendor/gems/gem_with_macro-0.0.1 +- test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros +- test/rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +- test/rails_root/vendor/plugins +- test/rails_root/vendor/plugins/plugin_with_macro +- test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros +- test/rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +- test/README +- test/rspec_test.rb +- test/test_helper.rb +- test/unit +- test/unit/address_test.rb +- test/unit/dog_test.rb +- test/unit/flea_test.rb +- test/unit/friendship_test.rb +- test/unit/post_test.rb +- test/unit/product_test.rb +- test/unit/tag_test.rb +- test/unit/tagging_test.rb +- test/unit/user_test.rb +has_rdoc: true +homepage: http://thoughtbot.com/projects/shoulda +post_install_message: +rdoc_options: +- --line-numbers +- --main +- README.rdoc +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: "0" + version: +required_rubygems_version: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: "0" + version: +requirements: [] + +rubyforge_project: shoulda +rubygems_version: 1.3.1 +signing_key: +specification_version: 2 +summary: Making tests easy on the fingers and eyes +test_files: [] + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc b/vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc new file mode 100644 index 0000000..ac1794f --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/CONTRIBUTION_GUIDELINES.rdoc @@ -0,0 +1,12 @@ +We're using GitHub[http://github.com/thoughtbot/shoulda/tree/master] and Lighthouse[http://thoughtbot.lighthouseapp.com/projects/5807], and we've been getting any combination of github pull requests, Lighthouse tickets, patches, emails, etc. We need to normalize this workflow to make sure we don't miss any fixes. + +* Make sure you're accessing the source from the {official repository}[http://github.com/thoughtbot/shoulda/tree/master]. +* We prefer git branches over patches, but we can take either. +* If you're using git, please make a branch for each separate contribution. We can cherry pick your commits, but pulling from a branch is easier. +* If you're submitting patches, please cut each fix or feature into a separate patch. +* There should be a Lighthouse[http://thoughtbot.lighthouseapp.com/projects/5807] ticket for any submission. If you've found a bug and want to fix it, open a new ticket at the same time. +* We've got github/lighthouse integration going, so you can update tickets when you commit. {This blog post}[http://hoth.entp.com/2008/4/11/github-and-lighthouse-sitting-in-a-tree] explains the commit options pretty well. +* Please don't send pull requests Just update the lighthouse ticket with the url for your fix (or attach the patch) when it's ready. The github pull requests pretty much get dropped on the floor until someone with commit rights notices them in the mailbox. +* Contributions without tests won't be accepted. The file /test/README explains the testing system pretty thoroughly. + + diff --git a/vendor/plugins/shoulda/MIT-LICENSE b/vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE similarity index 100% rename from vendor/plugins/shoulda/MIT-LICENSE rename to vendor/gems/thoughtbot-shoulda-2.10.1/MIT-LICENSE diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc b/vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc new file mode 100644 index 0000000..4c61ad4 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/README.rdoc @@ -0,0 +1,169 @@ += Shoulda - Making tests easy on the fingers and eyes + +Shoulda makes it easy to write elegant, understandable, and maintainable tests. Shoulda consists of test macros, assertions, and helpers added on to the Test::Unit framework. It's fully compatible with your existing tests, and requires no retooling to use. + +Helpers:: #context and #should give you RSpec like test blocks. + In addition, you get nested contexts and a much more readable syntax. +Macros:: Generate hundreds of lines of Controller and ActiveRecord tests with these powerful macros. + They get you started quickly, and can help you ensure that your application is conforming to best practices. +Assertions:: Many common rails testing idioms have been distilled into a set of useful assertions. +Matchers:: Rspec-compatible matchers providing the same tests as Shoulda macros. + += Usage + +=== Context Helpers (Shoulda::Context) + +Stop killing your fingers with all of those underscores... Name your tests with plain sentences! + + class UserTest < Test::Unit::TestCase + context "A User instance" do + setup do + @user = User.find(:first) + end + + should "return its full name" do + assert_equal 'John Doe', @user.full_name + end + + context "with a profile" do + setup do + @user.profile = Profile.find(:first) + end + + should "return true when sent #has_profile?" do + assert @user.has_profile? + end + end + end + end + +Produces the following test methods: + + "test: A User instance should return its full name." + "test: A User instance with a profile should return true when sent #has_profile?." + +So readable! + +=== ActiveRecord Tests (Shoulda::ActiveRecord::Macros) + +Quick macro tests for your ActiveRecord associations and validations: + + class PostTest < Test::Unit::TestCase + fixtures :all + + should_belong_to :user + should_have_many :tags, :through => :taggings + + should_validate_uniqueness_of :title + should_validate_presence_of :body, :message => /wtf/ + should_validate_presence_of :title + should_validate_numericality_of :user_id + end + + class UserTest < Test::Unit::TestCase + should_have_many :posts + + should_not_allow_values_for :email, "blah", "b lah" + should_allow_values_for :email, "a@b.com", "asdf@asdf.com" + should_ensure_length_in_range :email, 1..100 + should_ensure_value_in_range :age, 1..100 + should_not_allow_mass_assignment_of :password + end + +Makes TDD so much easier. + +=== Controller Tests (Shoulda::Controller::Macros) + +Macros to test the most common controller patterns... + + context "on GET to :show for first record" do + setup do + get :show, :id => 1 + end + + should_assign_to :user + should_respond_with :success + should_render_template :show + should_not_set_the_flash + + should "do something else really cool" do + assert_equal 1, assigns(:user).id + end + end + +=== Helpful Assertions (Shoulda::Assertions) + +More to come here, but have fun with what's there. + + assert_same_elements([:a, :b, :c], [:c, :a, :b]) + assert_contains(['a', '1'], /\d/) + assert_contains(['a', '1'], 'a') + +=== 3rd Party and Application Specific Macros + +Any *.rb file under RAILS_ROOT/test/shoulda_macros/ or vendor/(plugins|gems)/gem_name/shoulda_macros/ will be automatically required when you run your tests. This allows you to distribute macros with your plugins, or to organize the macros inside your application. Remember to add your macro to Test::Unit::TestCase in the macro file: + + # test/shoulda_macros/security.rb + class Test::Unit::TestCase + def self.should_be_denied(opts = {}) + should_set_the_flash_to(opts[:flash] || /Please log in/i) + should_redirect_to(opts[:redirect] || 'login_url') + end + end + += Rails Installation (Test::Unit) + +=== As a Gem + +Use this if you prefer to use versioned releases of shoulda. Specify the gem dependency in your config/environment.rb file: + + Rails::Initializer.run do |config| + config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com" + end + +Then: + + $ rake gems:install + $ rake gems:unpack + +=== As a Plugin + +Use this if you prefer to use the edge version of shoulda: + + $ script/plugin install git://github.com/thoughtbot/shoulda.git + +=== As a Plugin (using git submodules) + +Use this if you prefer the idea of being able to easily switch between using edge or a tagged version of shoulda: + + $ git submodule add git://github.com/thoughtbot/shoulda.git vendor/plugins/shoulda + += Rails Installation (RSpec) + +If you're using Shoulda with RSpec, we recommend that you add config.gem lines +for RSpec and Shoulda in your config/environment/test.rb file, but do not ask +Rails to load the RSpec and Shoulda libraries: + + config.gem 'rspec', :lib => false + config.gem 'rspec-rails', :lib => false + config.gem 'thoughtbot-shoulda', + :lib => false, + :source => 'http://gems.github.com' + +Then require shoulda from your spec/spec_helper.rb file, before Spec::Runner is +configured: + + # requires for RSpec + require 'shoulda' + Spec::Runner.configure do |config| + # ... + +You should not need to require anything besides the top-level shoulda library. + += Credits + +Shoulda is maintained by {Tammer Saleh}[mailto:tsaleh@thoughtbot.com], and is funded by Thoughtbot[http://www.thoughtbot.com], inc. + += License + +Shoulda is Copyright © 2006-2008 Tammer Saleh, Thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file. diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile b/vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile new file mode 100644 index 0000000..7c04641 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/Rakefile @@ -0,0 +1,72 @@ +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' +require 'rake/gempackagetask' + +$LOAD_PATH.unshift("lib") +require 'shoulda' +load 'tasks/shoulda.rake' + +# Test::Unit::UI::VERBOSE +test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb' +Rake::TestTask.new do |t| + t.libs << 'lib' + t.pattern = test_files_pattern + t.verbose = false +end + +Rake::RDocTask.new { |rdoc| + rdoc.rdoc_dir = 'doc' + rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes" + rdoc.options << '--line-numbers' + rdoc.template = "#{ENV['template']}.rb" if ENV['template'] + rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb') +} + +desc "Run code-coverage analysis using rcov" +task :coverage do + rm_rf "coverage" + files = Dir[test_files_pattern] + system "rcov --rails --sort coverage -Ilib #{files.join(' ')}" +end + +desc 'Update documentation on website' +task :sync_docs => 'rdoc' do + `rsync -ave ssh doc/ dev@dev.thoughtbot.com:/home/dev/www/dev.thoughtbot.com/shoulda` +end + +desc 'Default: run tests.' +task :default => ['test'] + +spec = Gem::Specification.new do |s| + s.name = "shoulda" + s.version = Shoulda::VERSION + s.summary = "Making tests easy on the fingers and eyes" + s.homepage = "http://thoughtbot.com/projects/shoulda" + s.rubyforge_project = "shoulda" + + s.files = FileList["[A-Z]*", "{bin,lib,rails,test}/**/*"] + s.executables = s.files.grep(/^bin/) { |f| File.basename(f) } + + s.has_rdoc = true + s.extra_rdoc_files = ["README.rdoc", "CONTRIBUTION_GUIDELINES.rdoc"] + s.rdoc_options = ["--line-numbers", "--main", "README.rdoc"] + + s.authors = ["Tammer Saleh"] + s.email = "tsaleh@thoughtbot.com" +end + +Rake::GemPackageTask.new spec do |pkg| + pkg.need_tar = true + pkg.need_zip = true +end + +desc "Clean files generated by rake tasks" +task :clobber => [:clobber_rdoc, :clobber_package] + +desc "Generate a gemspec file for GitHub" +task :gemspec do + File.open("#{spec.name}.gemspec", 'w') do |f| + f.write spec.to_ruby + end +end diff --git a/vendor/plugins/shoulda/bin/convert_to_should_syntax b/vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax similarity index 61% rename from vendor/plugins/shoulda/bin/convert_to_should_syntax rename to vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax index ca5b94d..d1264d0 100755 --- a/vendor/plugins/shoulda/bin/convert_to_should_syntax +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/bin/convert_to_should_syntax @@ -1,5 +1,8 @@ #!/usr/bin/env ruby require 'fileutils' +require 'tmpdir' + +TMP = Dir::tmpdir def usage(msg = nil) puts "Error: #{msg}" if msg @@ -18,23 +21,22 @@ def usage(msg = nil) puts " ..." puts " end" puts - puts "A copy of the old file will be left under /tmp/ in case this script just seriously screws up" + puts "A copy of the old file will be left under #{TMP} in case\nthis script just seriously screws up" puts exit (msg ? 2 : 0) end usage("Wrong number of arguments.") unless ARGV.size == 1 -usage("This system doesn't have a /tmp directory. wtf?") unless File.directory?('/tmp') +usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to a writeable directory.") unless File.directory?(TMP) && File.writable?(TMP) file = ARGV.shift -tmpfile = "/tmp/#{File.basename(file)}" +tmpfile = File.join(TMP, File.basename(file)) usage("File '#{file}' doesn't exist") unless File.exists?(file) FileUtils.cp(file, tmpfile) contents = File.read(tmpfile) -contents.gsub!(/def test_should_(.*)\s*$/, 'should "\1" do') -contents.gsub!(/def test_(.*)\s*$/, 'should "RENAME ME: test \1" do') -contents.gsub!(/should ".*" do$/) {|line| line.tr!('_', ' ')} +contents.gsub!(/def test_should_(\S+)/) {|line| "should \"#{$1.tr('_', ' ')}\" do"} +contents.gsub!(/def test_(\S+)/) {|line| "should \"RENAME ME: test #{$1.tr('_', ' ')}\" do"} File.open(file, 'w') { |f| f.write(contents) } puts "File '#{file}' has been converted to 'should' syntax. Old version has been stored in '#{tmpfile}'" diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb new file mode 100644 index 0000000..4b46206 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda.rb @@ -0,0 +1,9 @@ +module Shoulda + VERSION = "2.10.1" +end + +if defined? Spec + require 'shoulda/rspec' +else + require 'shoulda/test_unit' +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb new file mode 100644 index 0000000..9e33356 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller.rb @@ -0,0 +1,32 @@ +require 'shoulda' +require 'shoulda/action_controller/helpers' +require 'shoulda/action_controller/matchers' +require 'shoulda/action_controller/macros' +require 'shoulda/action_controller/resource_options' + +module Test # :nodoc: all + module Unit + class TestCase + include Shoulda::ActionController::Matchers + include Shoulda::ActionController::Helpers + extend Shoulda::ActionController::Macros + Shoulda::ActionController::VALID_FORMATS.each do |format| + include "Shoulda::ActionController::#{format.to_s.upcase}".constantize + end + end + end +end + +require 'shoulda/active_record/assertions' +require 'shoulda/action_mailer/assertions' + +module ActionController #:nodoc: all + module Integration + class Session + include Shoulda::Assertions + include Shoulda::Helpers + include Shoulda::ActiveRecord::Assertions + include Shoulda::ActionMailer::Assertions + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb new file mode 100644 index 0000000..e3f67df --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/html.rb @@ -0,0 +1,199 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module HTML # :nodoc: all + def self.included(other) + other.class_eval do + extend Shoulda::ActionController::HTML::ClassMethods + end + end + + module ClassMethods + def controller_name_from_class + self.name.gsub(/Test/, '') + end + + def make_show_html_tests(res) + context "on GET to #{controller_name_from_class}#show" do + setup do + record = get_existing_record(res) + parent_params = make_parent_params(res, record) + get :show, parent_params.merge({ res.identifier => record.to_param }) + end + + if res.denied.actions.include?(:show) + should_not_assign_to res.object + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + else + should_assign_to res.object + should_respond_with :success + should_render_template :show + should_not_set_the_flash + end + end + end + + def make_edit_html_tests(res) + context "on GET to #{controller_name_from_class}#edit" do + setup do + @record = get_existing_record(res) + parent_params = make_parent_params(res, @record) + get :edit, parent_params.merge({ res.identifier => @record.to_param }) + end + + if res.denied.actions.include?(:edit) + should_not_assign_to res.object + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + else + should_assign_to res.object + should_respond_with :success + should_render_template :edit + should_not_set_the_flash + should_render_a_form + should "set @#{res.object} to requested instance" do + assert_equal @record, assigns(res.object) + end + end + end + end + + def make_index_html_tests(res) + context "on GET to #{controller_name_from_class}#index" do + setup do + record = get_existing_record(res) rescue nil + parent_params = make_parent_params(res, record) + get(:index, parent_params) + end + + if res.denied.actions.include?(:index) + should_not_assign_to res.object.to_s.pluralize + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + else + should_respond_with :success + should_assign_to res.object.to_s.pluralize + should_render_template :index + should_not_set_the_flash + end + end + end + + def make_new_html_tests(res) + context "on GET to #{controller_name_from_class}#new" do + setup do + record = get_existing_record(res) rescue nil + parent_params = make_parent_params(res, record) + get(:new, parent_params) + end + + if res.denied.actions.include?(:new) + should_not_assign_to res.object + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + else + should_respond_with :success + should_assign_to res.object + should_not_set_the_flash + should_render_template :new + should_render_a_form + end + end + end + + def make_destroy_html_tests(res) + context "on DELETE to #{controller_name_from_class}#destroy" do + setup do + @record = get_existing_record(res) + parent_params = make_parent_params(res, @record) + delete :destroy, parent_params.merge({ res.identifier => @record.to_param }) + end + + if res.denied.actions.include?(:destroy) + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + + should "not destroy record" do + assert_nothing_raised { assert @record.reload } + end + else + should_set_the_flash_to res.destroy.flash + if res.destroy.redirect.is_a? Symbol + should_respond_with res.destroy.redirect + else + should_redirect_to res.destroy.redirect + end + + should "destroy record" do + assert_raises(::ActiveRecord::RecordNotFound, "@#{res.object} was not destroyed.") do + @record.reload + end + end + end + end + end + + def make_create_html_tests(res) + context "on POST to #{controller_name_from_class}#create with #{res.create.params.inspect}" do + setup do + record = get_existing_record(res) rescue nil + parent_params = make_parent_params(res, record) + @count = res.klass.count + post :create, parent_params.merge(res.object => res.create.params) + end + + if res.denied.actions.include?(:create) + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + should_not_assign_to res.object + + should "not create new record" do + assert_equal @count, res.klass.count + end + else + should_assign_to res.object + should_set_the_flash_to res.create.flash + if res.create.redirect.is_a? Symbol + should_respond_with res.create.redirect + else + should_redirect_to res.create.redirect + end + + should "not have errors on @#{res.object}" do + assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:" + end + end + end + end + + def make_update_html_tests(res) + context "on PUT to #{controller_name_from_class}#update with #{res.create.params.inspect}" do + setup do + @record = get_existing_record(res) + parent_params = make_parent_params(res, @record) + put :update, parent_params.merge(res.identifier => @record.to_param, res.object => res.update.params) + end + + if res.denied.actions.include?(:update) + should_not_assign_to res.object + should_redirect_to res.denied.redirect + should_set_the_flash_to res.denied.flash + else + should_assign_to res.object + should_set_the_flash_to(res.update.flash) + if res.update.redirect.is_a? Symbol + should_respond_with res.update.redirect + else + should_redirect_to res.update.redirect + end + + should "not have errors on @#{res.object}" do + assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:" + end + end + end + end + end + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb new file mode 100644 index 0000000..25b45ca --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/formats/xml.rb @@ -0,0 +1,168 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module XML + def self.included(other) #:nodoc: + other.class_eval do + extend Shoulda::ActionController::XML::ClassMethods + end + end + + module ClassMethods + # Macro that creates a test asserting that the controller responded with an XML content-type + # and that the XML contains ++ as the root element. + def should_respond_with_xml_for(name = nil) + should "have ContentType set to 'application/xml'" do + assert_xml_response + end + + if name + should "return <#{name}/> as the root element" do + body = @response.body.first(100).map {|l| " #{l}"} + assert_select name.to_s.dasherize, 1, "Body:\n#{body}...\nDoes not have <#{name}/> as the root element." + end + end + end + alias should_respond_with_xml should_respond_with_xml_for + + protected + + def make_show_xml_tests(res) # :nodoc: + context "on GET to #{controller_name_from_class}#show as xml" do + setup do + request_xml + record = get_existing_record(res) + parent_params = make_parent_params(res, record) + get :show, parent_params.merge({ res.identifier => record.to_param }) + end + + if res.denied.actions.include?(:show) + should_not_assign_to res.object + should_respond_with 401 + else + should_assign_to res.object + should_respond_with :success + should_respond_with_xml_for res.object + end + end + end + + def make_edit_xml_tests(res) # :nodoc: + # XML doesn't need an :edit action + end + + def make_new_xml_tests(res) # :nodoc: + # XML doesn't need a :new action + end + + def make_index_xml_tests(res) # :nodoc: + context "on GET to #{controller_name_from_class}#index as xml" do + setup do + request_xml + parent_params = make_parent_params(res) + get(:index, parent_params) + end + + if res.denied.actions.include?(:index) + should_not_assign_to res.object.to_s.pluralize + should_respond_with 401 + else + should_respond_with :success + should_respond_with_xml_for res.object.to_s.pluralize + should_assign_to res.object.to_s.pluralize + end + end + end + + def make_destroy_xml_tests(res) # :nodoc: + context "on DELETE to #{controller_name_from_class}#destroy as xml" do + setup do + request_xml + @record = get_existing_record(res) + parent_params = make_parent_params(res, @record) + delete :destroy, parent_params.merge({ res.identifier => @record.to_param }) + end + + if res.denied.actions.include?(:destroy) + should_respond_with 401 + + should "not destroy record" do + assert @record.reload + end + else + should "destroy record" do + assert_raises(::ActiveRecord::RecordNotFound, "@#{res.object} was not destroyed.") do + @record.reload + end + end + end + end + end + + def make_create_xml_tests(res) # :nodoc: + context "on POST to #{controller_name_from_class}#create as xml" do + setup do + request_xml + parent_params = make_parent_params(res) + @count = res.klass.count + post :create, parent_params.merge(res.object => res.create.params) + end + + if res.denied.actions.include?(:create) + should_respond_with 401 + should_not_assign_to res.object + + should "not create new record" do + assert_equal @count, res.klass.count + end + else + should_assign_to res.object + + should "not have errors on @#{res.object}" do + assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:" + end + end + end + end + + def make_update_xml_tests(res) # :nodoc: + context "on PUT to #{controller_name_from_class}#update as xml" do + setup do + request_xml + @record = get_existing_record(res) + parent_params = make_parent_params(res, @record) + put :update, parent_params.merge(res.identifier => @record.to_param, res.object => res.update.params) + end + + if res.denied.actions.include?(:update) + should_not_assign_to res.object + should_respond_with 401 + else + should_assign_to res.object + + should "not have errors on @#{res.object}" do + assert_equal [], assigns(res.object).errors.full_messages, "@#{res.object} has errors:" + end + end + end + end + end + + # Sets the next request's format to 'application/xml' + def request_xml + @request.accept = "application/xml" + end + + # Asserts that the controller's response was 'application/xml' + def assert_xml_response + content_type = (@response.headers["Content-Type"] || @response.headers["type"]).to_s + regex = %r{\bapplication/xml\b} + + msg = "Content Type '#{content_type.inspect}' doesn't match '#{regex.inspect}'\n" + msg += "Body: #{@response.body.first(100).chomp} ..." + + assert_match regex, content_type, msg + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb new file mode 100644 index 0000000..4b0b341 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/helpers.rb @@ -0,0 +1,64 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Helpers # :nodoc: + private # :enddoc: + + SPECIAL_INSTANCE_VARIABLES = %w{ + _cookies + _flash + _headers + _params + _request + _response + _session + action_name + before_filter_chain_aborted + cookies + flash + headers + ignore_missing_templates + logger + params + request + request_origin + response + session + template + template_class + template_root + url + variables_added + }.map(&:to_s) + + def instantiate_variables_from_assigns(*names, &blk) + old = {} + names = (@response.template.assigns.keys - SPECIAL_INSTANCE_VARIABLES) if names.empty? + names.each do |name| + old[name] = instance_variable_get("@#{name}") + instance_variable_set("@#{name}", assigns(name.to_sym)) + end + blk.call + names.each do |name| + instance_variable_set("@#{name}", old[name]) + end + end + + def get_existing_record(res) # :nodoc: + returning(instance_variable_get("@#{res.object}")) do |record| + assert(record, "This test requires you to set @#{res.object} in your setup block") + end + end + + def make_parent_params(resource, record = nil, parent_names = nil) # :nodoc: + parent_names ||= resource.parents.reverse + return {} if parent_names == [] # Base case + parent_name = parent_names.shift + parent = record ? record.send(parent_name) : parent_name.to_s.classify.constantize.find(:first) + + { :"#{parent_name}_id" => parent.to_param }.merge(make_parent_params(resource, parent, parent_names)) + end + + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb new file mode 100644 index 0000000..9c02694 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/macros.rb @@ -0,0 +1,296 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + # = Macro test helpers for your controllers + # + # By using the macro helpers you can quickly and easily create concise and easy to read test suites. + # + # This code segment: + # context "on GET to :show for first record" do + # setup do + # get :show, :id => 1 + # end + # + # should_assign_to :user + # should_respond_with :success + # should_render_template :show + # should_not_set_the_flash + # + # should "do something else really cool" do + # assert_equal 1, assigns(:user).id + # end + # end + # + # Would produce 5 tests for the +show+ action + module Macros + include Matchers + + def should_be_restful(&blk) # :yields: resource + resource = ResourceOptions.new + blk.call(resource) + resource.normalize!(self) + + resource.formats.each do |format| + resource.actions.each do |action| + if self.respond_to? :"make_#{action}_#{format}_tests" + self.send(:"make_#{action}_#{format}_tests", resource) + else + should "test #{action} #{format}" do + flunk "Test for #{action} as #{format} not implemented" + end + end + end + end + end + + # Macro that creates a test asserting that the flash contains the given value. + # val can be a String, a Regex, or nil (indicating that the flash should not be set) + # + # Example: + # + # should_set_the_flash_to "Thank you for placing this order." + # should_set_the_flash_to /created/i + # should_set_the_flash_to nil + def should_set_the_flash_to(val) + matcher = set_the_flash.to(val) + if val + should matcher.description do + assert_accepts matcher, @controller + end + else + should "not #{matcher.description}" do + assert_rejects matcher, @controller + end + end + end + + # Macro that creates a test asserting that the flash is empty. Same as + # @should_set_the_flash_to nil@ + def should_not_set_the_flash + should_set_the_flash_to nil + end + + # Macro that creates a test asserting that filter_parameter_logging + # + # is set for the specified keys + # + # Example: + # + # should_filter_params :password, :ssn + def should_filter_params(*keys) + keys.each do |key| + matcher = filter_param(key) + should matcher.description do + assert_accepts matcher, @controller + end + end + end + + # Macro that creates a test asserting that the controller assigned to + # each of the named instance variable(s). + # + # Options: + # * :class - The expected class of the instance variable being checked. + # * :equals - A string which is evaluated and compared for equality with + # the instance variable being checked. + # + # Example: + # + # should_assign_to :user, :posts + # should_assign_to :user, :class => User + # should_assign_to(:user) { @user } + def should_assign_to(*names, &block) + opts = names.extract_options! + if opts[:equals] + warn "[DEPRECATION] should_assign_to :var, :equals => 'val' " << + "is deprecated. Use should_assign_to(:var) { 'val' } instead." + end + names.each do |name| + matcher = assign_to(name).with_kind_of(opts[:class]) + test_name = matcher.description + test_name << " which is equal to #{opts[:equals]}" if opts[:equals] + should test_name do + if opts[:equals] + instantiate_variables_from_assigns do + expected_value = eval(opts[:equals], + self.send(:binding), + __FILE__, + __LINE__) + matcher = matcher.with(expected_value) + end + elsif block + expected_value = instance_eval(&block) + matcher = matcher.with(expected_value) + end + + assert_accepts matcher, @controller + end + end + end + + # Macro that creates a test asserting that the controller did not assign to + # any of the named instance variable(s). + # + # Example: + # + # should_not_assign_to :user, :posts + def should_not_assign_to(*names) + names.each do |name| + matcher = assign_to(name) + should "not #{matcher.description}" do + assert_rejects matcher, @controller + end + end + end + + # Macro that creates a test asserting that the controller responded with a 'response' status code. + # Example: + # + # should_respond_with :success + def should_respond_with(response) + should "respond with #{response}" do + matcher = respond_with(response) + assert_accepts matcher, @controller + end + end + + # Macro that creates a test asserting that the response content type was 'content_type'. + # Example: + # + # should_respond_with_content_type 'application/rss+xml' + # should_respond_with_content_type :rss + # should_respond_with_content_type /rss/ + def should_respond_with_content_type(content_type) + should "respond with content type of #{content_type}" do + matcher = respond_with_content_type(content_type) + assert_accepts matcher, @controller + end + end + + # Macro that creates a test asserting that a value returned from the session is correct. + # The given string is evaled to produce the resulting redirect path. All of the instance variables + # set by the controller are available to the evaled string. + # Example: + # + # should_set_session(:user_id) { '@user.id' } + # should_set_session(:message) { "Free stuff" } + def should_set_session(key, expected = nil, &block) + matcher = set_session(key) + if expected + warn "[DEPRECATION] should_set_session :key, 'val' is deprecated. " << + "Use should_set_session(:key) { 'val' } instead." + end + should matcher.description do + if expected + instantiate_variables_from_assigns do + expected_value = eval(expected, + self.send(:binding), + __FILE__, + __LINE__) + matcher = matcher.to(expected_value) + end + else + expected_value = instance_eval(&block) + matcher = matcher.to(expected_value) + end + assert_accepts matcher, @controller + end + end + + # Deprecated. See should_set_session + def should_return_from_session(key, expected) + warn "[DEPRECATION] should_require_attributes is deprecated. " << + "Use should_set_session instead." + should_set_session(key, expected) + end + + # Macro that creates a test asserting that the controller rendered the given template. + # Example: + # + # should_render_template :new + def should_render_template(template) + should "render template #{template.inspect}" do + assert_template template.to_s + end + end + + # Macro that creates a test asserting that the controller rendered with the given layout. + # Example: + # + # should_render_with_layout 'special' + def should_render_with_layout(expected_layout = 'application') + matcher = render_with_layout(expected_layout) + if expected_layout + should matcher.description do + assert_accepts matcher, @controller + end + else + should "render without layout" do + assert_rejects matcher, @controller + end + end + end + + # Macro that creates a test asserting that the controller rendered without a layout. + # Same as @should_render_with_layout false@ + def should_render_without_layout + should_render_with_layout nil + end + + # Macro that creates a test asserting that the controller returned a redirect to the given path. + # The given string is evaled to produce the resulting redirect path. All of the instance variables + # set by the controller are available to the evaled string. + # Example: + # + # should_redirect_to("the user's profile") { user_url(@user) } + def should_redirect_to(description, &block) + unless block + warn "[DEPRECATION] should_redirect_to without a block is " << + "deprecated. Use should_redirect_to('somewhere') { } instead." + end + should "redirect to #{description}" do + if block + url = instance_eval(&block) + else + instantiate_variables_from_assigns do + url = eval(description, self.send(:binding), __FILE__, __LINE__) + end + end + assert_redirected_to url + end + end + + # Macro that creates a routing test. It tries to use the given HTTP + # +method+ on the given +path+, and asserts that it routes to the + # given +options+. + # + # If you don't specify a :controller, it will try to guess the controller + # based on the current test. + # + # +to_param+ is called on the +options+ given. + # + # Examples: + # + # should_route :get, "/posts", :controller => :posts, :action => :index + # should_route :get, "/posts/new", :action => :new + # should_route :post, "/posts", :action => :create + # should_route :get, "/posts/1", :action => :show, :id => 1 + # should_route :edit, "/posts/1", :action => :show, :id => 1 + # should_route :put, "/posts/1", :action => :update, :id => 1 + # should_route :delete, "/posts/1", :action => :destroy, :id => 1 + # should_route :get, "/users/1/posts/1", + # :action => :show, :id => 1, :user_id => 1 + # + def should_route(method, path, options) + unless options[:controller] + options[:controller] = self.name.gsub(/ControllerTest$/, '').tableize + end + + matcher = route(method, path).to(options) + + should matcher.description do + assert_accepts matcher.in_context(self), self + end + end + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb new file mode 100644 index 0000000..c12f729 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers.rb @@ -0,0 +1,37 @@ +require 'shoulda/action_controller/matchers/assign_to_matcher' +require 'shoulda/action_controller/matchers/filter_param_matcher' +require 'shoulda/action_controller/matchers/set_the_flash_matcher' +require 'shoulda/action_controller/matchers/render_with_layout_matcher' +require 'shoulda/action_controller/matchers/respond_with_matcher' +require 'shoulda/action_controller/matchers/respond_with_content_type_matcher' +require 'shoulda/action_controller/matchers/set_session_matcher' +require 'shoulda/action_controller/matchers/route_matcher' + +module Shoulda # :nodoc: + module ActionController # :nodoc: + + # By using the macro helpers you can quickly and easily create concise and + # easy to read test suites. + # + # This code segment: + # + # describe UsersController, "on GET to show with a valid id" do + # before(:each) do + # get :show, :id => User.first.to_param + # end + # + # it { should assign_to(:user) } + # it { should respond_with(:success) } + # it { should render_template(:show) } + # it { should not_set_the_flash) } + # + # it "should do something else really cool" do + # assigns[:user].id.should == 1 + # end + # end + # + # Would produce 5 tests for the show action + module Matchers + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb new file mode 100644 index 0000000..dde864b --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/assign_to_matcher.rb @@ -0,0 +1,109 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures that the controller assigned to the named instance variable. + # + # Options: + # * with_kind_of - The expected class of the instance variable + # being checked. + # * with - The value that should be assigned. + # + # Example: + # + # it { should assign_to(:user) } + # it { should_not assign_to(:user) } + # it { should assign_to(:user).with_kind_of(User) } + # it { should assign_to(:user).with(@user) } + def assign_to(variable) + AssignToMatcher.new(variable) + end + + class AssignToMatcher # :nodoc: + + def initialize(variable) + @variable = variable.to_s + end + + def with_kind_of(expected_class) + @expected_class = expected_class + self + end + + def with(expected_value) + @expected_value = expected_value + self + end + + def matches?(controller) + @controller = controller + assigned_value? && kind_of_expected_class? && equal_to_expected_value? + end + + attr_reader :failure_message, :negative_failure_message + + def description + description = "assign @#{@variable}" + description << " with a kind of #{@expected_class}" if @expected_class + description + end + + private + + def assigned_value? + if assigned_value.nil? + @failure_message = + "Expected action to assign a value for @#{@variable}" + false + else + @negative_failure_message = + "Didn't expect action to assign a value for @#{@variable}, " << + "but it was assigned to #{assigned_value.inspect}" + true + end + end + + def kind_of_expected_class? + return true unless @expected_class + if assigned_value.kind_of?(@expected_class) + @negative_failure_message = + "Didn't expect action to assign a kind of #{@expected_class} " << + "for #{@variable}, but got one anyway" + true + else + @failure_message = + "Expected action to assign a kind of #{@expected_class} " << + "for #{@variable}, but got #{@variable.inspect} " << + "(#{@variable.class.name})" + false + end + end + + def equal_to_expected_value? + return true unless @expected_value + if @expected_value == assigned_value + @negative_failure_message = + "Didn't expect action to assign #{@expected_value.inspect} " << + "for #{@variable}, but got it anyway" + true + else + @failure_message = + "Expected action to assign #{@expected_value.inspect} " << + "for #{@variable}, but got #{assigned_value.inspect}" + false + end + end + + def assigned_value + assigns[@variable] + end + + def assigns + @controller.response.template.assigns + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb new file mode 100644 index 0000000..1e46896 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/filter_param_matcher.rb @@ -0,0 +1,57 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures that filter_parameter_logging is set for the specified key. + # + # Example: + # + # it { should filter_param(:password) } + def filter_param(key) + FilterParamMatcher.new(key) + end + + class FilterParamMatcher # :nodoc: + + def initialize(key) + @key = key.to_s + end + + def matches?(controller) + @controller = controller + filters_params? && filters_key? + end + + def failure_message + "Expected #{@key} to be filtered" + end + + def negative_failure_message + "Did not expect #{@key} to be filtered" + end + + def description + "filter #{@key}" + end + + private + + def filters_params? + @controller.respond_to?(:filter_parameters) + end + + def filters_key? + filtered_value == '[FILTERED]' + end + + def filtered_value + filtered = @controller.send(:filter_parameters, + @key.to_s => @key.to_s) + filtered[@key.to_s] + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb new file mode 100644 index 0000000..9ceb4e8 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb @@ -0,0 +1,81 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures that the controller rendered with the given layout. + # + # Example: + # + # it { should render_with_layout } + # it { should render_with_layout(:special) } + # it { should_not render_with_layout } + def render_with_layout(layout = nil) + RenderWithLayout.new(layout) + end + + class RenderWithLayout # :nodoc: + + def initialize(layout) + @layout = layout.to_s unless layout.nil? + end + + def matches?(controller) + @controller = controller + rendered_with_layout? && rendered_with_expected_layout? + end + + def failure_message + "Expected #{expectation}, but #{result}" + end + + def negative_failure_message + "Did not expect #{expectation}, but #{result}" + end + + def description + description = "render with " + if @layout.nil? + description << "a layout" + else + description << "the #{@layout.inspect} layout" + end + description + end + + private + + def rendered_with_layout? + !layout.blank? + end + + def rendered_with_expected_layout? + return true if @layout.nil? + layout == @layout + end + + def layout + layout = @controller.response.layout + if layout.nil? + nil + else + layout.split('/').last + end + end + + def expectation + "to #{description}" + end + + def result + if rendered_with_layout? + "rendered with the #{layout.inspect} layout" + else + "rendered without a layout" + end + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb new file mode 100644 index 0000000..c47dba3 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb @@ -0,0 +1,70 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures a controller responded with expected 'response' content type. + # + # You can pass an explicit content type such as 'application/rss+xml' + # or its symbolic equivalent :rss + # or a regular expression such as /rss/ + # + # Example: + # + # it { should respond_with_content_type(:xml) } + # it { should respond_with_content_type(:csv) } + # it { should respond_with_content_type(:atom) } + # it { should respond_with_content_type(:yaml) } + # it { should respond_with_content_type(:text) } + # it { should respond_with_content_type('application/rss+xml') } + # it { should respond_with_content_type(/json/) } + def respond_with_content_type(content_type) + RespondWithContentTypeMatcher.new(content_type) + end + + class RespondWithContentTypeMatcher # :nodoc: + + def initialize(content_type) + @content_type = if content_type.is_a?(Symbol) + lookup_by_extension(content_type) + else + content_type + end + end + + def matches?(controller) + @controller = controller + if @content_type.is_a?(Regexp) + response_content_type =~ @content_type + else + response_content_type == @content_type + end + end + + def failure_message + "Expected #{expectation}" + end + + def negative_failure_message + "Did not expect #{expectation}" + end + + protected + + def response_content_type + @controller.response.content_type + end + + def lookup_by_extension(extension) + Mime::Type.lookup_by_extension(extension.to_s).to_s + end + + def expectation + "content type to be #{@content_type}, " << + "but was #{response_content_type}" + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb new file mode 100644 index 0000000..8c61384 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/respond_with_matcher.rb @@ -0,0 +1,81 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures a controller responded with expected 'response' status code. + # + # You can pass an explicit status number like 200, 301, 404, 500 + # or its symbolic equivalent :success, :redirect, :missing, :error. + # See ActionController::StatusCodes for a full list. + # + # Example: + # + # it { should respond_with(:success) } + # it { should respond_with(:redirect) } + # it { should respond_with(:missing) } + # it { should respond_with(:error) } + # it { should respond_with(501) } + def respond_with(status) + RespondWithMatcher.new(status) + end + + class RespondWithMatcher # :nodoc: + + def initialize(status) + @status = symbol_to_status_code(status) + end + + def matches?(controller) + @controller = controller + correct_status_code? || correct_status_code_range? + end + + def failure_message + "Expected #{expectation}" + end + + def negative_failure_message + "Did not expect #{expectation}" + end + + def description + "respond with #{@status}" + end + + protected + + def correct_status_code? + response_code == @status + end + + def correct_status_code_range? + @status.is_a?(Range) && + @status.include?(response_code) + end + + def response_code + @controller.response.response_code + end + + def symbol_to_status_code(potential_symbol) + case potential_symbol + when :success then 200 + when :redirect then 300..399 + when :missing then 404 + when :error then 500..599 + when Symbol + ::ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE[potential_symbol] + else + potential_symbol + end + end + + def expectation + "response to be a #{@status}, but was #{response_code}" + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb new file mode 100644 index 0000000..fe8e2b6 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/route_matcher.rb @@ -0,0 +1,93 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures that requesting +path+ using +method+ routes to +options+. + # + # If you don't specify a controller, it will use the controller from the + # example group. + # + # +to_param+ is called on the +options+ given. + # + # Examples: + # + # it { should route(:get, "/posts"). + # to(:controller => :posts, :action => :index) } + # it { should route(:get, "/posts/new").to(:action => :new) } + # it { should route(:post, "/posts").to(:action => :create) } + # it { should route(:get, "/posts/1").to(:action => :show, :id => 1) } + # it { should route(:edit, "/posts/1").to(:action => :show, :id => 1) } + # it { should route(:put, "/posts/1").to(:action => :update, :id => 1) } + # it { should route(:delete, "/posts/1"). + # to(:action => :destroy, :id => 1) } + # it { should route(:get, "/users/1/posts/1"). + # to(:action => :show, :id => 1, :user_id => 1) } + def route(method, path) + RouteMatcher.new(method, path, self) + end + + class RouteMatcher # :nodoc: + + def initialize(method, path, context) + @method = method + @path = path + @context = context + end + + def to(params) + @params = params + self + end + + def in_context(context) + @context = context + self + end + + def matches?(controller) + @controller = controller + guess_controller! + stringify_params! + route_recognized? + end + + attr_reader :failure_message, :negative_failure_message + + def description + "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}" + end + + private + + def guess_controller! + @params[:controller] ||= @controller.controller_path + end + + def stringify_params! + @params.each do |key, value| + @params[key] = value.to_param + end + end + + def route_recognized? + begin + @context.send(:assert_routing, + { :method => @method, :path => @path }, + @params) + + @negative_failure_message = "Didn't expect to #{description}" + true + rescue ::ActionController::RoutingError => error + @failure_message = error.message + false + rescue Test::Unit::AssertionFailedError => error + @failure_message = error.message + false + end + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb new file mode 100644 index 0000000..c1a823b --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_session_matcher.rb @@ -0,0 +1,87 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures that a session key was set to the expected value. + # + # Example: + # + # it { should set_session(:message) } + # it { should set_session(:user_id).to(@user.id) } + # it { should_not set_session(:user_id) } + def set_session(key) + SetSessionMatcher.new(key) + end + + class SetSessionMatcher # :nodoc: + + def initialize(key) + @key = key.to_s + end + + def to(value) + @value = value + self + end + + def matches?(controller) + @controller = controller + (assigned_value? && assigned_correct_value?) || cleared_value? + end + + def failure_message + "Expected #{expectation}, but #{result}" + end + + def negative_failure_message + "Didn't expect #{expectation}, but #{result}" + end + + def description + description = "set session variable #{@key.inspect}" + description << " to #{@value.inspect}" if defined?(@value) + description + end + + private + + def assigned_value? + !assigned_value.blank? + end + + def cleared_value? + defined?(@value) && @value.nil? && assigned_value.nil? + end + + def assigned_correct_value? + return true if @value.nil? + assigned_value == @value + end + + def assigned_value + session[@key] + end + + def session + @controller.response.session.data + end + + def expectation + expectation = "session variable #{@key} to be set" + expectation << " to #{@value.inspect}" if @value + expectation + end + + def result + if session.empty? + "no session variables were set" + else + "the session was #{session.inspect}" + end + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb new file mode 100644 index 0000000..0964cc7 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb @@ -0,0 +1,85 @@ +module Shoulda # :nodoc: + module ActionController # :nodoc: + module Matchers + + # Ensures that the flash contains the given value. Can be a String, a + # Regexp, or nil (indicating that the flash should not be set). + # + # Example: + # + # it { should set_the_flash } + # it { should set_the_flash.to("Thank you for placing this order.") } + # it { should set_the_flash.to(/created/i) } + # it { should_not set_the_flash } + def set_the_flash + SetTheFlashMatcher.new + end + + class SetTheFlashMatcher # :nodoc: + + def to(value) + @value = value + self + end + + def matches?(controller) + @controller = controller + sets_the_flash? && string_value_matches? && regexp_value_matches? + end + + attr_reader :failure_message, :negative_failure_message + + def description + description = "set the flash" + description << " to #{@value.inspect}" unless @value.nil? + description + end + + def failure_message + "Expected #{expectation}" + end + + def negative_failure_message + "Did not expect #{expectation}" + end + + private + + def sets_the_flash? + !flash.blank? + end + + def string_value_matches? + return true unless String === @value + flash.values.any? {|value| value == @value } + end + + def regexp_value_matches? + return true unless Regexp === @value + flash.values.any? {|value| value =~ @value } + end + + def flash + @controller.response.session['flash'] + end + + def expectation + expectation = "the flash to be set" + expectation << " to #{@value.inspect}" unless @value.nil? + expectation << ", but #{flash_description}" + expectation + end + + def flash_description + if flash.blank? + "no flash was set" + else + "was #{flash.inspect}" + end + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb new file mode 100644 index 0000000..aca8b17 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_controller/resource_options.rb @@ -0,0 +1,233 @@ +module Shoulda # :nodoc: + module ActionController + # Formats tested by #should_be_restful. Defaults to [:html, :xml] + VALID_FORMATS = Dir.glob(File.join(File.dirname(__FILE__), 'formats', '*.rb')).map { |f| File.basename(f, '.rb') }.map(&:to_sym) # :doc: + VALID_FORMATS.each {|f| require "shoulda/action_controller/formats/#{f}"} + + # Actions tested by #should_be_restful + VALID_ACTIONS = [:index, :show, :new, :edit, :create, :update, :destroy] # :doc: + + # A ResourceOptions object is passed into should_be_restful in order to configure the tests for your controller. + # + # Example: + # class UsersControllerTest < Test::Unit::TestCase + # fixtures :all + # + # def setup + # ...normal setup code... + # @user = User.find(:first) + # end + # + # should_be_restful do |resource| + # resource.identifier = :id + # resource.klass = User + # resource.object = :user + # resource.parent = [] + # resource.actions = [:index, :show, :new, :edit, :update, :create, :destroy] + # resource.formats = [:html, :xml] + # + # resource.create.params = { :name => "bob", :email => 'bob@bob.com', :age => 13} + # resource.update.params = { :name => "sue" } + # + # resource.create.redirect = "user_url(@user)" + # resource.update.redirect = "user_url(@user)" + # resource.destroy.redirect = "users_url" + # + # resource.create.flash = /created/i + # resource.update.flash = /updated/i + # resource.destroy.flash = /removed/i + # end + # end + # + # Whenever possible, the resource attributes will be set to sensible defaults. + # + class ResourceOptions + # Configuration options for the create, update, destroy actions under should_be_restful + class ActionOptions + # String evaled to get the target of the redirection. + # All of the instance variables set by the controller will be available to the + # evaled code. + # + # Example: + # resource.create.redirect = "user_url(@user.company, @user)" + # + # Defaults to a generated url based on the name of the controller, the action, and the resource.parents list. + attr_accessor :redirect + + # String or Regexp describing a value expected in the flash. Will match against any flash key. + # + # Defaults: + # destroy:: /removed/ + # create:: /created/ + # update:: /updated/ + attr_accessor :flash + + # Hash describing the params that should be sent in with this action. + attr_accessor :params + end + + # Configuration options for the denied actions under should_be_restful + # + # Example: + # context "The public" do + # setup do + # @request.session[:logged_in] = false + # end + # + # should_be_restful do |resource| + # resource.parent = :user + # + # resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy] + # resource.denied.flash = /get outta here/i + # resource.denied.redirect = 'new_session_url' + # end + # end + # + class DeniedOptions + # String evaled to get the target of the redirection. + # All of the instance variables set by the controller will be available to the + # evaled code. + # + # Example: + # resource.create.redirect = "user_url(@user.company, @user)" + attr_accessor :redirect + + # String or Regexp describing a value expected in the flash. Will match against any flash key. + # + # Example: + # resource.create.flash = /created/ + attr_accessor :flash + + # Actions that should be denied (only used by resource.denied). Note that these actions will + # only be tested if they are also listed in +resource.actions+ + # The special value of :all will deny all of the REST actions. + attr_accessor :actions + end + + # Name of key in params that references the primary key. + # Will almost always be :id (default), unless you are using a plugin or have patched rails. + attr_accessor :identifier + + # Name of the ActiveRecord class this resource is responsible for. Automatically determined from + # test class if not explicitly set. UserTest => "User" + attr_accessor :klass + + # Name of the instantiated ActiveRecord object that should be used by some of the tests. + # Defaults to the underscored name of the AR class. CompanyManager => :company_manager + attr_accessor :object + + # Name of the parent AR objects. Can be set as parent= or parents=, and can take either + # the name of the parent resource (if there's only one), or an array of names (if there's + # more than one). + # + # Example: + # # in the routes... + # map.resources :companies do + # map.resources :people do + # map.resources :limbs + # end + # end + # + # # in the tests... + # class PeopleControllerTest < Test::Unit::TestCase + # should_be_restful do |resource| + # resource.parent = :companies + # end + # end + # + # class LimbsControllerTest < Test::Unit::TestCase + # should_be_restful do |resource| + # resource.parents = [:companies, :people] + # end + # end + attr_accessor :parent + alias parents parent + alias parents= parent= + + # Actions that should be tested. Must be a subset of VALID_ACTIONS (default). + # Tests for each actionw will only be generated if the action is listed here. + # The special value of :all will test all of the REST actions. + # + # Example (for a read-only controller): + # resource.actions = [:show, :index] + attr_accessor :actions + + # Formats that should be tested. Must be a subset of VALID_FORMATS (default). + # Each action will be tested against the formats listed here. The special value + # of :all will test all of the supported formats. + # + # Example: + # resource.actions = [:html, :xml] + attr_accessor :formats + + # ActionOptions object specifying options for the create action. + attr_accessor :create + + # ActionOptions object specifying options for the update action. + attr_accessor :update + + # ActionOptions object specifying options for the desrtoy action. + attr_accessor :destroy + + # DeniedOptions object specifying which actions should return deny a request, and what should happen in that case. + attr_accessor :denied + + def initialize # :nodoc: + @create = ActionOptions.new + @update = ActionOptions.new + @destroy = ActionOptions.new + @denied = DeniedOptions.new + + @create.flash ||= /created/i + @update.flash ||= /updated/i + @destroy.flash ||= /removed/i + @denied.flash ||= /denied/i + + @create.params ||= {} + @update.params ||= {} + + @actions = VALID_ACTIONS + @formats = VALID_FORMATS + @denied.actions = [] + end + + def normalize!(target) # :nodoc: + @denied.actions = VALID_ACTIONS if @denied.actions == :all + @actions = VALID_ACTIONS if @actions == :all + @formats = VALID_FORMATS if @formats == :all + + @denied.actions = @denied.actions.map(&:to_sym) + @actions = @actions.map(&:to_sym) + @formats = @formats.map(&:to_sym) + + ensure_valid_members(@actions, VALID_ACTIONS, 'actions') + ensure_valid_members(@denied.actions, VALID_ACTIONS, 'denied.actions') + ensure_valid_members(@formats, VALID_FORMATS, 'formats') + + @identifier ||= :id + @klass ||= target.name.gsub(/ControllerTest$/, '').singularize.constantize + @object ||= @klass.name.tableize.singularize + @parent ||= [] + @parent = [@parent] unless @parent.is_a? Array + + collection_helper = [@parent, @object.to_s.pluralize, 'url'].flatten.join('_') + collection_args = @parent.map {|n| "@#{object}.#{n}"}.join(', ') + @destroy.redirect ||= "#{collection_helper}(#{collection_args})" + + member_helper = [@parent, @object, 'url'].flatten.join('_') + member_args = [@parent.map {|n| "@#{object}.#{n}"}, "@#{object}"].flatten.join(', ') + @create.redirect ||= "#{member_helper}(#{member_args})" + @update.redirect ||= "#{member_helper}(#{member_args})" + @denied.redirect ||= "new_session_url" + end + + private + + def ensure_valid_members(ary, valid_members, name) # :nodoc: + invalid = ary - valid_members + raise ArgumentError, "Unsupported #{name}: #{invalid.inspect}" unless invalid.empty? + end + end + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb new file mode 100644 index 0000000..f6195f2 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer.rb @@ -0,0 +1,10 @@ +require 'shoulda' +require 'shoulda/action_mailer/assertions' + +module Test # :nodoc: all + module Unit + class TestCase + include Shoulda::ActionMailer::Assertions + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb new file mode 100644 index 0000000..153d079 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_mailer/assertions.rb @@ -0,0 +1,38 @@ +module Shoulda # :nodoc: + module ActionMailer # :nodoc: + module Assertions + # Asserts that an email was delivered. Can take a block that can further + # narrow down the types of emails you're expecting. + # + # assert_sent_email + # + # Passes if ActionMailer::Base.deliveries has an email + # + # assert_sent_email do |email| + # email.subject =~ /hi there/ && email.to.include?('none@none.com') + # end + # + # Passes if there is an email with subject containing 'hi there' and + # 'none@none.com' as one of the recipients. + # + def assert_sent_email + emails = ::ActionMailer::Base.deliveries + assert !emails.empty?, "No emails were sent" + if block_given? + matching_emails = emails.select {|email| yield email } + assert !matching_emails.empty?, "None of the emails matched." + end + end + + # Asserts that no ActionMailer mails were delivered + # + # assert_did_not_send_email + def assert_did_not_send_email + msg = "Sent #{::ActionMailer::Base.deliveries.size} emails.\n" + ::ActionMailer::Base.deliveries.each { |m| msg << " '#{m.subject}' sent to #{m.to.to_sentence}\n" } + assert ::ActionMailer::Base.deliveries.empty?, msg + end + end + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb new file mode 100644 index 0000000..2615b63 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view.rb @@ -0,0 +1,10 @@ +require 'shoulda' +require 'shoulda/action_view/macros' + +module Test # :nodoc: all + module Unit + class TestCase + extend Shoulda::ActionView::Macros + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb new file mode 100644 index 0000000..7157bd0 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/action_view/macros.rb @@ -0,0 +1,56 @@ +module Shoulda # :nodoc: + module ActionView # :nodoc: + # = Macro test helpers for your view + # + # By using the macro helpers you can quickly and easily create concise and + # easy to read test suites. + # + # This code segment: + # context "on GET to :new" do + # setup do + # get :new + # end + # + # should_render_a_form + # should_render_page_with_metadata :title => /index/ + # + # should "do something else really cool" do + # assert_select '#really_cool' + # end + # end + # + # Would produce 3 tests for the +show+ action + module Macros + + # Macro that creates a test asserting that the rendered view contains a
      element. + def should_render_a_form + should "display a form" do + assert_select "form", true, "The template doesn't contain a element" + end + end + + # Macro that creates a test asserting that the rendered view contains the selected metatags. + # Values can be string or Regexps. + # Example: + # + # should_render_page_with_metadata :description => "Description of this page", :keywords => /post/ + # + # You can also use this method to test the rendered views title. + # + # Example: + # should_render_page_with_metadata :title => /index/ + def should_render_page_with_metadata(options) + options.each do |key, value| + should "have metatag #{key}" do + if key.to_sym == :title + assert_select "title", value + else + assert_select "meta[name=?][content#{"*" if value.is_a?(Regexp)}=?]", key, value + end + end + end + end + end + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb new file mode 100644 index 0000000..c379282 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record.rb @@ -0,0 +1,16 @@ +require 'shoulda' +require 'shoulda/active_record/helpers' +require 'shoulda/active_record/matchers' +require 'shoulda/active_record/assertions' +require 'shoulda/active_record/macros' + +module Test # :nodoc: all + module Unit + class TestCase + include Shoulda::ActiveRecord::Helpers + include Shoulda::ActiveRecord::Matchers + include Shoulda::ActiveRecord::Assertions + extend Shoulda::ActiveRecord::Macros + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb new file mode 100644 index 0000000..9730fe1 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/assertions.rb @@ -0,0 +1,69 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Assertions + # Asserts that the given object can be saved + # + # assert_save User.new(params) + def assert_save(obj) + assert obj.save, "Errors: #{pretty_error_messages obj}" + obj.reload + end + + # Asserts that the given object is valid + # + # assert_valid User.new(params) + def assert_valid(obj) + assert obj.valid?, "Errors: #{pretty_error_messages obj}" + end + + # Asserts that an Active Record model validates with the passed + # value by making sure the error_message_to_avoid is not + # contained within the list of errors for that attribute. + # + # assert_good_value(User.new, :email, "user@example.com") + # assert_good_value(User.new, :ssn, "123456789", /length/) + # + # If a class is passed as the first argument, a new object will be + # instantiated before the assertion. If an instance variable exists with + # the same name as the class (underscored), that object will be used + # instead. + # + # assert_good_value(User, :email, "user@example.com") + # + # @product = Product.new(:tangible => false) + # assert_good_value(Product, :price, "0") + def assert_good_value(object_or_klass, attribute, value, error_message_to_avoid = nil) + object = get_instance_of(object_or_klass) + matcher = allow_value(value). + for(attribute). + with_message(error_message_to_avoid) + assert_accepts(matcher, object) + end + + # Asserts that an Active Record model invalidates the passed + # value by making sure the error_message_to_expect is + # contained within the list of errors for that attribute. + # + # assert_bad_value(User.new, :email, "invalid") + # assert_bad_value(User.new, :ssn, "123", /length/) + # + # If a class is passed as the first argument, a new object will be + # instantiated before the assertion. If an instance variable exists with + # the same name as the class (underscored), that object will be used + # instead. + # + # assert_bad_value(User, :email, "invalid") + # + # @product = Product.new(:tangible => true) + # assert_bad_value(Product, :price, "0") + def assert_bad_value(object_or_klass, attribute, value, + error_message_to_expect = nil) + object = get_instance_of(object_or_klass) + matcher = allow_value(value). + for(attribute). + with_message(error_message_to_expect) + assert_rejects(matcher, object) + end + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb new file mode 100644 index 0000000..26799c1 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/helpers.rb @@ -0,0 +1,40 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Helpers + def pretty_error_messages(obj) # :nodoc: + obj.errors.map do |a, m| + msg = "#{a} #{m}" + msg << " (#{obj.send(a).inspect})" unless a.to_sym == :base + end + end + + def get_instance_of(object_or_klass) + if object_or_klass.is_a?(Class) + klass = object_or_klass + instance_variable_get("@#{instance_variable_name_for(klass)}") || klass.new + else + object_or_klass + end + end + + def instance_variable_name_for(klass) + klass.to_s.split('::').last.underscore + end + + # Helper method that determines the default error message used by Active + # Record. Works for both existing Rails 2.1 and Rails 2.2 with the newly + # introduced I18n module used for localization. + # + # default_error_message(:blank) + # default_error_message(:too_short, :count => 5) + # default_error_message(:too_long, :count => 60) + def default_error_message(key, values = {}) + if Object.const_defined?(:I18n) # Rails >= 2.2 + I18n.translate("activerecord.errors.messages.#{key}", values) + else # Rails <= 2.1.x + ::ActiveRecord::Errors.default_error_messages[key] % values[:count] + end + end + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb new file mode 100644 index 0000000..231ca20 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/macros.rb @@ -0,0 +1,589 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + # = Macro test helpers for your active record models + # + # These helpers will test most of the validations and associations for your ActiveRecord models. + # + # class UserTest < Test::Unit::TestCase + # should_validate_presence_of :name, :phone_number + # should_not_allow_values_for :phone_number, "abcd", "1234" + # should_allow_values_for :phone_number, "(123) 456-7890" + # + # should_not_allow_mass_assignment_of :password + # + # should_have_one :profile + # should_have_many :dogs + # should_have_many :messes, :through => :dogs + # should_belong_to :lover + # end + # + # For all of these helpers, the last parameter may be a hash of options. + # + module Macros + include Helpers + include Matchers + + # Ensures that the model cannot be saved if one of the attributes listed is not present. + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.blank') + # + # Example: + # should_validate_presence_of :name, :phone_number + # + def should_validate_presence_of(*attributes) + message = get_options!(attributes, :message) + klass = model_class + + attributes.each do |attribute| + matcher = validate_presence_of(attribute).with_message(message) + should matcher.description do + assert_accepts(matcher, get_instance_of(klass)) + end + end + end + + # Deprecated. See should_validate_presence_of + def should_require_attributes(*attributes) + warn "[DEPRECATION] should_require_attributes is deprecated. " << + "Use should_validate_presence_of instead." + should_validate_presence_of(*attributes) + end + + # Ensures that the model cannot be saved if one of the attributes listed is not unique. + # Requires an existing record + # + # Options: + + # * :message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.taken') + # * :scoped_to - field(s) to scope the uniqueness to. + # * :case_sensitive - whether or not uniqueness is defined by an + # exact match. Ignored by non-text attributes. Default = true + # + # Examples: + # should_validate_uniqueness_of :keyword, :username + # should_validate_uniqueness_of :name, :message => "O NOES! SOMEONE STOELED YER NAME!" + # should_validate_uniqueness_of :email, :scoped_to => :name + # should_validate_uniqueness_of :address, :scoped_to => [:first_name, :last_name] + # should_validate_uniqueness_of :email, :case_sensitive => false + # + def should_validate_uniqueness_of(*attributes) + message, scope, case_sensitive = get_options!(attributes, :message, :scoped_to, :case_sensitive) + scope = [*scope].compact + case_sensitive = true if case_sensitive.nil? + + klass = model_class + + attributes.each do |attribute| + matcher = validate_uniqueness_of(attribute). + with_message(message).scoped_to(scope) + matcher = matcher.case_insensitive unless case_sensitive + should matcher.description do + assert_accepts(matcher, get_instance_of(klass)) + end + end + end + + # Deprecated. See should_validate_uniqueness_of + def should_require_unique_attributes(*attributes) + warn "[DEPRECATION] should_require_unique_attributes is deprecated. " << + "Use should_validate_uniqueness_of instead." + should_validate_uniqueness_of(*attributes) + end + + # Ensures that the attribute can be set on mass update. + # + # should_allow_mass_assignment_of :first_name, :last_name + # + def should_allow_mass_assignment_of(*attributes) + get_options!(attributes) + klass = model_class + + attributes.each do |attribute| + matcher = allow_mass_assignment_of(attribute) + should matcher.description do + assert_accepts matcher, klass.new + end + end + end + + # Ensures that the attribute cannot be set on mass update. + # + # should_not_allow_mass_assignment_of :password, :admin_flag + # + def should_not_allow_mass_assignment_of(*attributes) + get_options!(attributes) + klass = model_class + + attributes.each do |attribute| + matcher = allow_mass_assignment_of(attribute) + should "not #{matcher.description}" do + assert_rejects matcher, klass.new + end + end + end + + # Deprecated. See should_not_allow_mass_assignment_of + def should_protect_attributes(*attributes) + warn "[DEPRECATION] should_protect_attributes is deprecated. " << + "Use should_not_allow_mass_assignment_of instead." + should_not_allow_mass_assignment_of(*attributes) + end + + # Ensures that the attribute cannot be changed once the record has been created. + # + # should_have_readonly_attributes :password, :admin_flag + # + def should_have_readonly_attributes(*attributes) + get_options!(attributes) + klass = model_class + + attributes.each do |attribute| + matcher = have_readonly_attribute(attribute) + should matcher.description do + assert_accepts matcher, klass.new + end + end + end + + # Ensures that the attribute cannot be set to the given values + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.invalid') + # + # Example: + # should_not_allow_values_for :isbn, "bad 1", "bad 2" + # + def should_not_allow_values_for(attribute, *bad_values) + message = get_options!(bad_values, :message) + klass = model_class + bad_values.each do |value| + matcher = allow_value(value).for(attribute).with_message(message) + should "not #{matcher.description}" do + assert_rejects matcher, get_instance_of(klass) + end + end + end + + # Ensures that the attribute can be set to the given values. + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Example: + # should_allow_values_for :isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0" + # + def should_allow_values_for(attribute, *good_values) + get_options!(good_values) + klass = model_class + klass = model_class + good_values.each do |value| + matcher = allow_value(value).for(attribute) + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + end + + # Ensures that the length of the attribute is in the given range + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :short_message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.too_short') % range.first + # * :long_message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.too_long') % range.last + # + # Example: + # should_ensure_length_in_range :password, (6..20) + # + def should_ensure_length_in_range(attribute, range, opts = {}) + short_message, long_message = get_options!([opts], + :short_message, + :long_message) + klass = model_class + + matcher = ensure_length_of(attribute). + is_at_least(range.first). + with_short_message(short_message). + is_at_most(range.last). + with_long_message(long_message) + + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + + # Ensures that the length of the attribute is at least a certain length + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :short_message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.too_short') % min_length + # + # Example: + # should_ensure_length_at_least :name, 3 + # + def should_ensure_length_at_least(attribute, min_length, opts = {}) + short_message = get_options!([opts], :short_message) + klass = model_class + + matcher = ensure_length_of(attribute). + is_at_least(min_length). + with_short_message(short_message) + + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + + # Ensures that the length of the attribute is exactly a certain length + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.wrong_length') % length + # + # Example: + # should_ensure_length_is :ssn, 9 + # + def should_ensure_length_is(attribute, length, opts = {}) + message = get_options!([opts], :message) + klass = model_class + matcher = ensure_length_of(attribute). + is_equal_to(length). + with_message(message) + + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + + # Ensure that the attribute is in the range specified + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :low_message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.inclusion') + # * :high_message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.inclusion') + # + # Example: + # should_ensure_value_in_range :age, (0..100) + # + def should_ensure_value_in_range(attribute, range, opts = {}) + message, low_message, high_message = get_options!([opts], + :message, + :low_message, + :high_message) + klass = model_class + matcher = ensure_inclusion_of(attribute). + in_range(range). + with_message(message). + with_low_message(low_message). + with_high_message(high_message) + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + + # Ensure that the attribute is numeric + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.not_a_number') + # + # Example: + # should_validate_numericality_of :age + # + def should_validate_numericality_of(*attributes) + message = get_options!(attributes, :message) + klass = model_class + attributes.each do |attribute| + matcher = validate_numericality_of(attribute). + with_message(message) + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + end + + # Deprecated. See should_validate_numericality_of + def should_only_allow_numeric_values_for(*attributes) + warn "[DEPRECATION] should_only_allow_numeric_values_for is " << + "deprecated. Use should_validate_numericality_of instead." + should_validate_numericality_of(*attributes) + end + + # Ensures that the has_many relationship exists. Will also test that the + # associated table has the required columns. Works with polymorphic + # associations. + # + # Options: + # * :through - association name for has_many :through + # * :dependent - tests that the association makes use of the dependent option. + # + # Example: + # should_have_many :friends + # should_have_many :enemies, :through => :friends + # should_have_many :enemies, :dependent => :destroy + # + def should_have_many(*associations) + through, dependent = get_options!(associations, :through, :dependent) + klass = model_class + associations.each do |association| + matcher = have_many(association).through(through).dependent(dependent) + should matcher.description do + assert_accepts(matcher, klass.new) + end + end + end + + # Ensure that the has_one relationship exists. Will also test that the + # associated table has the required columns. Works with polymorphic + # associations. + # + # Options: + # * :dependent - tests that the association makes use of the dependent option. + # + # Example: + # should_have_one :god # unless hindu + # + def should_have_one(*associations) + dependent = get_options!(associations, :dependent) + klass = model_class + associations.each do |association| + matcher = have_one(association).dependent(dependent) + should matcher.description do + assert_accepts(matcher, klass.new) + end + end + end + + # Ensures that the has_and_belongs_to_many relationship exists, and that the join + # table is in place. + # + # should_have_and_belong_to_many :posts, :cars + # + def should_have_and_belong_to_many(*associations) + get_options!(associations) + klass = model_class + + associations.each do |association| + matcher = have_and_belong_to_many(association) + should matcher.description do + assert_accepts(matcher, klass.new) + end + end + end + + # Ensure that the belongs_to relationship exists. + # + # should_belong_to :parent + # + def should_belong_to(*associations) + dependent = get_options!(associations, :dependent) + klass = model_class + associations.each do |association| + matcher = belong_to(association).dependent(dependent) + should matcher.description do + assert_accepts(matcher, klass.new) + end + end + end + + # Ensure that the given class methods are defined on the model. + # + # should_have_class_methods :find, :destroy + # + def should_have_class_methods(*methods) + get_options!(methods) + klass = model_class + methods.each do |method| + should "respond to class method ##{method}" do + assert_respond_to klass, method, "#{klass.name} does not have class method #{method}" + end + end + end + + # Ensure that the given instance methods are defined on the model. + # + # should_have_instance_methods :email, :name, :name= + # + def should_have_instance_methods(*methods) + get_options!(methods) + klass = model_class + methods.each do |method| + should "respond to instance method ##{method}" do + assert_respond_to klass.new, method, "#{klass.name} does not have instance method #{method}" + end + end + end + + # Ensure that the given columns are defined on the models backing SQL table. + # Also aliased to should_have_index for readability. + # Takes the same options available in migrations: + # :type, :precision, :limit, :default, :null, and :scale + # + # Examples: + # + # should_have_db_columns :id, :email, :name, :created_at + # + # should_have_db_column :email, :type => "string", :limit => 255 + # should_have_db_column :salary, :decimal, :precision => 15, :scale => 2 + # should_have_db_column :admin, :default => false, :null => false + # + def should_have_db_columns(*columns) + column_type, precision, limit, default, null, scale, sql_type = + get_options!(columns, :type, :precision, :limit, + :default, :null, :scale, :sql_type) + klass = model_class + columns.each do |name| + matcher = have_db_column(name). + of_type(column_type). + with_options(:precision => precision, :limit => limit, + :default => default, :null => null, + :scale => scale, :sql_type => sql_type) + should matcher.description do + assert_accepts(matcher, klass.new) + end + end + end + + alias_method :should_have_db_column, :should_have_db_columns + + # Ensures that there are DB indices on the given columns or tuples of columns. + # Also aliased to should_have_index for readability + # + # Options: + # * :unique - whether or not the index has a unique + # constraint. Use true to explicitly test for a unique + # constraint. Use false to explicitly test for a non-unique + # constraint. Use nil if you don't care whether the index is + # unique or not. Default = nil + # + # Examples: + # + # should_have_indices :email, :name, [:commentable_type, :commentable_id] + # should_have_index :age + # should_have_index :ssn, :unique => true + # + def should_have_indices(*columns) + unique = get_options!(columns, :unique) + klass = model_class + + columns.each do |column| + matcher = have_index(column).unique(unique) + should matcher.description do + assert_accepts(matcher, klass.new) + end + end + end + + alias_method :should_have_index, :should_have_indices + + # Ensures that the model cannot be saved if one of the attributes listed is not accepted. + # + # If an instance variable has been created in the setup named after the + # model being tested, then this method will use that. Otherwise, it will + # create a new instance to test against. + # + # Options: + # * :message - value the test expects to find in errors.on(:attribute). + # Regexp or string. Default = I18n.translate('activerecord.errors.messages.accepted') + # + # Example: + # should_validate_acceptance_of :eula + # + def should_validate_acceptance_of(*attributes) + message = get_options!(attributes, :message) + klass = model_class + + attributes.each do |attribute| + matcher = validate_acceptance_of(attribute).with_message(message) + should matcher.description do + assert_accepts matcher, get_instance_of(klass) + end + end + end + + # Deprecated. See should_validate_uniqueness_of + def should_require_acceptance_of(*attributes) + warn "[DEPRECATION] should_require_acceptance_of is deprecated. " << + "Use should_validate_acceptance_of instead." + should_validate_acceptance_of(*attributes) + end + + # Ensures that the model has a method named scope_name that returns a NamedScope object with the + # proxy options set to the options you supply. scope_name can be either a symbol, or a method + # call which will be evaled against the model. The eval'd method call has access to all the same + # instance variables that a should statement would. + # + # Options: Any of the options that the named scope would pass on to find. + # + # Example: + # + # should_have_named_scope :visible, :conditions => {:visible => true} + # + # Passes for + # + # named_scope :visible, :conditions => {:visible => true} + # + # Or for + # + # def self.visible + # scoped(:conditions => {:visible => true}) + # end + # + # You can test lambdas or methods that return ActiveRecord#scoped calls: + # + # should_have_named_scope 'recent(5)', :limit => 5 + # should_have_named_scope 'recent(1)', :limit => 1 + # + # Passes for + # named_scope :recent, lambda {|c| {:limit => c}} + # + # Or for + # + # def self.recent(c) + # scoped(:limit => c) + # end + # + def should_have_named_scope(scope_call, find_options = nil) + klass = model_class + matcher = have_named_scope(scope_call).finding(find_options) + should matcher.description do + assert_accepts matcher.in_context(self), klass.new + end + end + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb new file mode 100644 index 0000000..69b35ba --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers.rb @@ -0,0 +1,42 @@ +require 'shoulda/active_record/helpers' +require 'shoulda/active_record/matchers/validation_matcher' +require 'shoulda/active_record/matchers/allow_value_matcher' +require 'shoulda/active_record/matchers/ensure_length_of_matcher' +require 'shoulda/active_record/matchers/ensure_inclusion_of_matcher' +require 'shoulda/active_record/matchers/validate_presence_of_matcher' +require 'shoulda/active_record/matchers/validate_uniqueness_of_matcher' +require 'shoulda/active_record/matchers/validate_acceptance_of_matcher' +require 'shoulda/active_record/matchers/validate_numericality_of_matcher' +require 'shoulda/active_record/matchers/association_matcher' +require 'shoulda/active_record/matchers/have_db_column_matcher' +require 'shoulda/active_record/matchers/have_index_matcher' +require 'shoulda/active_record/matchers/have_readonly_attribute_matcher' +require 'shoulda/active_record/matchers/allow_mass_assignment_of_matcher' +require 'shoulda/active_record/matchers/have_named_scope_matcher' + + +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + # = Matchers for your active record models + # + # These matchers will test most of the validations and associations for your + # ActiveRecord models. + # + # describe User do + # it { should validate_presence_of(:name) } + # it { should validate_presence_of(:phone_number) } + # %w(abcd 1234).each do |value| + # it { should_not allow_value(value).for(:phone_number) } + # end + # it { should allow_value("(123) 456-7890").for(:phone_number) } + # it { should_not allow_mass_assignment_of(:password) } + # it { should have_one(:profile) } + # it { should have_many(:dogs) } + # it { should have_many(:messes).through(:dogs) } + # it { should belong_to(:lover) } + # end + # + module Matchers + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb new file mode 100644 index 0000000..fab6b64 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb @@ -0,0 +1,83 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the attribute can be set on mass update. + # + # it { should_not allow_mass_assignment_of(:password) } + # it { should allow_mass_assignment_of(:first_name) } + # + def allow_mass_assignment_of(value) + AllowMassAssignmentOfMatcher.new(value) + end + + class AllowMassAssignmentOfMatcher # :nodoc: + + def initialize(attribute) + @attribute = attribute.to_s + end + + def matches?(subject) + @subject = subject + if attr_mass_assignable? + if whitelisting? + @failure_message = "#{@attribute} was made accessible" + else + if protected_attributes.empty? + @failure_message = "no attributes were protected" + else + @failure_message = "#{class_name} is protecting " << + "#{protected_attributes.to_a.to_sentence}, " << + "but not #{@attribute}." + end + end + true + else + if whitelisting? + @negative_failure_message = + "Expected #{@attribute} to be accessible" + else + @negative_failure_message = + "Did not expect #{@attribute} to be protected" + end + false + end + end + + attr_reader :failure_message, :negative_failure_message + + def description + "protect #{@attribute} from mass updates" + end + + private + + def protected_attributes + @protected_attributes ||= (@subject.class.protected_attributes || []) + end + + def accessible_attributes + @accessible_attributes ||= (@subject.class.accessible_attributes || []) + end + + def whitelisting? + !accessible_attributes.empty? + end + + def attr_mass_assignable? + if whitelisting? + accessible_attributes.include?(@attribute) + else + !protected_attributes.include?(@attribute) + end + end + + def class_name + @subject.class.name + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb new file mode 100644 index 0000000..3402602 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/allow_value_matcher.rb @@ -0,0 +1,102 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the attribute can be set to the given value. + # + # Options: + # * with_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :invalid. + # + # Example: + # it { should_not allow_value('bad').for(:isbn) } + # it { should allow_value("isbn 1 2345 6789 0").for(:isbn) } + # + def allow_value(value) + AllowValueMatcher.new(value) + end + + class AllowValueMatcher # :nodoc: + include Helpers + + def initialize(value) + @value = value + end + + def for(attribute) + @attribute = attribute + self + end + + def with_message(message) + @expected_message = message if message + self + end + + def matches?(instance) + @instance = instance + @expected_message ||= :invalid + if Symbol === @expected_message + @expected_message = default_error_message(@expected_message) + end + @instance.send("#{@attribute}=", @value) + !errors_match? + end + + def failure_message + "Did not expect #{expectation}, got error: #{@matched_error}" + end + + def negative_failure_message + "Expected #{expectation}, got #{error_description}" + end + + def description + "allow #{@attribute} to be set to #{@value.inspect}" + end + + private + + def errors_match? + @instance.valid? + @errors = @instance.errors.on(@attribute) + @errors = [@errors] unless @errors.is_a?(Array) + errors_match_regexp? || errors_match_string? + end + + def errors_match_regexp? + if Regexp === @expected_message + @matched_error = @errors.detect { |e| e =~ @expected_message } + !@matched_error.nil? + else + false + end + end + + def errors_match_string? + if @errors.include?(@expected_message) + @matched_error = @expected_message + true + else + false + end + end + + def expectation + "errors to include #{@expected_message.inspect} " << + "when #{@attribute} is set to #{@value.inspect}" + end + + def error_description + if @instance.errors.empty? + "no errors" + else + "errors: #{pretty_error_messages(@instance)}" + end + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb new file mode 100644 index 0000000..87e0176 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/association_matcher.rb @@ -0,0 +1,226 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensure that the belongs_to relationship exists. + # + # it { should belong_to(:parent) } + # + def belong_to(name) + AssociationMatcher.new(:belongs_to, name) + end + + # Ensures that the has_many relationship exists. Will also test that the + # associated table has the required columns. Works with polymorphic + # associations. + # + # Options: + # * through - association name for has_many :through + # * dependent - tests that the association makes use of the + # dependent option. + # + # Example: + # it { should_have_many(:friends) } + # it { should_have_many(:enemies).through(:friends) } + # it { should_have_many(:enemies).dependent(:destroy) } + # + def have_many(name) + AssociationMatcher.new(:has_many, name) + end + + # Ensure that the has_one relationship exists. Will also test that the + # associated table has the required columns. Works with polymorphic + # associations. + # + # Options: + # * :dependent - tests that the association makes use of the + # dependent option. + # + # Example: + # it { should have_one(:god) } # unless hindu + # + def have_one(name) + AssociationMatcher.new(:has_one, name) + end + + # Ensures that the has_and_belongs_to_many relationship exists, and that + # the join table is in place. + # + # it { should have_and_belong_to_many(:posts) } + # + def have_and_belong_to_many(name) + AssociationMatcher.new(:has_and_belongs_to_many, name) + end + + class AssociationMatcher # :nodoc: + def initialize(macro, name) + @macro = macro + @name = name + end + + def through(through) + @through = through + self + end + + def dependent(dependent) + @dependent = dependent + self + end + + def matches?(subject) + @subject = subject + association_exists? && + macro_correct? && + foreign_key_exists? && + through_association_valid? && + dependent_correct? && + join_table_exists? + end + + def failure_message + "Expected #{expectation} (#{@missing})" + end + + def negative_failure_message + "Did not expect #{expectation}" + end + + def description + description = "#{macro_description} #{@name}" + description += " through #{@through}" if @through + description += " dependent => #{@dependent}" if @dependent + description + end + + protected + + def association_exists? + if reflection.nil? + @missing = "no association called #{@name}" + false + else + true + end + end + + def macro_correct? + if reflection.macro == @macro + true + else + @missing = "actual association type was #{reflection.macro}" + false + end + end + + def foreign_key_exists? + !(belongs_foreign_key_missing? || has_foreign_key_missing?) + end + + def belongs_foreign_key_missing? + @macro == :belongs_to && !class_has_foreign_key?(model_class) + end + + def has_foreign_key_missing? + [:has_many, :has_one].include?(@macro) && + !through? && + !class_has_foreign_key?(associated_class) + end + + def through_association_valid? + @through.nil? || (through_association_exists? && through_association_correct?) + end + + def through_association_exists? + if through_reflection.nil? + "#{model_class.name} does not have any relationship to #{@through}" + false + else + true + end + end + + def through_association_correct? + if @through == reflection.options[:through] + "Expected #{model_class.name} to have #{@name} through #{@through}, " << + " but got it through #{reflection.options[:through]}" + true + else + false + end + end + + def dependent_correct? + if @dependent.nil? || @dependent.to_s == reflection.options[:dependent].to_s + true + else + @missing = "#{@name} should have #{@dependent} dependency" + false + end + end + + def join_table_exists? + if @macro != :has_and_belongs_to_many || + ::ActiveRecord::Base.connection.tables.include?(join_table.to_s) + true + else + @missing = "join table #{join_table} doesn't exist" + false + end + end + + def class_has_foreign_key?(klass) + if klass.column_names.include?(foreign_key.to_s) + true + else + @missing = "#{klass} does not have a #{foreign_key} foreign key." + false + end + end + + def model_class + @subject.class + end + + def join_table + reflection.options[:join_table] + end + + def associated_class + reflection.klass + end + + def foreign_key + reflection.primary_key_name + end + + def through? + reflection.options[:through] + end + + def reflection + @reflection ||= model_class.reflect_on_association(@name) + end + + def through_reflection + @through_reflection ||= model_class.reflect_on_association(@through) + end + + def expectation + "#{model_class.name} to have a #{@macro} association called #{@name}" + end + + def macro_description + case @macro.to_s + when 'belongs_to' then 'belong to' + when 'has_many' then 'have many' + when 'has_one' then 'have one' + when 'has_and_belongs_to_many' then + 'have and belong to many' + end + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb new file mode 100644 index 0000000..a20095a --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb @@ -0,0 +1,87 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensure that the attribute's value is in the range specified + # + # Options: + # * in_range - the range of allowed values for this attribute + # * with_low_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :inclusion. + # * with_high_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :inclusion. + # + # Example: + # it { should ensure_inclusion_of(:age).in_range(0..100) } + # + def ensure_inclusion_of(attr) + EnsureInclusionOfMatcher.new(attr) + end + + class EnsureInclusionOfMatcher < ValidationMatcher # :nodoc: + + def in_range(range) + @range = range + @minimum = range.first + @maximum = range.last + self + end + + def with_message(message) + if message + @low_message = message + @high_message = message + end + self + end + + def with_low_message(message) + @low_message = message if message + self + end + + def with_high_message(message) + @high_message = message if message + self + end + + def description + "ensure inclusion of #{@attribute} in #{@range.inspect}" + end + + def matches?(subject) + super(subject) + + @low_message ||= :inclusion + @high_message ||= :inclusion + + disallows_lower_value && + allows_minimum_value && + disallows_higher_value && + allows_maximum_value + end + + private + + def disallows_lower_value + @minimum == 0 || disallows_value_of(@minimum - 1, @low_message) + end + + def disallows_higher_value + disallows_value_of(@maximum + 1, @high_message) + end + + def allows_minimum_value + allows_value_of(@minimum, @low_message) + end + + def allows_maximum_value + allows_value_of(@maximum, @high_message) + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb new file mode 100644 index 0000000..9c5cde1 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb @@ -0,0 +1,141 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the length of the attribute is validated. + # + # Options: + # * is_at_least - minimum length of this attribute + # * is_at_most - maximum length of this attribute + # * is_equal_to - exact requred length of this attribute + # * with_short_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :too_short. + # * with_long_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :too_long. + # * with_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :wrong_length. Used in conjunction with + # is_equal_to. + # + # Examples: + # it { should ensure_length_of(:password). + # is_at_least(6). + # is_at_most(20) } + # it { should ensure_length_of(:name). + # is_at_least(3). + # with_short_message(/not long enough/) } + # it { should ensure_length_of(:ssn). + # is_equal_to(9). + # with_message(/is invalid/) } + def ensure_length_of(attr) + EnsureLengthOfMatcher.new(attr) + end + + class EnsureLengthOfMatcher < ValidationMatcher # :nodoc: + include Helpers + + def is_at_least(length) + @minimum = length + @short_message ||= :too_short + self + end + + def is_at_most(length) + @maximum = length + @long_message ||= :too_long + self + end + + def is_equal_to(length) + @minimum = length + @maximum = length + @short_message ||= :wrong_length + self + end + + def with_short_message(message) + @short_message = message if message + self + end + alias_method :with_message, :with_short_message + + def with_long_message(message) + @long_message = message if message + self + end + + def description + description = "ensure #{@attribute} has a length " + if @minimum && @maximum + if @minimum == @maximum + description << "of exactly #{@minimum}" + else + description << "between #{@minimum} and #{@maximum}" + end + else + description << "of at least #{@minimum}" if @minimum + description << "of at most #{@maximum}" if @maximum + end + description + end + + def matches?(subject) + super(subject) + translate_messages! + disallows_lower_length && + allows_minimum_length && + ((@minimum == @maximum) || + (disallows_higher_length && + allows_maximum_length)) + end + + private + + def translate_messages! + if Symbol === @short_message + @short_message = default_error_message(@short_message, + :count => @minimum) + end + + if Symbol === @long_message + @long_message = default_error_message(@long_message, + :count => @maximum) + end + end + + def disallows_lower_length + @minimum == 0 || + @minimum.nil? || + disallows_length_of(@minimum - 1, @short_message) + end + + def disallows_higher_length + @maximum.nil? || disallows_length_of(@maximum + 1, @long_message) + end + + def allows_minimum_length + allows_length_of(@minimum, @short_message) + end + + def allows_maximum_length + allows_length_of(@maximum, @long_message) + end + + def allows_length_of(length, message) + length.nil? || allows_value_of(string_of_length(length), message) + end + + def disallows_length_of(length, message) + length.nil? || disallows_value_of(string_of_length(length), message) + end + + def string_of_length(length) + 'x' * length + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb new file mode 100644 index 0000000..86f5212 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_db_column_matcher.rb @@ -0,0 +1,169 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures the database column exists. + # + # Options: + # * of_type - db column type (:integer, :string, etc.) + # * with_options - same options available in migrations + # (:default, :null, :limit, :precision, :scale) + # + # Examples: + # it { should_not have_db_column(:admin).of_type(:boolean) } + # it { should have_db_column(:salary). + # of_type(:decimal). + # with_options(:precision => 10, :scale => 2) } + # + def have_db_column(column) + HaveDbColumnMatcher.new(:have_db_column, column) + end + + class HaveDbColumnMatcher # :nodoc: + def initialize(macro, column) + @macro = macro + @column = column + end + + def of_type(column_type) + @column_type = column_type + self + end + + def with_options(opts = {}) + @precision = opts[:precision] + @limit = opts[:limit] + @default = opts[:default] + @null = opts[:null] + @scale = opts[:scale] + self + end + + def matches?(subject) + @subject = subject + column_exists? && + correct_column_type? && + correct_precision? && + correct_limit? && + correct_default? && + correct_null? && + correct_scale? + end + + def failure_message + "Expected #{expectation} (#{@missing})" + end + + def negative_failure_message + "Did not expect #{expectation}" + end + + def description + desc = "have db column named #{@column}" + desc << " of type #{@column_type}" unless @column_type.nil? + desc << " of precision #{@precision}" unless @precision.nil? + desc << " of limit #{@limit}" unless @limit.nil? + desc << " of default #{@default}" unless @default.nil? + desc << " of null #{@null}" unless @null.nil? + desc << " of primary #{@primary}" unless @primary.nil? + desc << " of scale #{@scale}" unless @scale.nil? + desc + end + + protected + + def column_exists? + if model_class.column_names.include?(@column.to_s) + true + else + @missing = "#{model_class} does not have a db column named #{@column}." + false + end + end + + def correct_column_type? + return true if @column_type.nil? + if matched_column.type.to_s == @column_type.to_s + true + else + @missing = "#{model_class} has a db column named #{@column} " << + "of type #{matched_column.type}, not #{@column_type}." + false + end + end + + def correct_precision? + return true if @precision.nil? + if matched_column.precision.to_s == @precision.to_s + true + else + @missing = "#{model_class} has a db column named #{@column} " << + "of precision #{matched_column.precision}, " << + "not #{@precision}." + false + end + end + + def correct_limit? + return true if @limit.nil? + if matched_column.limit.to_s == @limit.to_s + true + else + @missing = "#{model_class} has a db column named #{@column} " << + "of limit #{matched_column.limit}, " << + "not #{@limit}." + false + end + end + + def correct_default? + return true if @default.nil? + if matched_column.default.to_s == @default.to_s + true + else + @missing = "#{model_class} has a db column named #{@column} " << + "of default #{matched_column.default}, " << + "not #{@default}." + false + end + end + + def correct_null? + return true if @null.nil? + if matched_column.null.to_s == @null.to_s + true + else + @missing = "#{model_class} has a db column named #{@column} " << + "of null #{matched_column.null}, " << + "not #{@null}." + false + end + end + + def correct_scale? + return true if @scale.nil? + if matched_column.scale.to_s == @scale.to_s + true + else + @missing = "#{model_class} has a db column named #{@column} " << + "of scale #{matched_column.scale}, not #{@scale}." + false + end + end + + def matched_column + model_class.columns.detect { |each| each.name == @column.to_s } + end + + def model_class + @subject.class + end + + def expectation + expected = "#{model_class.name} to #{description}" + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb new file mode 100644 index 0000000..be4a8c4 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_index_matcher.rb @@ -0,0 +1,105 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that there are DB indices on the given columns or tuples of + # columns. + # + # Options: + # * unique - whether or not the index has a unique + # constraint. Use true to explicitly test for a unique + # constraint. Use false to explicitly test for a non-unique + # constraint. Use nil if you don't care whether the index is + # unique or not. Default = nil + # + # Examples: + # + # it { should have_index(:age) } + # it { should have_index([:commentable_type, :commentable_id]) } + # it { should have_index(:ssn).unique(true) } + # + def have_index(columns) + HaveIndexMatcher.new(:have_index, columns) + end + + class HaveIndexMatcher # :nodoc: + def initialize(macro, columns) + @macro = macro + @columns = normalize_columns_to_array(columns) + end + + def unique(unique) + @unique = unique + self + end + + def matches?(subject) + @subject = subject + index_exists? && correct_unique? + end + + def failure_message + "Expected #{expectation} (#{@missing})" + end + + def negative_failure_message + "Did not expect #{expectation}" + end + + def description + "have a #{index_type} index on columns #{@columns}" + end + + protected + + def index_exists? + ! matched_index.nil? + end + + def correct_unique? + return true if @unique.nil? + if matched_index.unique == @unique + true + else + @missing = "#{table_name} has an index named #{matched_index.name} " << + "of unique #{matched_index.unique}, not #{@unique}." + false + end + end + + def matched_index + indexes.detect { |each| each.columns == @columns } + end + + def model_class + @subject.class + end + + def table_name + model_class.table_name + end + + def indexes + ::ActiveRecord::Base.connection.indexes(table_name) + end + + def expectation + expected = "#{model_class.name} to #{description}" + end + + def index_type + @unique ? "unique" : "non-unique" + end + + def normalize_columns_to_array(columns) + if columns.class == Array + columns.collect { |each| each.to_s } + else + [columns.to_s] + end + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb new file mode 100644 index 0000000..576e8ce --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb @@ -0,0 +1,125 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the model has a method named scope_call that returns a + # NamedScope object with the proxy options set to the options you supply. + # scope_call can be either a symbol, or a Ruby expression in a String + # which will be evaled. The eval'd method call has access to all the same + # instance variables that an example would. + # + # Options: + # + # * in_context - Any of the options that the named scope would + # pass on to find. + # + # Example: + # + # it { should have_named_scope(:visible). + # finding(:conditions => {:visible => true}) } + # + # Passes for + # + # named_scope :visible, :conditions => {:visible => true} + # + # Or for + # + # def self.visible + # scoped(:conditions => {:visible => true}) + # end + # + # You can test lambdas or methods that return ActiveRecord#scoped calls: + # + # it { should have_named_scope('recent(5)').finding(:limit => 5) } + # it { should have_named_scope('recent(1)').finding(:limit => 1) } + # + # Passes for + # named_scope :recent, lambda {|c| {:limit => c}} + # + # Or for + # + # def self.recent(c) + # scoped(:limit => c) + # end + # + def have_named_scope(scope_call) + HaveNamedScopeMatcher.new(scope_call).in_context(self) + end + + class HaveNamedScopeMatcher # :nodoc: + + def initialize(scope_call) + @scope_call = scope_call.to_s + end + + def finding(finding) + @finding = finding + self + end + + def in_context(context) + @context = context + self + end + + def matches?(subject) + @subject = subject + call_succeeds? && returns_scope? && finds_correct_scope? + end + + def failure_message + "Expected #{@missing_expectation}" + end + + def negative_failure_message + "Didn't expect a named scope for #{@scope_call}" + end + + def description + result = "have a named scope for #{@scope_call}" + result << " finding #{@finding.inspect}" unless @finding.nil? + result + end + + private + + def call_succeeds? + scope + true + rescue Exception => exception + @missing_expectation = "#{@subject.class.name} " << + "to respond to #{@scope_call} " << + "but raised error: #{exception.inspect}" + false + end + + def scope + @scope ||= @context.instance_eval("#{@subject.class.name}.#{@scope_call}") + end + + def returns_scope? + if ::ActiveRecord::NamedScope::Scope === scope + true + else + @missing_expectation = "#{@scope_call} to return a scope" + false + end + end + + def finds_correct_scope? + return true if @finding.nil? + if @finding == scope.proxy_options + true + else + @missing_expectation = "#{@scope_call} to return results scoped to " + @missing_expectation << "#{@finding.inspect} but was scoped to " + @missing_expectation << scope.proxy_options.inspect + false + end + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb new file mode 100644 index 0000000..de9a2c8 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb @@ -0,0 +1,59 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the attribute cannot be changed once the record has been + # created. + # + # it { should have_readonly_attributes(:password) } + # + def have_readonly_attribute(value) + HaveReadonlyAttributeMatcher.new(value) + end + + class HaveReadonlyAttributeMatcher # :nodoc: + + def initialize(attribute) + @attribute = attribute.to_s + end + + def matches?(subject) + @subject = subject + if readonly_attributes.include?(@attribute) + @negative_failure_message = + "Did not expect #{@attribute} to be read-only" + true + else + if readonly_attributes.empty? + @failure_message = "#{class_name} attribute #{@attribute} " << + "is not read-only" + else + @failure_message = "#{class_name} is making " << + "#{readonly_attributes.to_sentence} " << + "read-only, but not #{@attribute}." + end + false + end + end + + attr_reader :failure_message, :negative_failure_message + + def description + "make #{@attribute} read-only" + end + + private + + def readonly_attributes + @readonly_attributes ||= (@subject.class.readonly_attributes || []) + end + + def class_name + @subject.class.name + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb new file mode 100644 index 0000000..f77da83 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb @@ -0,0 +1,41 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the model cannot be saved the given attribute is not + # accepted. + # + # Options: + # * with_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :accepted. + # + # Example: + # it { should validate_acceptance_of(:eula) } + # + def validate_acceptance_of(attr) + ValidateAcceptanceOfMatcher.new(attr) + end + + class ValidateAcceptanceOfMatcher < ValidationMatcher # :nodoc: + + def with_message(message) + @expected_message = message if message + self + end + + def matches?(subject) + super(subject) + @expected_message ||= :accepted + disallows_value_of(false, @expected_message) + end + + def description + "require #{@attribute} to be accepted" + end + + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb new file mode 100644 index 0000000..0f6857c --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb @@ -0,0 +1,39 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensure that the attribute is numeric + # + # Options: + # * with_message - value the test expects to find in + # errors.on(:attribute). Regexp or string. Defaults to the + # translation for :not_a_number. + # + # Example: + # it { should validate_numericality_of(:age) } + # + def validate_numericality_of(attr) + ValidateNumericalityOfMatcher.new(attr) + end + + class ValidateNumericalityOfMatcher < ValidationMatcher # :nodoc: + + def with_message(message) + @expected_message = message if message + self + end + + def matches?(subject) + super(subject) + @expected_message ||= :not_a_number + disallows_value_of('abcd', @expected_message) + end + + def description + "only allow numeric values for #{@attribute}" + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb new file mode 100644 index 0000000..ed460c4 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb @@ -0,0 +1,60 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the model is not valid if the given attribute is not + # present. + # + # Options: + # * with_message - value the test expects to find in + # errors.on(:attribute). Regexp or String. + # Defaults to the translation for :blank. + # + # Examples: + # it { should validate_presence_of(:name) } + # it { should validate_presence_of(:name). + # with_message(/is not optional/) } + # + def validate_presence_of(attr) + ValidatePresenceOfMatcher.new(attr) + end + + class ValidatePresenceOfMatcher < ValidationMatcher # :nodoc: + + def with_message(message) + @expected_message = message if message + self + end + + def matches?(subject) + super(subject) + @expected_message ||= :blank + disallows_value_of(blank_value, @expected_message) + end + + def description + "require #{@attribute} to be set" + end + + private + + def blank_value + if collection? + [] + else + nil + end + end + + def collection? + if reflection = @subject.class.reflect_on_association(@attribute) + [:has_many, :has_and_belongs_to_many].include?(reflection.macro) + else + false + end + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb new file mode 100644 index 0000000..322c77c --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb @@ -0,0 +1,148 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + # Ensures that the model is invalid if the given attribute is not unique. + # + # Internally, this uses values from existing records to test validations, + # so this will always fail if you have not saved at least one record for + # the model being tested, like so: + # + # describe User do + # before(:each) { User.create!(:email => 'address@example.com') } + # it { should validate_uniqueness_of(:email) } + # end + # + # Options: + # + # * with_message - value the test expects to find in + # errors.on(:attribute). Regexp or String. + # Defaults to the translation for :taken. + # * scoped_to - field(s) to scope the uniqueness to. + # * case_insensitive - ensures that the validation does not + # check case. Off by default. Ignored by non-text attributes. + # + # Examples: + # it { should validate_uniqueness_of(:keyword) } + # it { should validate_uniqueness_of(:keyword).with_message(/dup/) } + # it { should validate_uniqueness_of(:email).scoped_to(:name) } + # it { should validate_uniqueness_of(:email). + # scoped_to(:first_name, :last_name) } + # it { should validate_uniqueness_of(:keyword).case_insensitive } + # + def validate_uniqueness_of(attr) + ValidateUniquenessOfMatcher.new(attr) + end + + class ValidateUniquenessOfMatcher < ValidationMatcher # :nodoc: + include Helpers + + def initialize(attribute) + @attribute = attribute + end + + def scoped_to(*scopes) + @scopes = [*scopes].flatten + self + end + + def with_message(message) + @expected_message = message + self + end + + def case_insensitive + @case_insensitive = true + self + end + + def description + result = "require " + result << "case sensitive " unless @case_insensitive + result << "unique value for #{@attribute}" + result << " scoped to #{@scopes.join(', ')}" unless @scopes.blank? + result + end + + def matches?(subject) + @subject = subject.class.new + @expected_message ||= :taken + find_existing && + set_scoped_attributes && + validate_attribute && + validate_after_scope_change + end + + private + + def find_existing + if @existing = @subject.class.find(:first) + true + else + @failure_message = "Can't find first #{class_name}" + false + end + end + + def set_scoped_attributes + unless @scopes.blank? + @scopes.each do |scope| + setter = :"#{scope}=" + unless @subject.respond_to?(setter) + @failure_message = + "#{class_name} doesn't seem to have a #{scope} attribute." + return false + end + @subject.send("#{scope}=", @existing.send(scope)) + end + end + true + end + + def validate_attribute + disallows_value_of(existing_value, @expected_message) + end + + # TODO: There is a chance that we could change the scoped field + # to a value that's already taken. An alternative implementation + # could actually find all values for scope and create a unique + def validate_after_scope_change + if @scopes.blank? + true + else + @scopes.all? do |scope| + previous_value = @existing.send(scope) + + # Assume the scope is a foreign key if the field is nil + previous_value ||= 0 + + next_value = previous_value.next + + @subject.send("#{scope}=", next_value) + + if allows_value_of(existing_value, @expected_message) + @negative_failure_message << + " (with different value of #{scope})" + true + else + @failure_message << " (with different value of #{scope})" + false + end + end + end + end + + def class_name + @subject.class.name + end + + def existing_value + value = @existing.send(@attribute) + value.swapcase! if @case_insensitive && value.respond_to?(:swapcase!) + value + end + end + + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb new file mode 100644 index 0000000..7faf50c --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/active_record/matchers/validation_matcher.rb @@ -0,0 +1,56 @@ +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + module Matchers + + class ValidationMatcher # :nodoc: + + attr_reader :failure_message + + def initialize(attribute) + @attribute = attribute + end + + def negative_failure_message + @negative_failure_message || @failure_message + end + + def matches?(subject) + @subject = subject + false + end + + private + + def allows_value_of(value, message = nil) + allow = AllowValueMatcher. + new(value). + for(@attribute). + with_message(message) + if allow.matches?(@subject) + @negative_failure_message = allow.failure_message + true + else + @failure_message = allow.negative_failure_message + false + end + end + + def disallows_value_of(value, message = nil) + disallow = AllowValueMatcher. + new(value). + for(@attribute). + with_message(message) + if disallow.matches?(@subject) + @failure_message = disallow.negative_failure_message + false + else + @negative_failure_message = disallow.failure_message + true + end + end + end + + end + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb new file mode 100644 index 0000000..73f31ec --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/assertions.rb @@ -0,0 +1,59 @@ +module Shoulda # :nodoc: + module Assertions + # Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered. + # + # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes + def assert_same_elements(a1, a2, msg = nil) + [:select, :inject, :size].each do |m| + [a1, a2].each {|a| assert_respond_to(a, m, "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.") } + end + + assert a1h = a1.inject({}) { |h,e| h[e] = a1.select { |i| i == e }.size; h } + assert a2h = a2.inject({}) { |h,e| h[e] = a2.select { |i| i == e }.size; h } + + assert_equal(a1h, a2h, msg) + end + + # Asserts that the given collection contains item x. If x is a regular expression, ensure that + # at least one element from the collection matches x. +extra_msg+ is appended to the error message if the assertion fails. + # + # assert_contains(['a', '1'], /\d/) => passes + # assert_contains(['a', '1'], 'a') => passes + # assert_contains(['a', '1'], /not there/) => fails + def assert_contains(collection, x, extra_msg = "") + collection = [collection] unless collection.is_a?(Array) + msg = "#{x.inspect} not found in #{collection.to_a.inspect} #{extra_msg}" + case x + when Regexp + assert(collection.detect { |e| e =~ x }, msg) + else + assert(collection.include?(x), msg) + end + end + + # Asserts that the given collection does not contain item x. If x is a regular expression, ensure that + # none of the elements from the collection match x. + def assert_does_not_contain(collection, x, extra_msg = "") + collection = [collection] unless collection.is_a?(Array) + msg = "#{x.inspect} found in #{collection.to_a.inspect} " + extra_msg + case x + when Regexp + assert(!collection.detect { |e| e =~ x }, msg) + else + assert(!collection.include?(x), msg) + end + end + + # Asserts that the given matcher returns true when +target+ is passed to #matches? + def assert_accepts(matcher, target) + success = matcher.matches?(target) + assert_block(matcher.failure_message) { success } + end + + # Asserts that the given matcher returns false when +target+ is passed to #matches? + def assert_rejects(matcher, target) + success = !matcher.matches?(target) + assert_block(matcher.negative_failure_message) { success } + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb new file mode 100644 index 0000000..d815ee3 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/autoload_macros.rb @@ -0,0 +1,46 @@ +module Shoulda # :nodoc: + # Call autoload_macros when you want to load test macros automatically in a non-Rails + # project (it's done automatically for Rails projects). + # You don't need to specify ROOT/test/shoulda_macros explicitly. Your custom macros + # are loaded automatically when you call autoload_macros. + # + # The first argument is the path to you application's root directory. + # All following arguments are directories relative to your root, which contain + # shoulda_macros subdirectories. These directories support the same kinds of globs as the + # Dir class. + # + # Basic usage (from a test_helper): + # Shoulda.autoload_macros(File.dirname(__FILE__) + '/..') + # will load everything in + # - your_app/test/shoulda_macros + # + # To load vendored macros as well: + # Shoulda.autoload_macros(APP_ROOT, 'vendor/*') + # will load everything in + # - APP_ROOT/vendor/*/shoulda_macros + # - APP_ROOT/test/shoulda_macros + # + # To load macros in an app with a vendor directory laid out like Rails': + # Shoulda.autoload_macros(APP_ROOT, 'vendor/{plugins,gems}/*') + # or + # Shoulda.autoload_macros(APP_ROOT, 'vendor/plugins/*', 'vendor/gems/*') + # will load everything in + # - APP_ROOT/vendor/plugins/*/shoulda_macros + # - APP_ROOT/vendor/gems/*/shoulda_macros + # - APP_ROOT/test/shoulda_macros + # + # If you prefer to stick testing dependencies away from your production dependencies: + # Shoulda.autoload_macros(APP_ROOT, 'vendor/*', 'test/vendor/*') + # will load everything in + # - APP_ROOT/vendor/*/shoulda_macros + # - APP_ROOT/test/vendor/*/shoulda_macros + # - APP_ROOT/test/shoulda_macros + def self.autoload_macros(root, *dirs) + dirs << File.join('test') + complete_dirs = dirs.map{|d| File.join(root, d, 'shoulda_macros')} + all_files = complete_dirs.inject([]){ |files, dir| files + Dir[File.join(dir, '*.rb')] } + all_files.each do |file| + require file + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb new file mode 100644 index 0000000..2ee79b9 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/context.rb @@ -0,0 +1,304 @@ +module Shoulda + class << self + attr_accessor :contexts + def contexts # :nodoc: + @contexts ||= [] + end + + def current_context # :nodoc: + self.contexts.last + end + + def add_context(context) # :nodoc: + self.contexts.push(context) + end + + def remove_context # :nodoc: + self.contexts.pop + end + end + + module ClassMethods + # == Should statements + # + # Should statements are just syntactic sugar over normal Test::Unit test methods. A should block + # contains all the normal code and assertions you're used to seeing, with the added benefit that + # they can be wrapped inside context blocks (see below). + # + # === Example: + # + # class UserTest < Test::Unit::TestCase + # + # def setup + # @user = User.new("John", "Doe") + # end + # + # should "return its full name" + # assert_equal 'John Doe', @user.full_name + # end + # + # end + # + # ...will produce the following test: + # * "test: User should return its full name. " + # + # Note: The part before should in the test name is gleamed from the name of the Test::Unit class. + # + # Should statements can also take a Proc as a :before option. This proc runs after any + # parent context's setups but before the current context's setup. + # + # === Example: + # + # context "Some context" do + # setup { puts("I run after the :before proc") } + # + # should "run a :before proc", :before => lambda { puts("I run before the setup") } do + # assert true + # end + # end + + def should(name, options = {}, &blk) + if Shoulda.current_context + block_given? ? Shoulda.current_context.should(name, options, &blk) : Should.current_context.should_eventually(name) + else + context_name = self.name.gsub(/Test/, "") + context = Shoulda::Context.new(context_name, self) do + block_given? ? should(name, options, &blk) : should_eventually(name) + end + context.build + end + end + + # == Before statements + # + # Before statements are should statements that run before the current + # context's setup. These are especially useful when setting expectations. + # + # === Example: + # + # class UserControllerTest < Test::Unit::TestCase + # context "the index action" do + # setup do + # @users = [Factory(:user)] + # User.stubs(:find).returns(@users) + # end + # + # context "on GET" do + # setup { get :index } + # + # should_respond_with :success + # + # # runs before "get :index" + # before_should "find all users" do + # User.expects(:find).with(:all).returns(@users) + # end + # end + # end + # end + def before_should(name, &blk) + should(name, :before => blk) { assert true } + end + + # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output. + def should_eventually(name, options = {}, &blk) + context_name = self.name.gsub(/Test/, "") + context = Shoulda::Context.new(context_name, self) do + should_eventually(name, &blk) + end + context.build + end + + # == Contexts + # + # A context block groups should statements under a common set of setup/teardown methods. + # Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability + # and readability of your test code. + # + # A context block can contain setup, should, should_eventually, and teardown blocks. + # + # class UserTest < Test::Unit::TestCase + # context "A User instance" do + # setup do + # @user = User.find(:first) + # end + # + # should "return its full name" + # assert_equal 'John Doe', @user.full_name + # end + # end + # end + # + # This code will produce the method "test: A User instance should return its full name. ". + # + # Contexts may be nested. Nested contexts run their setup blocks from out to in before each + # should statement. They then run their teardown blocks from in to out after each should statement. + # + # class UserTest < Test::Unit::TestCase + # context "A User instance" do + # setup do + # @user = User.find(:first) + # end + # + # should "return its full name" + # assert_equal 'John Doe', @user.full_name + # end + # + # context "with a profile" do + # setup do + # @user.profile = Profile.find(:first) + # end + # + # should "return true when sent :has_profile?" + # assert @user.has_profile? + # end + # end + # end + # end + # + # This code will produce the following methods + # * "test: A User instance should return its full name. " + # * "test: A User instance with a profile should return true when sent :has_profile?. " + # + # Just like should statements, a context block can exist next to normal def test_the_old_way; end + # tests. This means you do not have to fully commit to the context/should syntax in a test file. + + def context(name, &blk) + if Shoulda.current_context + Shoulda.current_context.context(name, &blk) + else + context = Shoulda::Context.new(name, self, &blk) + context.build + end + end + end + + class Context # :nodoc: + + attr_accessor :name # my name + attr_accessor :parent # may be another context, or the original test::unit class. + attr_accessor :subcontexts # array of contexts nested under myself + attr_accessor :setup_blocks # blocks given via setup methods + attr_accessor :teardown_blocks # blocks given via teardown methods + attr_accessor :shoulds # array of hashes representing the should statements + attr_accessor :should_eventuallys # array of hashes representing the should eventually statements + + def initialize(name, parent, &blk) + Shoulda.add_context(self) + self.name = name + self.parent = parent + self.setup_blocks = [] + self.teardown_blocks = [] + self.shoulds = [] + self.should_eventuallys = [] + self.subcontexts = [] + + merge_block(&blk) + Shoulda.remove_context + end + + def merge_block(&blk) + blk.bind(self).call + end + + def context(name, &blk) + self.subcontexts << Context.new(name, self, &blk) + end + + def setup(&blk) + self.setup_blocks << blk + end + + def teardown(&blk) + self.teardown_blocks << blk + end + + def should(name, options = {}, &blk) + if block_given? + self.shoulds << { :name => name, :before => options[:before], :block => blk } + else + self.should_eventuallys << { :name => name } + end + end + + def should_eventually(name, &blk) + self.should_eventuallys << { :name => name, :block => blk } + end + + def full_name + parent_name = parent.full_name if am_subcontext? + return [parent_name, name].join(" ").strip + end + + def am_subcontext? + parent.is_a?(self.class) # my parent is the same class as myself. + end + + def test_unit_class + am_subcontext? ? parent.test_unit_class : parent + end + + def create_test_from_should_hash(should) + test_name = ["test:", full_name, "should", "#{should[:name]}. "].flatten.join(' ').to_sym + + if test_unit_class.instance_methods.include?(test_name.to_s) + warn " * WARNING: '#{test_name}' is already defined" + end + + context = self + test_unit_class.send(:define_method, test_name) do + begin + context.run_parent_setup_blocks(self) + should[:before].bind(self).call if should[:before] + context.run_current_setup_blocks(self) + should[:block].bind(self).call + ensure + context.run_all_teardown_blocks(self) + end + end + end + + def run_all_setup_blocks(binding) + run_parent_setup_blocks(binding) + run_current_setup_blocks(binding) + end + + def run_parent_setup_blocks(binding) + self.parent.run_all_setup_blocks(binding) if am_subcontext? + end + + def run_current_setup_blocks(binding) + setup_blocks.each do |setup_block| + setup_block.bind(binding).call + end + end + + def run_all_teardown_blocks(binding) + teardown_blocks.reverse.each do |teardown_block| + teardown_block.bind(binding).call + end + self.parent.run_all_teardown_blocks(binding) if am_subcontext? + end + + def print_should_eventuallys + should_eventuallys.each do |should| + test_name = [full_name, "should", "#{should[:name]}. "].flatten.join(' ') + puts " * DEFERRED: " + test_name + end + end + + def build + shoulds.each do |should| + create_test_from_should_hash(should) + end + + subcontexts.each { |context| context.build } + + print_should_eventuallys + end + + def method_missing(method, *args, &blk) + test_unit_class.send(method, *args, &blk) + end + + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb new file mode 100644 index 0000000..873e7c7 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/helpers.rb @@ -0,0 +1,8 @@ +module Shoulda # :nodoc: + module Helpers + # Prints a message to stdout, tagged with the name of the calling method. + def report!(msg = "") + puts("#{caller.first}: #{msg}") + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb new file mode 100644 index 0000000..7eefb13 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/macros.rb @@ -0,0 +1,73 @@ +require 'shoulda/private_helpers' + +module Shoulda # :nodoc: + module Macros + # Macro that creates a test asserting a change between the return value + # of an expression that is run before and after the current setup block + # is run. This is similar to Active Support's assert_difference + # assertion, but supports more than just numeric values. See also + # should_not_change. + # + # Example: + # + # context "Creating a post" do + # setup { Post.create } + # should_change "Post.count", :by => 1 + # end + # + # As shown in this example, the :by option expects a numeric + # difference between the before and after values of the expression. You + # may also specify :from and :to options: + # + # should_change "Post.count", :from => 0, :to => 1 + # should_change "@post.title", :from => "old", :to => "new" + # + # Combinations of :by, :from, and :to are allowed: + # + # should_change "@post.title" # => assert the value changed in some way + # should_change "@post.title", :from => "old" # => assert the value changed to anything other than "old" + # should_change "@post.title", :to => "new" # => assert the value changed from anything other than "new" + def should_change(expression, options = {}) + by, from, to = get_options!([options], :by, :from, :to) + stmt = "change #{expression.inspect}" + stmt << " from #{from.inspect}" if from + stmt << " to #{to.inspect}" if to + stmt << " by #{by.inspect}" if by + + expression_eval = lambda { eval(expression) } + before = lambda { @_before_should_change = expression_eval.bind(self).call } + should stmt, :before => before do + old_value = @_before_should_change + new_value = expression_eval.bind(self).call + assert_operator from, :===, old_value, "#{expression.inspect} did not originally match #{from.inspect}" if from + assert_not_equal old_value, new_value, "#{expression.inspect} did not change" unless by == 0 + assert_operator to, :===, new_value, "#{expression.inspect} was not changed to match #{to.inspect}" if to + assert_equal old_value + by, new_value if by + end + end + + # Macro that creates a test asserting no change between the return value + # of an expression that is run before and after the current setup block + # is run. This is the logical opposite of should_change. + # + # Example: + # + # context "Updating a post" do + # setup { @post.update_attributes(:title => "new") } + # should_not_change "Post.count" + # end + def should_not_change(expression) + expression_eval = lambda { eval(expression) } + before = lambda { @_before_should_not_change = expression_eval.bind(self).call } + should "not change #{expression.inspect}", :before => before do + new_value = expression_eval.bind(self).call + assert_equal @_before_should_not_change, new_value, "#{expression.inspect} changed" + end + end + + private + + include Shoulda::Private + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb new file mode 100644 index 0000000..e579957 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/private_helpers.rb @@ -0,0 +1,20 @@ +module Shoulda # :nodoc: + module Private # :nodoc: + # Returns the values for the entries in the args hash who's keys are listed in the wanted array. + # Will raise if there are keys in the args hash that aren't listed. + def get_options!(args, *wanted) + ret = [] + opts = (args.last.is_a?(Hash) ? args.pop : {}) + wanted.each {|w| ret << opts.delete(w)} + raise ArgumentError, "Unsupported options given: #{opts.keys.join(', ')}" unless opts.keys.empty? + return *ret + end + + # Returns the model class constant, as determined by the test class name. + # + # class TestUser; model_class; end => User + def model_class + self.name.gsub(/Test$/, '').constantize + end + end +end diff --git a/vendor/plugins/shoulda/lib/shoulda/gem/proc_extensions.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/proc_extensions.rb similarity index 100% rename from vendor/plugins/shoulda/lib/shoulda/gem/proc_extensions.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/proc_extensions.rb diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb new file mode 100644 index 0000000..ddb2fcc --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rails.rb @@ -0,0 +1,13 @@ +require 'rubygems' +require 'active_support' +require 'shoulda' + +require 'shoulda/active_record' if defined? ActiveRecord::Base +require 'shoulda/action_controller' if defined? ActionController::Base +require 'shoulda/action_view' if defined? ActionView::Base +require 'shoulda/action_mailer' if defined? ActionMailer::Base + +if defined?(RAILS_ROOT) + # load in the 3rd party macros from vendorized plugins and gems + Shoulda.autoload_macros RAILS_ROOT, File.join("vendor", "{plugins,gems}", "*") +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb new file mode 100644 index 0000000..ef636ab --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/rspec.rb @@ -0,0 +1,11 @@ +require 'shoulda/active_record/matchers' +require 'shoulda/action_controller/matchers' +require 'active_support/test_case' + +# :enddoc: +module ActiveSupport + class TestCase + include Shoulda::ActiveRecord::Matchers + include Shoulda::ActionController::Matchers + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb new file mode 100644 index 0000000..b59c89e --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks.rb @@ -0,0 +1,3 @@ +Dir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')].each do |f| + load f +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake new file mode 100644 index 0000000..521daf2 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/list_tests.rake @@ -0,0 +1,29 @@ +namespace :shoulda do + desc "List the names of the test methods in a specification like format" + task :list do + $LOAD_PATH.unshift("test") + + require 'test/unit' + require 'rubygems' + require 'active_support' + + # bug in test unit. Set to true to stop from running. + Test::Unit.run = true + + test_files = Dir.glob(File.join('test', '**', '*_test.rb')) + test_files.each do |file| + load file + klass = File.basename(file, '.rb').classify + unless Object.const_defined?(klass.to_s) + puts "Skipping #{klass} because it doesn't map to a Class" + next + end + klass = klass.constantize + + puts klass.name.gsub('Test', '') + + test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort + test_methods.each {|m| puts " " + m } + end + end +end diff --git a/vendor/plugins/shoulda/tasks/yaml_to_shoulda.rake b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/yaml_to_shoulda.rake similarity index 100% rename from vendor/plugins/shoulda/tasks/yaml_to_shoulda.rake rename to vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/tasks/yaml_to_shoulda.rake diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb new file mode 100644 index 0000000..1caa430 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/lib/shoulda/test_unit.rb @@ -0,0 +1,19 @@ +require 'shoulda/context' +require 'shoulda/proc_extensions' +require 'shoulda/assertions' +require 'shoulda/macros' +require 'shoulda/helpers' +require 'shoulda/autoload_macros' +require 'shoulda/rails' if defined? RAILS_ROOT + +module Test # :nodoc: all + module Unit + class TestCase + extend Shoulda::ClassMethods + include Shoulda::Assertions + extend Shoulda::Macros + include Shoulda::Helpers + end + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb new file mode 100644 index 0000000..3f683d8 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/rails/init.rb @@ -0,0 +1,7 @@ +if RAILS_ENV == 'test' + if defined? Spec + require 'shoulda/rspec' + else + require 'shoulda/rails' + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/README b/vendor/gems/thoughtbot-shoulda-2.10.1/test/README new file mode 100644 index 0000000..12a996c --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/README @@ -0,0 +1,36 @@ +The Shoulda test suite (in particular - the tests that test shoulda) + +Quick overview: + +The test directory contains the following files and subdirectories: + +* rails_root - contains the stripped down rails application that the tests run against. The rails root contains: +** the models, controllers, and views defined under app/ +** the test.rb environment file +** a migration file for each model +** a shoulda initializer that simulates loading the plugin but without relying on vendor/plugins +* fixtures - contain the sample DB data for each model +* functional - controller tests for each of the controllers under rails_root/app +* unit - model tests for each of the models under rails_root/app +* other - tests for the shoulda contexts, should statements, and assertions +* test_helper.rb - responsible for initializing the test environment +** sets the rails_env to test +** sets the rails_root +** runs all the migrations against the in-memory sqlite3 db +** adds some magic to load the right fixture files + +In order to add a new model (or controller) to the test suite: + +* add that model to rails_root/app/models +* add a migration for that model +* add a fixture file +* add a test for that file under test/units + +Dependencies: + +* Rails gem installed in the host system +* A working sqlite3 installation. + +If you have problems running these tests, please notify the mailing list: shoulda@googlegroups.com + +- Tammer Saleh diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb new file mode 100644 index 0000000..408cdf1 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fail_macros.rb @@ -0,0 +1,34 @@ +module Shoulda + class << self + attr_accessor :expected_exceptions + end + + module ClassMethods + # Enables the core shoulda test suite to test for failure scenarios. For + # example, to ensure that a set of test macros should fail, do this: + # + # should_fail do + # should_validate_presence_of :comments + # should_not_allow_mass_assignment_of :name + # end + def should_fail(&block) + context "should fail when trying to run:" do + Shoulda.expected_exceptions = [Test::Unit::AssertionFailedError] + yield block + Shoulda.expected_exceptions = nil + end + end + end + + class Context + # alias_method_chain hack to allow the should_fail macro to work + def should_with_failure_scenario(name, options = {}, &block) + if Shoulda.expected_exceptions + expected_exceptions = Shoulda.expected_exceptions + failure_block = lambda { assert_raise(*expected_exceptions, &block.bind(self)) } + end + should_without_failure_scenario(name, options, &(failure_block || block)) + end + alias_method_chain :should, :failure_scenario + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml new file mode 100644 index 0000000..3b468e5 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/addresses.yml @@ -0,0 +1,3 @@ +first: + title: Home + addressable: first (User) diff --git a/vendor/plugins/shoulda/test/fixtures/taggings.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/friendships.yml similarity index 100% rename from vendor/plugins/shoulda/test/fixtures/taggings.yml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/friendships.yml diff --git a/vendor/plugins/shoulda/test/fixtures/posts.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/posts.yml similarity index 100% rename from vendor/plugins/shoulda/test/fixtures/posts.yml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/posts.yml diff --git a/vendor/plugins/shoulda/test/rails_root/config/environments/sqlite3.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/config/environments/sqlite3.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/products.yml diff --git a/vendor/plugins/shoulda/test/rails_root/db/schema.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/taggings.yml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/db/schema.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/taggings.yml diff --git a/vendor/plugins/shoulda/test/fixtures/tags.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/tags.yml similarity index 100% rename from vendor/plugins/shoulda/test/fixtures/tags.yml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/tags.yml diff --git a/vendor/plugins/shoulda/test/fixtures/users.yml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml similarity index 79% rename from vendor/plugins/shoulda/test/fixtures/users.yml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml index cfe60c3..6242a63 100644 --- a/vendor/plugins/shoulda/test/fixtures/users.yml +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/fixtures/users.yml @@ -3,3 +3,4 @@ first: name: Some dude age: 2 email: none@none.com + ssn: 123456789 diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb new file mode 100644 index 0000000..796492b --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/posts_controller_test.rb @@ -0,0 +1,125 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'posts_controller' + +# Re-raise errors caught by the controller. +class PostsController; def rescue_action(e) raise e end; end + +class PostsControllerTest < Test::Unit::TestCase + fixtures :all + + def setup + @controller = PostsController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + @post = Post.find(:first) + end + + # autodetects the :controller + should_route :get, '/posts', :action => :index + # explicitly specify :controller + should_route :post, '/posts', :controller => :posts, :action => :create + # non-string parameter + should_route :get, '/posts/1', :action => :show, :id => 1 + # string-parameter + should_route :put, '/posts/1', :action => :update, :id => "1" + should_route :delete, '/posts/1', :action => :destroy, :id => 1 + should_route :get, '/posts/new', :action => :new + + # Test the nested routes + should_route :get, '/users/5/posts', :action => :index, :user_id => 5 + should_route :post, '/users/5/posts', :action => :create, :user_id => 5 + should_route :get, '/users/5/posts/1', :action => :show, :id => 1, :user_id => 5 + should_route :delete, '/users/5/posts/1', :action => :destroy, :id => 1, :user_id => 5 + should_route :get, '/users/5/posts/new', :action => :new, :user_id => 5 + should_route :put, '/users/5/posts/1', :action => :update, :id => 1, :user_id => 5 + + context "Logged in" do + setup do + @request.session[:logged_in] = true + end + + context "viewing posts for a user" do + setup do + get :index, :user_id => users(:first) + end + should_respond_with :success + should_assign_to :user, :class => User, :equals => 'users(:first)' + should_assign_to(:user) { users(:first) } + should_fail do + should_assign_to :user, :class => Post + end + should_fail do + should_assign_to :user, :equals => 'posts(:first)' + end + should_fail do + should_assign_to(:user) { posts(:first) } + end + should_assign_to :posts + should_not_assign_to :foo, :bar + should_render_page_with_metadata :description => /Posts/, :title => /index/ + should_render_page_with_metadata :keywords => "posts" + end + + context "viewing posts for a user with rss format" do + setup do + get :index, :user_id => users(:first), :format => 'rss' + @user = users(:first) + end + should_respond_with :success + should_respond_with_content_type 'application/rss+xml' + should_respond_with_content_type :rss + should_respond_with_content_type /rss/ + context "deprecated" do # to avoid redefining a test + should_return_from_session :special, "'$2 off your next purchase'" + end + should_fail do + should_return_from_session :special, "'not special'" + end + should_set_session(:mischief) { nil } + should_return_from_session :malarky, "nil" + should_set_session :special, "'$2 off your next purchase'" + should_set_session :special_user_id, '@user.id' + context "with a block" do + should_set_session(:special_user_id) { @user.id } + end + should_fail do # to avoid redefining a test + should_set_session(:special_user_id) { 'value' } + end + should_assign_to :user, :posts + should_not_assign_to :foo, :bar + end + + context "viewing a post on GET to #show" do + setup { get :show, :user_id => users(:first), :id => posts(:first) } + should_render_with_layout 'wide' + context "with a symbol" do # to avoid redefining a test + should_render_with_layout :wide + end + should_assign_to :false_flag + end + + context "on GET to #new" do + setup { get :new, :user_id => users(:first) } + should_render_without_layout + end + + context "on POST to #create" do + setup do + post :create, :user_id => users(:first), + :post => { :title => "first post", + :body => 'blah blah blah' } + end + + should_redirect_to 'user_post_url(@post.user, @post)' + should_redirect_to('the created post') { user_post_url(users(:first), + assigns(:post)) } + should_fail do + should_redirect_to 'user_posts_url(@post.user)' + end + should_fail do + should_redirect_to('elsewhere') { user_posts_url(users(:first)) } + end + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb new file mode 100644 index 0000000..cd0205f --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/functional/users_controller_test.rb @@ -0,0 +1,19 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'users_controller' + +# Re-raise errors caught by the controller. +class UsersController; def rescue_action(e) raise e end; end + +class UsersControllerTest < Test::Unit::TestCase + fixtures :all + + def setup + @controller = UsersController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + @user = User.find(:first) + end + + should_filter_params :ssn + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb new file mode 100644 index 0000000..5b12726 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb @@ -0,0 +1,68 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class AllowMassAssignmentOfMatcherTest < Test::Unit::TestCase # :nodoc: + + context "an attribute that is blacklisted from mass-assignment" do + setup do + define_model :example, :attr => :string do + attr_protected :attr + end + @model = Example.new + end + + should "reject being mass-assignable" do + assert_rejects allow_mass_assignment_of(:attr), @model + end + end + + context "an attribute that is not whitelisted for mass-assignment" do + setup do + define_model :example, :attr => :string, :other => :string do + attr_accessible :other + end + @model = Example.new + end + + should "reject being mass-assignable" do + assert_rejects allow_mass_assignment_of(:attr), @model + end + end + + context "an attribute that is whitelisted for mass-assignment" do + setup do + define_model :example, :attr => :string do + attr_accessible :attr + end + @model = Example.new + end + + should "accept being mass-assignable" do + assert_accepts allow_mass_assignment_of(:attr), @model + end + end + + context "an attribute not included in the mass-assignment blacklist" do + setup do + define_model :example, :attr => :string, :other => :string do + attr_protected :other + end + @model = Example.new + end + + should "accept being mass-assignable" do + assert_accepts allow_mass_assignment_of(:attr), @model + end + end + + context "an attribute on a class with no protected attributes" do + setup do + define_model :example, :attr => :string + @model = Example.new + end + + should "accept being mass-assignable" do + assert_accepts allow_mass_assignment_of(:attr), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb new file mode 100644 index 0000000..11fcc56 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/allow_value_matcher_test.rb @@ -0,0 +1,41 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class AllowValueMatcherTest < Test::Unit::TestCase # :nodoc: + + context "an attribute with a format validation" do + setup do + define_model :example, :attr => :string do + validates_format_of :attr, :with => /abc/ + end + @model = Example.new + end + + should "allow a good value" do + assert_accepts allow_value("abcde").for(:attr), @model + end + + should "not allow a bad value" do + assert_rejects allow_value("xyz").for(:attr), @model + end + end + + context "an attribute with a format validation and a custom message" do + setup do + define_model :example, :attr => :string do + validates_format_of :attr, :with => /abc/, :message => 'bad value' + end + @model = Example.new + end + + should "allow a good value" do + assert_accepts allow_value('abcde').for(:attr).with_message(/bad/), + @model + end + + should "not allow a bad value" do + assert_rejects allow_value('xyz').for(:attr).with_message(/bad/), + @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb new file mode 100644 index 0000000..703537e --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/association_matcher_test.rb @@ -0,0 +1,258 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class AssociationMatcherTest < Test::Unit::TestCase # :nodoc: + + context "belong_to" do + setup do + @matcher = belong_to(:parent) + end + + should "accept a good association with the default foreign key" do + define_model :parent + define_model :child, :parent_id => :integer do + belongs_to :parent + end + assert_accepts @matcher, Child.new + end + + should "reject a nonexistent association" do + define_model :child + assert_rejects @matcher, Child.new + end + + should "reject an association of the wrong type" do + define_model :parent, :child_id => :integer + child_class = define_model :child do + has_one :parent + end + assert_rejects @matcher, Child.new + end + + should "reject an association that has a nonexistent foreign key" do + define_model :parent + define_model :child do + belongs_to :parent + end + assert_rejects @matcher, Child.new + end + + should "accept an association with an existing custom foreign key" do + define_model :parent + define_model :child, :guardian_id => :integer do + belongs_to :parent, :foreign_key => 'guardian_id' + end + assert_accepts @matcher, Child.new + end + + should "accept a polymorphic association" do + define_model :child, :parent_type => :string, + :parent_id => :integer do + belongs_to :parent, :polymorphic => true + end + assert_accepts @matcher, Child.new + end + + should "accept an association with a valid :dependent option" do + define_model :parent + define_model :child, :parent_id => :integer do + belongs_to :parent, :dependent => :destroy + end + assert_accepts @matcher.dependent(:destroy), Child.new + end + + should "reject an association with a bad :dependent option" do + define_model :parent + define_model :child, :parent_id => :integer do + belongs_to :parent + end + assert_rejects @matcher.dependent(:destroy), Child.new + end + end + + context "have_many" do + setup do + @matcher = have_many(:children) + end + + should "accept a valid association without any options" do + define_model :child, :parent_id => :integer + define_model :parent do + has_many :children + end + assert_accepts @matcher, Parent.new + end + + should "accept a valid association with a :through option" do + define_model :child + define_model :conception, :child_id => :integer, + :parent_id => :integer do + belongs_to :child + end + define_model :parent do + has_many :conceptions + has_many :children, :through => :conceptions + end + assert_accepts @matcher, Parent.new + end + + should "accept a valid association with an :as option" do + define_model :child, :guardian_type => :string, + :guardian_id => :integer + define_model :parent do + has_many :children, :as => :guardian + end + assert_accepts @matcher, Parent.new + end + + should "reject an association that has a nonexistent foreign key" do + define_model :child + define_model :parent do + has_many :children + end + assert_rejects @matcher, Parent.new + end + + should "reject an association with a bad :as option" do + define_model :child, :caretaker_type => :string, + :caretaker_id => :integer + define_model :parent do + has_many :children, :as => :guardian + end + assert_rejects @matcher, Parent.new + end + + should "reject an association that has a bad :through option" do + define_model :child, :parent_id => :integer + define_model :parent do + has_many :children + end + assert_rejects @matcher.through(:conceptions), Parent.new + end + + should "reject an association that has the wrong :through option" do + define_model :child + define_model :conception, :child_id => :integer, + :parent_id => :integer do + belongs_to :child + end + define_model :parent do + has_many :conceptions + has_many :children, :through => :conceptions + end + assert_rejects @matcher.through(:relationships), Parent.new + end + + should "accept an association with a valid :dependent option" do + define_model :child, :parent_id => :integer + define_model :parent do + has_many :children, :dependent => :destroy + end + assert_accepts @matcher.dependent(:destroy), Parent.new + end + + should "reject an association with a bad :dependent option" do + define_model :child, :parent_id => :integer + define_model :parent do + has_many :children + end + assert_rejects @matcher.dependent(:destroy), Parent.new + end + end + + context "have_one" do + setup do + @matcher = have_one(:profile) + end + + should "accept a valid association without any options" do + define_model :profile, :person_id => :integer + define_model :person do + has_one :profile + end + assert_accepts @matcher, Person.new + end + + should "accept a valid association with an :as option" do + define_model :profile, :profilable_id => :integer, + :profilable_type => :string + define_model :person do + has_one :profile, :as => :profilable + end + assert_accepts @matcher, Person.new + end + + should "reject an association that has a nonexistent foreign key" do + define_model :profile + define_model :person do + has_one :profile + end + assert_rejects @matcher, Person.new + end + + should "reject an association with a bad :as option" do + define_model :profile, :profilable_id => :integer, + :profilable_type => :string + define_model :person do + has_one :profile, :as => :describable + end + assert_rejects @matcher, Person.new + end + + should "accept an association with a valid :dependent option" do + define_model :profile, :person_id => :integer + define_model :person do + has_one :profile, :dependent => :destroy + end + assert_accepts @matcher.dependent(:destroy), Person.new + end + + should "reject an association with a bad :dependent option" do + define_model :profile, :person_id => :integer + define_model :person do + has_one :profile + end + assert_rejects @matcher.dependent(:destroy), Person.new + end + end + + context "have_and_belong_to_many" do + setup do + @matcher = have_and_belong_to_many(:relatives) + end + + should "accept a valid association" do + define_model :relatives + define_model :person do + has_and_belongs_to_many :relatives + end + define_model :people_relative, :person_id => :integer, + :relative_id => :integer + assert_accepts @matcher, Person.new + end + + should "reject a nonexistent association" do + define_model :relatives + define_model :person + define_model :people_relative, :person_id => :integer, + :relative_id => :integer + assert_rejects @matcher, Person.new + end + + should "reject an association with a nonexistent join table" do + define_model :relatives + define_model :person do + has_and_belongs_to_many :relatives + end + assert_rejects @matcher, Person.new + end + + should "reject an association of the wrong type" do + define_model :relatives, :person_id => :integer + define_model :person do + has_many :relatives + end + assert_rejects @matcher, Person.new + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb new file mode 100644 index 0000000..bb0b45f --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb @@ -0,0 +1,80 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class EnsureInclusionOfMatcherTest < Test::Unit::TestCase # :nodoc: + + context "an attribute which must be included in a range" do + setup do + @model = define_model(:example, :attr => :integer) do + validates_inclusion_of :attr, :in => 2..5 + end.new + end + + should "accept ensuring the correct range" do + assert_accepts ensure_inclusion_of(:attr).in_range(2..5), @model + end + + should "reject ensuring a lower minimum value" do + assert_rejects ensure_inclusion_of(:attr).in_range(1..5), @model + end + + should "reject ensuring a higher minimum value" do + assert_rejects ensure_inclusion_of(:attr).in_range(3..5), @model + end + + should "reject ensuring a lower maximum value" do + assert_rejects ensure_inclusion_of(:attr).in_range(2..4), @model + end + + should "reject ensuring a higher maximum value" do + assert_rejects ensure_inclusion_of(:attr).in_range(2..6), @model + end + + should "not override the default message with a blank" do + assert_accepts ensure_inclusion_of(:attr). + in_range(2..5). + with_message(nil), + @model + end + end + + context "an attribute with a custom ranged value validation" do + setup do + @model = define_model(:example, :attr => :string) do + validates_inclusion_of :attr, :in => 2..4, :message => 'not good' + + end.new + end + + should "accept ensuring the correct range" do + assert_accepts ensure_inclusion_of(:attr). + in_range(2..4). + with_message(/not good/), + @model + end + end + + context "an attribute with custom range validations" do + setup do + define_model :example, :attr => :integer do + def validate + if attr < 2 + errors.add(:attr, 'too low') + elsif attr > 5 + errors.add(:attr, 'too high') + end + end + end + @model = Example.new + end + + should "accept ensuring the correct range and messages" do + assert_accepts ensure_inclusion_of(:attr). + in_range(2..5). + with_low_message(/low/). + with_high_message(/high/), + @model + end + + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb new file mode 100644 index 0000000..a41d5f0 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/ensure_length_of_matcher_test.rb @@ -0,0 +1,158 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class EnsureLengthOfMatcher < Test::Unit::TestCase # :nodoc: + + context "an attribute with a non-zero minimum length validation" do + setup do + @model = define_model(:example, :attr => :string) do + validates_length_of :attr, :minimum => 4 + end.new + end + + should "accept ensuring the correct minimum length" do + assert_accepts ensure_length_of(:attr).is_at_least(4), @model + end + + should "reject ensuring a lower minimum length with any message" do + assert_rejects ensure_length_of(:attr). + is_at_least(3). + with_short_message(/.*/), + @model + end + + should "reject ensuring a higher minimum length with any message" do + assert_rejects ensure_length_of(:attr). + is_at_least(5). + with_short_message(/.*/), + @model + end + + should "not override the default message with a blank" do + assert_accepts ensure_length_of(:attr). + is_at_least(4). + with_short_message(nil), + @model + end + end + + context "an attribute with a minimum length validation of 0" do + setup do + @model = define_model(:example, :attr => :string) do + validates_length_of :attr, :minimum => 0 + end.new + end + + should "accept ensuring the correct minimum length" do + assert_accepts ensure_length_of(:attr).is_at_least(0), @model + end + end + + context "an attribute with a maximum length" do + setup do + @model = define_model(:example, :attr => :string) do + validates_length_of :attr, :maximum => 4 + end.new + end + + should "accept ensuring the correct maximum length" do + assert_accepts ensure_length_of(:attr).is_at_most(4), @model + end + + should "reject ensuring a lower maximum length with any message" do + assert_rejects ensure_length_of(:attr). + is_at_most(3). + with_long_message(/.*/), + @model + end + + should "reject ensuring a higher maximum length with any message" do + assert_rejects ensure_length_of(:attr). + is_at_most(5). + with_long_message(/.*/), + @model + end + + should "not override the default message with a blank" do + assert_accepts ensure_length_of(:attr). + is_at_most(4). + with_long_message(nil), + @model + end + end + + context "an attribute with a required exact length" do + setup do + @model = define_model(:example, :attr => :string) do + validates_length_of :attr, :is => 4 + end.new + end + + should "accept ensuring the correct length" do + assert_accepts ensure_length_of(:attr).is_equal_to(4), @model + end + + should "reject ensuring a lower maximum length with any message" do + assert_rejects ensure_length_of(:attr). + is_equal_to(3). + with_message(/.*/), + @model + end + + should "reject ensuring a higher maximum length with any message" do + assert_rejects ensure_length_of(:attr). + is_equal_to(5). + with_message(/.*/), + @model + end + + should "not override the default message with a blank" do + assert_accepts ensure_length_of(:attr). + is_equal_to(4). + with_message(nil), + @model + end + end + + context "an attribute with a custom minimum length validation" do + setup do + @model = define_model(:example, :attr => :string) do + validates_length_of :attr, :minimum => 4, :too_short => 'short' + end.new + end + + should "accept ensuring the correct minimum length" do + assert_accepts ensure_length_of(:attr). + is_at_least(4). + with_short_message(/short/), + @model + end + + end + + context "an attribute with a custom maximum length validation" do + setup do + @model = define_model(:example, :attr => :string) do + validates_length_of :attr, :maximum => 4, :too_long => 'long' + end.new + end + + should "accept ensuring the correct minimum length" do + assert_accepts ensure_length_of(:attr). + is_at_most(4). + with_long_message(/long/), + @model + end + + end + + context "an attribute without a length validation" do + setup do + @model = define_model(:example, :attr => :string).new + end + + should "reject ensuring a minimum length" do + assert_rejects ensure_length_of(:attr).is_at_least(1), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb new file mode 100644 index 0000000..5afeeec --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_db_column_matcher_test.rb @@ -0,0 +1,169 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class HaveDbColumnMatcherTest < Test::Unit::TestCase # :nodoc: + + context "have_db_column" do + setup do + @matcher = have_db_column(:nickname) + end + + should "accept an existing database column" do + create_table 'superheros' do |table| + table.string :nickname + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a nonexistent database column" do + define_model :superhero + assert_rejects @matcher, Superhero.new + end + end + + context "have_db_column of type string" do + setup do + @matcher = have_db_column(:nickname).of_type(:string) + end + + should "accept a column of correct type" do + create_table 'superheros' do |table| + table.string :nickname + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a nonexistent database column" do + define_model :superhero + assert_rejects @matcher, Superhero.new + end + + should "reject a column of wrong type" do + create_table 'superheros' do |table| + table.integer :nickname + end + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + + context "have_db_column with precision option" do + setup do + @matcher = have_db_column(:salary).with_options(:precision => 5) + end + + should "accept a column of correct precision" do + create_table 'superheros' do |table| + table.decimal :salary, :precision => 5 + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a column of wrong precision" do + create_table 'superheros' do |table| + table.decimal :salary, :precision => 15 + end + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + + context "have_db_column with limit option" do + setup do + @matcher = have_db_column(:email). + of_type(:string). + with_options(:limit => 255) + end + + should "accept a column of correct limit" do + create_table 'superheros' do |table| + table.string :email, :limit => 255 + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a column of wrong limit" do + create_table 'superheros' do |table| + table.string :email, :limit => 500 + end + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + + context "have_db_column with default option" do + setup do + @matcher = have_db_column(:admin). + of_type(:boolean). + with_options(:default => false) + end + + should "accept a column of correct default" do + create_table 'superheros' do |table| + table.boolean :admin, :default => false + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a column of wrong default" do + create_table 'superheros' do |table| + table.boolean :admin, :default => true + end + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + + context "have_db_column with null option" do + setup do + @matcher = have_db_column(:admin). + of_type(:boolean). + with_options(:null => false) + end + + should "accept a column of correct null" do + create_table 'superheros' do |table| + table.boolean :admin, :null => false + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a column of wrong null" do + create_table 'superheros' do |table| + table.boolean :admin, :null => true + end + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + + context "have_db_column with scale option" do + setup do + @matcher = have_db_column(:salary). + of_type(:decimal). + with_options(:scale => 2) + end + + should "accept a column of correct scale" do + create_table 'superheros' do |table| + table.decimal :salary, :precision => 10, :scale => 2 + end + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a column of wrong scale" do + create_table 'superheros' do |table| + table.decimal :salary, :precision => 10, :scale => 4 + end + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb new file mode 100644 index 0000000..a7cea9f --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_index_matcher_test.rb @@ -0,0 +1,74 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class HaveIndexMatcherTest < Test::Unit::TestCase # :nodoc: + + context "have_index" do + setup do + @matcher = have_index(:age) + end + + should "accept an existing index" do + db_connection = create_table 'superheros' do |table| + table.integer :age + end + db_connection.add_index :superheros, :age + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject a nonexistent index" do + define_model :superhero + assert_rejects @matcher, Superhero.new + end + end + + context "have_index with unique option" do + setup do + @matcher = have_index(:ssn).unique(true) + end + + should "accept an index of correct unique" do + db_connection = create_table 'superheros' do |table| + table.integer :ssn + end + db_connection.add_index :superheros, :ssn, :unique => true + define_model_class 'Superhero' + assert_accepts @matcher, Superhero.new + end + + should "reject an index of wrong unique" do + db_connection = create_table 'superheros' do |table| + table.integer :ssn + end + db_connection.add_index :superheros, :ssn, :unique => false + define_model_class 'Superhero' + assert_rejects @matcher, Superhero.new + end + end + + context "have_index on multiple columns" do + setup do + @matcher = have_index([:geocodable_type, :geocodable_id]) + end + + should "accept an existing index" do + db_connection = create_table 'geocodings' do |table| + table.integer :geocodable_id + table.string :geocodable_type + end + db_connection.add_index :geocodings, [:geocodable_type, :geocodable_id] + define_model_class 'Geocoding' + assert_accepts @matcher, Geocoding.new + end + + should "reject a nonexistant index" do + db_connection = create_table 'geocodings' do |table| + table.integer :geocodable_id + table.string :geocodable_type + end + define_model_class 'Geocoding' + assert_rejects @matcher, Geocoding.new + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb new file mode 100644 index 0000000..2e9ecb5 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_named_scope_matcher_test.rb @@ -0,0 +1,65 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class HaveNamedScopeMatcherTest < Test::Unit::TestCase # :nodoc: + + context "an attribute with a named scope" do + setup do + define_model :example, :attr => :string do + named_scope :xyz, lambda {|n| + { :order => :attr } + } + end + @model = Example.new + end + + should "accept having a scope with the correct signature" do + assert_accepts have_named_scope("xyz(1)"), @model + end + + should "accept having a scope with the correct signature and find options" do + assert_accepts have_named_scope("xyz(1)").finding(:order => :attr), @model + end + + should "reject having a scope with incorrect find options" do + assert_rejects have_named_scope("xyz(1)"). + finding(:order => 'attr DESC'), + @model + end + + should "reject having a scope with another name" do + assert_rejects have_named_scope("abc(1)"), @model + end + + end + + should "evaluate the scope in the correct context" do + define_model :example, :attr => :string do + named_scope :xyz, lambda {|n| + { :order => n } + } + end + model = Example.new + @order = :attr + assert_accepts have_named_scope("xyz(@order)"). + finding(:order => @order). + in_context(self), + model + end + + context "a method that does not return a scope" do + setup do + klass = Class.new + klass.class_eval do + def self.xyz + 'xyz' + end + end + @model = klass.new + end + + should "reject having a named scope with that name" do + assert_rejects have_named_scope(:xyz), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb new file mode 100644 index 0000000..81a47c8 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/have_readonly_attributes_matcher_test.rb @@ -0,0 +1,29 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class HaveReadonlyAttributesMatcherTest < Test::Unit::TestCase # :nodoc: + + context "an attribute that cannot be set after being saved" do + setup do + define_model :example, :attr => :string do + attr_readonly :attr + end + @model = Example.new + end + + should "accept being read-only" do + assert_accepts have_readonly_attribute(:attr), @model + end + end + + context "an attribute that can be set after being saved" do + setup do + define_model :example, :attr => :string + @model = Example.new + end + + should "accept being read-only" do + assert_rejects have_readonly_attribute(:attr), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb new file mode 100644 index 0000000..d19d5ff --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_acceptance_of_matcher_test.rb @@ -0,0 +1,44 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class ValidateAcceptanceOfMatcherTest < Test::Unit::TestCase # :nodoc: + + context "an attribute which must be accepted" do + setup do + @model = define_model(:example) do + validates_acceptance_of :attr + end.new + end + + should "require that attribute to be accepted" do + assert_accepts validate_acceptance_of(:attr), @model + end + + should "not overwrite the default message with nil" do + assert_accepts validate_acceptance_of(:attr).with_message(nil), @model + end + end + + context "an attribute that does not need to be accepted" do + setup do + @model = define_model(:example, :attr => :string).new + end + + should "not require that attribute to be accepted" do + assert_rejects validate_acceptance_of(:attr), @model + end + end + + context "an attribute which must be accepted with a custom message" do + setup do + @model = define_model(:example) do + validates_acceptance_of :attr, :message => 'custom' + end.new + end + + should "require that attribute to be accepted with that message" do + assert_accepts validate_acceptance_of(:attr).with_message(/custom/), + @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb new file mode 100644 index 0000000..f9ab3a1 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_numericality_of_matcher_test.rb @@ -0,0 +1,52 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class ValidateNumericalityOfMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a numeric attribute" do + setup do + define_model :example, :attr => :string do + validates_numericality_of :attr + end + @model = Example.new + end + + should "only allow numeric values for that attribute" do + assert_accepts validate_numericality_of(:attr), @model + end + + should "not override the default message with a blank" do + assert_accepts validate_numericality_of(:attr).with_message(nil), + @model + end + end + + context "a numeric attribute with a custom validation message" do + setup do + define_model :example, :attr => :string do + validates_numericality_of :attr, :message => 'custom' + end + @model = Example.new + end + + should "only allow numeric values for that attribute with that message" do + assert_accepts validate_numericality_of(:attr). + with_message(/custom/), + @model + end + + should "not allow numeric values for that attribute with another message" do + assert_rejects validate_numericality_of(:attr), @model + end + end + + context "a non-numeric attribute" do + setup do + @model = define_model(:example, :attr => :string).new + end + + should "not only allow numeric values for that attribute" do + assert_rejects validate_numericality_of(:attr), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb new file mode 100644 index 0000000..f59440a --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_presence_of_matcher_test.rb @@ -0,0 +1,86 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class ValidatePresenceOfMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a required attribute" do + setup do + define_model :example, :attr => :string do + validates_presence_of :attr + end + @model = Example.new + end + + should "require a value" do + assert_accepts validate_presence_of(:attr), @model + end + + should "not override the default message with a blank" do + assert_accepts validate_presence_of(:attr).with_message(nil), @model + end + end + + context "an optional attribute" do + setup do + @model = define_model(:example, :attr => :string).new + end + + should "not require a value" do + assert_rejects validate_presence_of(:attr), @model + end + end + + context "a required has_many association" do + setup do + define_model :child + @model = define_model :parent do + has_many :children + validates_presence_of :children + end.new + end + + should "require the attribute to be set" do + assert_accepts validate_presence_of(:children), @model + end + end + + context "an optional has_many association" do + setup do + define_model :child + @model = define_model :parent do + has_many :children + end.new + end + + should "not require the attribute to be set" do + assert_rejects validate_presence_of(:children), @model + end + end + + context "a required has_and_belongs_to_many association" do + setup do + define_model :child + @model = define_model :parent do + has_and_belongs_to_many :children + validates_presence_of :children + end.new + end + + should "require the attribute to be set" do + assert_accepts validate_presence_of(:children), @model + end + end + + context "an optional has_and_belongs_to_many association" do + setup do + define_model :child + @model = define_model :parent do + has_and_belongs_to_many :children + end.new + end + + should "not require the attribute to be set" do + assert_rejects validate_presence_of(:children), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb new file mode 100644 index 0000000..cf7c0f9 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb @@ -0,0 +1,147 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class ValidateUniquenessOfMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a unique attribute" do + setup do + @model = define_model(:example, :attr => :string, + :other => :integer) do + validates_uniqueness_of :attr + end.new + end + + context "with an existing value" do + setup do + @existing = Example.create!(:attr => 'value', :other => 1) + end + + should "require a unique value for that attribute" do + assert_accepts validate_uniqueness_of(:attr), @model + end + + should "pass when the subject is an existing record" do + assert_accepts validate_uniqueness_of(:attr), @existing + end + + should "fail when a scope is specified" do + assert_rejects validate_uniqueness_of(:attr).scoped_to(:other), @model + end + end + + context "without an existing value" do + setup do + assert_nil Example.find(:first) + @matcher = validate_uniqueness_of(:attr) + end + + should "fail to require a unique value" do + assert_rejects @matcher, @model + end + + should "alert the tester that an existing value is not present" do + @matcher.matches?(@model) + assert @matcher.negative_failure_message =~ /^Can't find first .*/ + end + end + end + + context "a unique attribute with a custom error and an existing value" do + setup do + @model = define_model(:example, :attr => :string) do + validates_uniqueness_of :attr, :message => 'Bad value' + end.new + Example.create! + end + + should "fail when checking the default message" do + assert_rejects validate_uniqueness_of(:attr), @model + end + + should "fail when checking a message that doesn't match" do + assert_rejects validate_uniqueness_of(:attr).with_message(/abc/i), @model + end + + should "pass when checking a message that matches" do + assert_accepts validate_uniqueness_of(:attr).with_message(/bad/i), @model + end + end + + context "a scoped unique attribute with an existing value" do + setup do + @model = define_model(:example, :attr => :string, + :scope1 => :integer, + :scope2 => :integer) do + validates_uniqueness_of :attr, :scope => [:scope1, :scope2] + end.new + @existing = Example.create!(:attr => 'value', :scope1 => 1, :scope2 => 2) + end + + should "pass when the correct scope is specified" do + assert_accepts validate_uniqueness_of(:attr).scoped_to(:scope1, :scope2), + @model + end + + should "pass when the subject is an existing record" do + assert_accepts validate_uniqueness_of(:attr).scoped_to(:scope1, :scope2), + @existing + end + + should "fail when a different scope is specified" do + assert_rejects validate_uniqueness_of(:attr).scoped_to(:scope1), @model + end + + should "fail when no scope is specified" do + assert_rejects validate_uniqueness_of(:attr), @model + end + + should "fail when a non-existent attribute is specified as a scope" do + assert_rejects validate_uniqueness_of(:attr).scoped_to(:fake), @model + end + end + + context "a non-unique attribute with an existing value" do + setup do + @model = define_model(:example, :attr => :string).new + Example.create!(:attr => 'value') + end + + should "not require a unique value for that attribute" do + assert_rejects validate_uniqueness_of(:attr), @model + end + end + + context "a case sensitive unique attribute with an existing value" do + setup do + @model = define_model(:example, :attr => :string) do + validates_uniqueness_of :attr, :case_sensitive => true + end.new + Example.create!(:attr => 'value') + end + + should "not require a unique, case-insensitive value for that attribute" do + assert_rejects validate_uniqueness_of(:attr).case_insensitive, @model + end + + should "require a unique, case-sensitive value for that attribute" do + assert_accepts validate_uniqueness_of(:attr), @model + end + end + + context "a case sensitive unique integer attribute with an existing value" do + setup do + @model = define_model(:example, :attr => :integer) do + validates_uniqueness_of :attr, :case_sensitive => true + end.new + Example.create!(:attr => 'value') + end + + should "require a unique, case-insensitive value for that attribute" do + assert_accepts validate_uniqueness_of(:attr).case_insensitive, @model + end + + should "require a unique, case-sensitive value for that attribute" do + assert_accepts validate_uniqueness_of(:attr), @model + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb new file mode 100644 index 0000000..4b32724 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/assign_to_matcher_test.rb @@ -0,0 +1,35 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class AssignToMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller that assigns to an instance variable" do + setup do + @controller = build_response { @var = 'value' } + end + + should "accept assigning to that variable" do + assert_accepts assign_to(:var), @controller + end + + should "accept assigning to that variable with the correct class" do + assert_accepts assign_to(:var).with_kind_of(String), @controller + end + + should "reject assigning to that variable with another class" do + assert_rejects assign_to(:var).with_kind_of(Fixnum), @controller + end + + should "accept assigning the correct value to that variable" do + assert_accepts assign_to(:var).with('value'), @controller + end + + should "reject assigning another value to that variable" do + assert_rejects assign_to(:var).with('other'), @controller + end + + should "reject assigning to another variable" do + assert_rejects assign_to(:other), @controller + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb new file mode 100644 index 0000000..e8437af --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/filter_param_matcher_test.rb @@ -0,0 +1,32 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class FilterParamMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller that filters no parameters" do + setup do + @controller = define_controller(:examples).new + end + + should "reject filtering any parameter" do + assert_rejects filter_param(:any), @controller + end + end + + context "a controller that filters a parameter" do + setup do + @controller = define_controller :examples do + filter_parameter_logging :password + end.new + end + + should "accept filtering that parameter" do + assert_accepts filter_param(:password), @controller + end + + should "reject filtering another parameter" do + assert_rejects filter_param(:other), @controller + end + end + +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb new file mode 100644 index 0000000..e7f7e2b --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/render_with_layout_matcher_test.rb @@ -0,0 +1,33 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class RenderWithLayoutMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller that renders with a layout" do + setup do + @controller = build_response { render :layout => 'wide' } + end + + should "accept rendering with any layout" do + assert_accepts render_with_layout, @controller + end + + should "accept rendering with that layout" do + assert_accepts render_with_layout(:wide), @controller + end + + should "reject rendering with another layout" do + assert_rejects render_with_layout(:other), @controller + end + end + + context "a controller that renders without a layout" do + setup do + @controller = build_response { render :layout => false } + end + + should "reject rendering with a layout" do + assert_rejects render_with_layout, @controller + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb new file mode 100644 index 0000000..6719ff3 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_content_type_matcher_test.rb @@ -0,0 +1,27 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class RespondWithContentTypeMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller responding with content type :xml" do + setup do + @controller = build_response { render :xml => { :user => "thoughtbot" }.to_xml } + end + + should "accept responding with content type :xml" do + assert_accepts respond_with_content_type(:xml), @controller + end + + should "accept responding with content type 'application/xml'" do + assert_accepts respond_with_content_type('application/xml'), @controller + end + + should "accept responding with content type /xml/" do + assert_accepts respond_with_content_type(/xml/), @controller + end + + should "reject responding with another content type" do + assert_rejects respond_with_content_type(:json), @controller + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb new file mode 100644 index 0000000..759ae16 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/respond_with_matcher_test.rb @@ -0,0 +1,106 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class RespondWithMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller responding with success" do + setup do + @controller = build_response { render :text => "text", :status => 200 } + end + + should "accept responding with 200" do + assert_accepts respond_with(200), @controller + end + + should "accept responding with :success" do + assert_accepts respond_with(:success), @controller + end + + should "reject responding with another status" do + assert_rejects respond_with(:error), @controller + end + end + + context "a controller responding with redirect" do + setup do + @controller = build_response { render :text => "text", :status => 301 } + end + + should "accept responding with 301" do + assert_accepts respond_with(301), @controller + end + + should "accept responding with :redirect" do + assert_accepts respond_with(:redirect), @controller + end + + should "reject responding with another status" do + assert_rejects respond_with(:error), @controller + end + end + + context "a controller responding with missing" do + setup do + @controller = build_response { render :text => "text", :status => 404 } + end + + should "accept responding with 404" do + assert_accepts respond_with(404), @controller + end + + should "accept responding with :missing" do + assert_accepts respond_with(:missing), @controller + end + + should "reject responding with another status" do + assert_rejects respond_with(:success), @controller + end + end + + context "a controller responding with error" do + setup do + @controller = build_response { render :text => "text", :status => 500 } + end + + should "accept responding with 500" do + assert_accepts respond_with(500), @controller + end + + should "accept responding with :error" do + assert_accepts respond_with(:error), @controller + end + + should "reject responding with another status" do + assert_rejects respond_with(:success), @controller + end + end + + context "a controller responding with not implemented" do + setup do + @controller = build_response { render :text => "text", :status => 501 } + end + + should "accept responding with 501" do + assert_accepts respond_with(501), @controller + end + + should "accept responding with :not_implemented" do + assert_accepts respond_with(:not_implemented), @controller + end + + should "reject responding with another status" do + assert_rejects respond_with(:success), @controller + end + end + + context "a controller raising an error" do + setup do + @controller = build_response { raise RailsError } + end + + should "reject responding with any status" do + assert_rejects respond_with(:success), @controller + end + end + +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb new file mode 100644 index 0000000..ede9b4d --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/route_matcher_test.rb @@ -0,0 +1,58 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class RouteToMatcherTest < Test::Unit::TestCase # :nodoc: + + context "given a controller with a defined route" do + setup do + @controller = define_controller('Examples').new + define_routes do |map| + map.connect 'examples/:id', :controller => 'examples', + :action => 'example' + end + end + + should "accept routing the correct path to the correct parameters" do + assert_accepts route(:get, '/examples/1'). + to(:action => 'example', :id => '1'), + @controller + end + + should "accept a symbol controller" do + assert_accepts route(:get, '/examples/1'). + to(:controller => :examples, + :action => 'example', + :id => '1'), + self + end + + should "accept a symbol action" do + assert_accepts route(:get, '/examples/1'). + to(:action => :example, :id => '1'), + @controller + end + + should "accept a non-string parameter" do + assert_accepts route(:get, '/examples/1'). + to(:action => 'example', :id => 1), + @controller + end + + should "reject an undefined route" do + assert_rejects route(:get, '/bad_route').to(:var => 'value'), @controller + end + + should "reject a route for another controller" do + @other = define_controller('Other').new + assert_rejects route(:get, '/examples/1'). + to(:action => 'example', :id => '1'), + @other + end + + should "reject a route for different parameters" do + assert_rejects route(:get, '/examples/1'). + to(:action => 'other', :id => '1'), + @controller + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb new file mode 100644 index 0000000..771bce3 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_session_matcher_test.rb @@ -0,0 +1,31 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class SetSessionMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller that sets a session variable" do + setup do + @controller = build_response { session[:var] = 'value' } + end + + should "accept assigning to that variable" do + assert_accepts set_session(:var), @controller + end + + should "accept assigning the correct value to that variable" do + assert_accepts set_session(:var).to('value'), @controller + end + + should "reject assigning another value to that variable" do + assert_rejects set_session(:var).to('other'), @controller + end + + should "reject assigning to another variable" do + assert_rejects set_session(:other), @controller + end + + should "accept assigning nil to another variable" do + assert_accepts set_session(:other).to(nil), @controller + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb new file mode 100644 index 0000000..4d0a17d --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/matchers/controller/set_the_flash_matcher.rb @@ -0,0 +1,41 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class SetTheFlashMatcherTest < Test::Unit::TestCase # :nodoc: + + context "a controller that sets a flash message" do + setup do + @controller = build_response { flash[:notice] = 'value' } + end + + should "accept setting any flash message" do + assert_accepts set_the_flash, @controller + end + + should "accept setting the exact flash message" do + assert_accepts set_the_flash.to('value'), @controller + end + + should "accept setting a matched flash message" do + assert_accepts set_the_flash.to(/value/), @controller + end + + should "reject setting a different flash message" do + assert_rejects set_the_flash.to('other'), @controller + end + + should "reject setting a different pattern" do + assert_rejects set_the_flash.to(/other/), @controller + end + end + + context "a controller that doesn't set a flash message" do + setup do + @controller = build_response + end + + should "reject setting any flash message" do + assert_rejects set_the_flash, @controller + end + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb new file mode 100644 index 0000000..084f1a7 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/model_builder.rb @@ -0,0 +1,106 @@ +class Test::Unit::TestCase + def create_table(table_name, &block) + connection = ActiveRecord::Base.connection + + begin + connection.execute("DROP TABLE IF EXISTS #{table_name}") + connection.create_table(table_name, &block) + @created_tables ||= [] + @created_tables << table_name + connection + rescue Exception => e + connection.execute("DROP TABLE IF EXISTS #{table_name}") + raise e + end + end + + def define_constant(class_name, base, &block) + class_name = class_name.to_s.camelize + + klass = Class.new(base) + Object.const_set(class_name, klass) + + klass.class_eval(&block) if block_given? + + @defined_constants ||= [] + @defined_constants << class_name + + klass + end + + def define_model_class(class_name, &block) + define_constant(class_name, ActiveRecord::Base, &block) + end + + def define_model(name, columns = {}, &block) + class_name = name.to_s.pluralize.classify + table_name = class_name.tableize + + create_table(table_name) do |table| + columns.each do |name, type| + table.column name, type + end + end + + define_model_class(class_name, &block) + end + + def define_controller(class_name, &block) + class_name = class_name.to_s + class_name << 'Controller' unless class_name =~ /Controller$/ + define_constant(class_name, ActionController::Base, &block) + end + + def define_routes(&block) + @replaced_routes = ActionController::Routing::Routes + new_routes = ActionController::Routing::RouteSet.new + silence_warnings do + ActionController::Routing.const_set('Routes', new_routes) + end + new_routes.draw(&block) + end + + def build_response(&block) + klass = define_controller('Examples') + block ||= lambda { render :nothing => true } + klass.class_eval { define_method(:example, &block) } + define_routes do |map| + map.connect 'examples', :controller => 'examples', :action => 'example' + end + + @controller = klass.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + get :example + + @controller + end + + def teardown_with_models + if @defined_constants + @defined_constants.each do |class_name| + Object.send(:remove_const, class_name) + end + end + + if @created_tables + @created_tables.each do |table_name| + ActiveRecord::Base. + connection. + execute("DROP TABLE IF EXISTS #{table_name}") + end + end + + if @replaced_routes + ActionController::Routing::Routes.clear! + silence_warnings do + ActionController::Routing.const_set('Routes', @replaced_routes) + end + @replaced_routes.reload! + end + + teardown_without_models + end + alias_method :teardown_without_models, :teardown + alias_method :teardown, :teardown_with_models +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb new file mode 100644 index 0000000..ecfa356 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/autoload_macro_test.rb @@ -0,0 +1,18 @@ +require File.join(File.dirname(__FILE__), '..', 'test_helper') + +class AutoloadMacroTest < Test::Unit::TestCase # :nodoc: + context "The macro auto-loader" do + should "load macros from the plugins" do + assert self.class.respond_to?('plugin_macro') + end + + should "load macros from the gems" do + assert self.class.respond_to?('gem_macro') + end + + should "load custom macros from ROOT/test/shoulda_macros" do + assert self.class.respond_to?('custom_macro') + end + end +end + diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb new file mode 100644 index 0000000..352ea14 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/context_test.rb @@ -0,0 +1,145 @@ +require File.join(File.dirname(__FILE__), '..', 'test_helper') + +class ContextTest < Test::Unit::TestCase # :nodoc: + + def self.context_macro(&blk) + context "with a subcontext made by a macro" do + setup { @context_macro = :foo } + + merge_block &blk + end + end + + # def self.context_macro(&blk) + # context "with a subcontext made by a macro" do + # setup { @context_macro = :foo } + # yield # <- this doesn't work. + # end + # end + + context "context with setup block" do + setup do + @blah = "blah" + end + + should "run the setup block" do + assert_equal "blah", @blah + end + + should "have name set right" do + assert_match(/^test: context with setup block/, self.to_s) + end + + context "and a subcontext" do + setup do + @blah = "#{@blah} twice" + end + + should "be named correctly" do + assert_match(/^test: context with setup block and a subcontext should be named correctly/, self.to_s) + end + + should "run the setup blocks in order" do + assert_equal @blah, "blah twice" + end + end + + context_macro do + should "have name set right" do + assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, self.to_s) + end + + should "run the setup block of that context macro" do + assert_equal :foo, @context_macro + end + + should "run the setup block of the main context" do + assert_equal "blah", @blah + end + end + + end + + context "another context with setup block" do + setup do + @blah = "foo" + end + + should "have @blah == 'foo'" do + assert_equal "foo", @blah + end + + should "have name set right" do + assert_match(/^test: another context with setup block/, self.to_s) + end + end + + context "context with method definition" do + setup do + def hello; "hi"; end + end + + should "be able to read that method" do + assert_equal "hi", hello + end + + should "have name set right" do + assert_match(/^test: context with method definition/, self.to_s) + end + end + + context "another context" do + should "not define @blah" do + assert_nil @blah + end + end + + context "context with multiple setups and/or teardowns" do + + cleanup_count = 0 + + 2.times do |i| + setup { cleanup_count += 1 } + teardown { cleanup_count -= 1 } + end + + 2.times do |i| + should "call all setups and all teardowns (check ##{i + 1})" do + assert_equal 2, cleanup_count + end + end + + context "subcontexts" do + + 2.times do |i| + setup { cleanup_count += 1 } + teardown { cleanup_count -= 1 } + end + + 2.times do |i| + should "also call all setups and all teardowns in parent and subcontext (check ##{i + 1})" do + assert_equal 4, cleanup_count + end + end + + end + + end + + should_eventually "pass, since it's unimplemented" do + flunk "what?" + end + + should_eventually "not require a block when using should_eventually" + should "pass without a block, as that causes it to piggyback to should_eventually" + + context "context for testing should piggybacking" do + should "call should_eventually as we are not passing a block" + end + + context "context" do + context "with nested subcontexts" do + should_eventually "only print this statement once for a should_eventually" + end + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb new file mode 100644 index 0000000..8b0594f --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/convert_to_should_syntax_test.rb @@ -0,0 +1,63 @@ +require 'test/unit' + +class ConvertToShouldSyntaxTest < Test::Unit::TestCase # :nodoc: + + BEFORE_FIXTURE = <<-EOS + class DummyTest < Test::Unit::TestCase + + should "Not change this_word_with_underscores" do + end + + def test_should_be_working + assert true + end + + def test_some_cool_stuff + assert true + end + + def non_test_method + end + + end + EOS + + AFTER_FIXTURE = <<-EOS + class DummyTest < Test::Unit::TestCase + + should "Not change this_word_with_underscores" do + end + + should "be working" do + assert true + end + + should "RENAME ME: test some cool stuff" do + assert true + end + + def non_test_method + end + + end + EOS + + FIXTURE_PATH = "./convert_to_should_syntax_fixture.dat" + + RUBY = ENV['RUBY'] || 'ruby' + + def test_convert_to_should_syntax + File.open(FIXTURE_PATH, "w") {|f| f.write(BEFORE_FIXTURE)} + cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../bin/convert_to_should_syntax')} #{FIXTURE_PATH}" + output = `#{cmd}` + File.unlink($1) if output.match(/has been stored in '([^']+)/) + assert_match(/has been converted/, output) + result = IO.read(FIXTURE_PATH) + assert_equal result, AFTER_FIXTURE + end + + def teardown + File.unlink(FIXTURE_PATH) + end + +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb new file mode 100644 index 0000000..0c581b9 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/helpers_test.rb @@ -0,0 +1,241 @@ +require File.join(File.dirname(__FILE__), '..', 'test_helper') +require 'action_mailer' +require 'mocha' + +class HelpersTest < Test::Unit::TestCase # :nodoc: + + context "given delivered emails" do + setup do + email1 = stub(:subject => "one", :to => ["none1@email.com"]) + email2 = stub(:subject => "two", :to => ["none2@email.com"]) + ActionMailer::Base.stubs(:deliveries).returns([email1, email2]) + end + + should "have sent an email" do + assert_sent_email + + assert_raises(Test::Unit::AssertionFailedError) do + assert_did_not_send_email + end + end + + should "find email one" do + assert_sent_email do |e| + e.subject =~ /one/ + end + end + + should "not find an email that doesn't exist" do + assert_raises(Test::Unit::AssertionFailedError) do + assert_sent_email do |e| + e.subject =~ /whatever/ + end + end + end + end + + context "when there are no emails" do + setup do + ActionMailer::Base.stubs(:deliveries).returns([]) + end + + should "not have sent an email" do + assert_did_not_send_email + + assert_raises(Test::Unit::AssertionFailedError) do + assert_sent_email + end + end + end + + context "an array of values" do + setup do + @a = ['abc', 'def', 3] + end + + [/b/, 'abc', 3].each do |x| + should "contain #{x.inspect}" do + assert_raises(Test::Unit::AssertionFailedError) do + assert_does_not_contain @a, x + end + assert_contains @a, x + end + end + + should "not contain 'wtf'" do + assert_raises(Test::Unit::AssertionFailedError) {assert_contains @a, 'wtf'} + assert_does_not_contain @a, 'wtf' + end + + should "be the same as another array, ordered differently" do + assert_same_elements(@a, [3, "def", "abc"]) + assert_raises(Test::Unit::AssertionFailedError) do + assert_same_elements(@a, [3, 3, "def", "abc"]) + end + assert_raises(Test::Unit::AssertionFailedError) do + assert_same_elements([@a, "abc"].flatten, [3, 3, "def", "abc"]) + end + end + end + + context "an array of values" do + setup do + @a = [1, 2, "(3)"] + end + + context "after adding another value" do + setup do + @a.push(4) + end + + should_change "@a.length", :by => 1 + should_change "@a.length", :from => 3 + should_change "@a.length", :to => 4 + should_change "@a[0]", :by => 0 + should_not_change "@a[0]" + end + + context "after replacing it with an array of strings" do + setup do + @a = %w(a b c d e f) + end + + should_change "@a.length", :by => 3 + should_change "@a.length", :from => 3, :to => 6, :by => 3 + should_change "@a[0]" + should_change "@a[1]", :from => 2, :to => "b" + should_change "@a[2]", :from => /\d/, :to => /\w/ + should_change "@a[3]", :to => String + end + end + + context "assert_good_value" do + should "validate a good email address" do + assert_good_value User.new, :email, "good@example.com" + end + + should "validate a good SSN with a custom message" do + assert_good_value User.new, :ssn, "xxxxxxxxx", /length/ + end + + should "fail to validate a bad email address" do + assert_raises Test::Unit::AssertionFailedError do + assert_good_value User.new, :email, "bad" + end + end + + should "fail to validate a bad SSN that is too short" do + assert_raises Test::Unit::AssertionFailedError do + assert_good_value User.new, :ssn, "x", /length/ + end + end + + should "accept a class as the first argument" do + assert_good_value User, :email, "good@example.com" + end + + context "with an instance variable" do + setup do + @product = Product.new(:tangible => true) + end + + should "use that instance variable" do + assert_good_value Product, :price, "9999", /included/ + end + end + end + + context "assert_bad_value" do + should "invalidate a bad email address" do + assert_bad_value User.new, :email, "bad" + end + + should "invalidate a bad SSN with a custom message" do + assert_bad_value User.new, :ssn, "x", /length/ + end + + should "fail to invalidate a good email address" do + assert_raises Test::Unit::AssertionFailedError do + assert_bad_value User.new, :email, "good@example.com" + end + end + + should "fail to invalidate a good SSN" do + assert_raises Test::Unit::AssertionFailedError do + assert_bad_value User.new, :ssn, "xxxxxxxxx", /length/ + end + end + + should "accept a class as the first argument" do + assert_bad_value User, :email, "bad" + end + + context "with an instance variable" do + setup do + @product = Product.new(:tangible => true) + end + + should "use that instance variable" do + assert_bad_value Product, :price, "0", /included/ + end + end + end + + context "a matching matcher" do + setup do + @matcher = stub('matcher', :matches? => true, + :failure_message => 'bad failure message', + :negative_failure_message => 'big time failure') + end + + should "pass when given to assert_accepts" do + assert_accepts @matcher, 'target' + end + + context "when given to assert_rejects" do + setup do + begin + assert_rejects @matcher, 'target' + rescue Test::Unit::AssertionFailedError => @error + end + end + + should "fail" do + assert_not_nil @error + end + + should "use the error message from the matcher" do + assert_equal 'big time failure', @error.message + end + end + end + + context "a non-matching matcher" do + setup do + @matcher = stub('matcher', :matches? => false, + :failure_message => 'big time failure', + :negative_failure_message => 'bad failure message') + end + + should "pass when given to assert_rejects" do + assert_rejects @matcher, 'target' + end + + context "when given to assert_accepts" do + setup do + begin + assert_accepts @matcher, 'target' + rescue Test::Unit::AssertionFailedError => @error + end + end + + should "fail" do + assert_not_nil @error + end + + should "use the error message from the matcher" do + assert_equal 'big time failure', @error.message + end + end + end +end diff --git a/vendor/plugins/shoulda/test/other/private_helpers_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb similarity index 68% rename from vendor/plugins/shoulda/test/other/private_helpers_test.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb index 9c35999..7b2564a 100644 --- a/vendor/plugins/shoulda/test/other/private_helpers_test.rb +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/private_helpers_test.rb @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), '..', 'test_helper') class PrivateHelpersTest < Test::Unit::TestCase # :nodoc: - include ThoughtBot::Shoulda::ActiveRecord + include Shoulda::Private context "get_options!" do should "remove opts from args" do args = [:a, :b, {}] @@ -9,7 +9,7 @@ class PrivateHelpersTest < Test::Unit::TestCase # :nodoc: assert_equal [:a, :b], args end - should "return wanted opts in order" do + should "return wanted opts in order" do args = [{:one => 1, :two => 2}] one, two = get_options!(args, :one, :two) assert_equal 1, one @@ -23,4 +23,12 @@ class PrivateHelpersTest < Test::Unit::TestCase # :nodoc: end end end + + class ::SomeModel; end + context "model_class" do + should "sniff the class constant from the test class" do + self.expects(:name).returns("SomeModelTest") + assert_equal SomeModel, model_class + end + end end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb new file mode 100644 index 0000000..f32e8f1 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/other/should_test.rb @@ -0,0 +1,266 @@ +require File.join(File.dirname(__FILE__), '..', 'test_helper') + +class ShouldTest < Test::Unit::TestCase # :nodoc: + should "be able to define a should statement outside of a context" do + assert true + end + + should "see the name of my class as ShouldTest" do + assert_equal "ShouldTest", self.class.name + end + + def self.should_see_class_methods + should "be able to see class methods" do + assert true + end + end + + def self.should_see_a_context_block_like_a_Test_Unit_class + should "see a context block as a Test::Unit class" do + assert_equal "ShouldTest", self.class.name + end + end + + def self.should_see_blah + should "see @blah through a macro" do + assert @blah + end + end + + def self.should_not_see_blah + should "not see @blah through a macro" do + assert_nil @blah + end + end + + def self.should_be_able_to_make_context_macros(prefix = nil) + context "a macro" do + should "have the tests named correctly" do + assert_match(/^test: #{prefix}a macro should have the tests named correctly/, self.to_s) + end + end + end + + context "Context" do + + should_see_class_methods + should_see_a_context_block_like_a_Test_Unit_class + should_be_able_to_make_context_macros("Context ") + + should "not define @blah" do + assert ! self.instance_variables.include?("@blah") + end + + should_not_see_blah + + should "be able to define a should statement" do + assert true + end + + should "see the name of my class as ShouldTest" do + assert_equal "ShouldTest", self.class.name + end + + context "with a subcontext" do + should_be_able_to_make_context_macros("Context with a subcontext ") + end + end + + context "Context with setup block" do + setup do + @blah = "blah" + end + + should "have @blah == 'blah'" do + assert_equal "blah", @blah + end + should_see_blah + + should "have name set right" do + assert_match(/^test: Context with setup block/, self.to_s) + end + + context "and a subcontext" do + setup do + @blah = "#{@blah} twice" + end + + should "be named correctly" do + assert_match(/^test: Context with setup block and a subcontext should be named correctly/, self.to_s) + end + + should "run the setup methods in order" do + assert_equal @blah, "blah twice" + end + should_see_blah + end + end + + context "Another context with setup block" do + setup do + @blah = "foo" + end + + should "have @blah == 'foo'" do + assert_equal "foo", @blah + end + + should "have name set right" do + assert_match(/^test: Another context with setup block/, self.to_s) + end + should_see_blah + end + + should_eventually "pass, since it's a should_eventually" do + flunk "what?" + end + + # Context creation and naming + + def test_should_create_a_new_context + assert_nothing_raised do + Shoulda::Context.new("context name", self) do; end + end + end + + def test_should_create_a_nested_context + assert_nothing_raised do + parent = Shoulda::Context.new("Parent", self) do; end + child = Shoulda::Context.new("Child", parent) do; end + end + end + + def test_should_name_a_contexts_correctly + parent = Shoulda::Context.new("Parent", self) do; end + child = Shoulda::Context.new("Child", parent) do; end + grandchild = Shoulda::Context.new("GrandChild", child) do; end + + assert_equal "Parent", parent.full_name + assert_equal "Parent Child", child.full_name + assert_equal "Parent Child GrandChild", grandchild.full_name + end + + # Should statements + + def test_should_have_should_hashes_when_given_should_statements + context = Shoulda::Context.new("name", self) do + should "be good" do; end + should "another" do; end + end + + names = context.shoulds.map {|s| s[:name]} + assert_equal ["another", "be good"], names.sort + end + + # setup and teardown + + def test_should_capture_setup_and_teardown_blocks + context = Shoulda::Context.new("name", self) do + setup do; "setup"; end + teardown do; "teardown"; end + end + + assert_equal "setup", context.setup_blocks.first.call + assert_equal "teardown", context.teardown_blocks.first.call + end + + # building + + def test_should_create_shoulda_test_for_each_should_on_build + context = Shoulda::Context.new("name", self) do + should "one" do; end + should "two" do; end + end + context.expects(:create_test_from_should_hash).with(has_entry(:name => "one")) + context.expects(:create_test_from_should_hash).with(has_entry(:name => "two")) + context.build + end + + def test_should_create_test_methods_on_build + tu_class = Test::Unit::TestCase + context = Shoulda::Context.new("A Context", tu_class) do + should "define the test" do; end + end + + tu_class.expects(:define_method).with(:"test: A Context should define the test. ") + context.build + end + + def test_should_create_test_methods_on_build_when_subcontext + tu_class = Test::Unit::TestCase + context = Shoulda::Context.new("A Context", tu_class) do + context "with a child" do + should "define the test" do; end + end + end + + tu_class.expects(:define_method).with(:"test: A Context with a child should define the test. ") + context.build + end + + # Test::Unit integration + + def test_should_create_a_new_context_and_build_it_on_Test_Unit_context + c = mock("context") + c.expects(:build) + Shoulda::Context.expects(:new).with("foo", kind_of(Class)).returns(c) + self.class.context "foo" do; end + end + + def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should + s = mock("test") + Shoulda::Context.any_instance.expects(:should).with("rock", {}).returns(s) + Shoulda::Context.any_instance.expects(:build) + self.class.should "rock" do; end + end + + def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should_eventually + s = mock("test") + Shoulda::Context.any_instance.expects(:should_eventually).with("rock").returns(s) + Shoulda::Context.any_instance.expects(:build) + self.class.should_eventually "rock" do; end + end + + should "run a :before proc", :before => lambda { @value = "before" } do + assert_equal "before", @value + end + + context "A :before proc" do + setup do + assert_equal "before", @value + @value = "setup" + end + + should "run before the current setup", :before => lambda { @value = "before" } do + assert_equal "setup", @value + end + end + + context "a before statement" do + setup do + assert_equal "before", @value + @value = "setup" + end + + before_should "run before the current setup" do + @value = "before" + end + end + + context "A context" do + setup do + @value = "outer" + end + + context "with a subcontext and a :before proc" do + before = lambda do + assert "outer", @value + @value = "before" + end + should "run after the parent setup", :before => before do + assert_equal "before", @value + end + end + end + +end diff --git a/vendor/plugins/shoulda/test/rails_root/app/controllers/application.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/application.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/controllers/application.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/application.rb diff --git a/vendor/plugins/shoulda/test/rails_root/app/controllers/posts_controller.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb similarity index 71% rename from vendor/plugins/shoulda/test/rails_root/app/controllers/posts_controller.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb index 87b9df1..46c9212 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/controllers/posts_controller.rb +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/posts_controller.rb @@ -1,27 +1,35 @@ class PostsController < ApplicationController before_filter :ensure_logged_in before_filter :load_user - + def index @posts = @user.posts respond_to do |format| format.html # index.rhtml format.xml { render :xml => @posts.to_xml } + format.rss do + headers['Content-Type'] = 'application/rss+xml' + session[:special] = '$2 off your next purchase' + session[:special_user_id] = @user.id + head :ok + end end end def show @post = @user.posts.find(params[:id]) + @false_flag = false respond_to do |format| - format.html # show.rhtml + format.html { render :layout => 'wide' } format.xml { render :xml => @post.to_xml } end end def new @post = @user.posts.build + render :layout => false end def edit @@ -34,8 +42,8 @@ class PostsController < ApplicationController respond_to do |format| if @post.save flash[:notice] = 'Post was successfully created.' - format.html { redirect_to post_url(@post.user, @post) } - format.xml { head :created, :location => post_url(@post.user, @post) } + format.html { redirect_to user_post_url(@post.user, @post) } + format.xml { head :created, :location => user_post_url(@post.user, @post) } else format.html { render :action => "new" } format.xml { render :xml => @post.errors.to_xml } @@ -49,7 +57,7 @@ class PostsController < ApplicationController respond_to do |format| if @post.update_attributes(params[:post]) flash[:notice] = 'Post was successfully updated.' - format.html { redirect_to post_url(@post.user, @post) } + format.html { redirect_to user_post_url(@post.user, @post) } format.xml { head :ok } else format.html { render :action => "edit" } @@ -61,17 +69,17 @@ class PostsController < ApplicationController def destroy @post = @user.posts.find(params[:id]) @post.destroy - + flash[:notice] = "Post was removed" - + respond_to do |format| - format.html { redirect_to posts_url(@post.user) } + format.html { redirect_to user_posts_url(@post.user) } format.xml { head :ok } end end - + private - + def load_user @user = User.find(params[:user_id]) end diff --git a/vendor/plugins/shoulda/test/rails_root/app/controllers/users_controller.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb similarity index 97% rename from vendor/plugins/shoulda/test/rails_root/app/controllers/users_controller.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb index 4fdef93..7a54a30 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/controllers/users_controller.rb +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/controllers/users_controller.rb @@ -1,4 +1,7 @@ class UsersController < ApplicationController + + filter_parameter_logging :ssn + # GET /users # GET /users.xml def index diff --git a/vendor/plugins/shoulda/test/rails_root/app/helpers/application_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/application_helper.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/helpers/application_helper.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/application_helper.rb diff --git a/vendor/plugins/shoulda/test/rails_root/app/helpers/posts_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/posts_helper.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/helpers/posts_helper.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/posts_helper.rb diff --git a/vendor/plugins/shoulda/test/rails_root/app/helpers/users_helper.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/users_helper.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/helpers/users_helper.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/helpers/users_helper.rb diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb new file mode 100644 index 0000000..225903e --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/address.rb @@ -0,0 +1,7 @@ +class Address < ActiveRecord::Base + belongs_to :addressable, :polymorphic => true + validates_uniqueness_of :title, :scope => [:addressable_type, :addressable_id] + + validates_length_of :zip, :minimum => 5 + validates_numericality_of :zip +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb new file mode 100644 index 0000000..0ad2beb --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/flea.rb @@ -0,0 +1,3 @@ +class Flea < ActiveRecord::Base + has_and_belongs_to_many :dogs +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb new file mode 100644 index 0000000..3844c77 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/friendship.rb @@ -0,0 +1,4 @@ +class Friendship < ActiveRecord::Base + belongs_to :user + belongs_to :friend, :class_name => "User" +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb new file mode 100644 index 0000000..c1810c0 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/pets/dog.rb @@ -0,0 +1,10 @@ +module Pets + class Dog < ActiveRecord::Base + belongs_to :user, :foreign_key => :owner_id + belongs_to :address, :dependent => :destroy + has_many :treats + has_and_belongs_to_many :fleas, :join_table => :fleas + validates_presence_of :treats, :fleas + validates_presence_of :owner_id + end +end diff --git a/vendor/plugins/shoulda/test/rails_root/app/models/post.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb similarity index 84% rename from vendor/plugins/shoulda/test/rails_root/app/models/post.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb index 5b840b9..7d13e19 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/models/post.rb +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/post.rb @@ -3,7 +3,8 @@ class Post < ActiveRecord::Base belongs_to :owner, :foreign_key => :user_id, :class_name => 'User' has_many :taggings has_many :tags, :through => :taggings - + has_many :through_tags, :through => :taggings, :source => :tag + validates_uniqueness_of :title validates_presence_of :title validates_presence_of :body, :message => 'Seriously... wtf' diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb new file mode 100644 index 0000000..6222bec --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/product.rb @@ -0,0 +1,12 @@ +class Product < ActiveRecord::Base + validates_presence_of :title + + validates_inclusion_of :price, :in => 0..99, :unless => :tangible + validates_format_of :size, :with => /^\d+\D+$/, :unless => :tangible + + validates_presence_of :price, :if => :tangible + validates_inclusion_of :price, :in => 1..9999, :if => :tangible + validates_inclusion_of :weight, :in => 1..100, :if => :tangible + validates_format_of :size, :with => /.+x.+x.+/, :if => :tangible + validates_length_of :size, :in => 5..20, :if => :tangible +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb new file mode 100644 index 0000000..83692df --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tag.rb @@ -0,0 +1,8 @@ +class Tag < ActiveRecord::Base + has_many :taggings, :dependent => :destroy + has_many :posts, :through => :taggings + + validates_length_of :name, :minimum => 2 + + attr_accessible :name +end diff --git a/vendor/plugins/shoulda/test/rails_root/app/models/tagging.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tagging.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/models/tagging.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/tagging.rb diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb new file mode 100644 index 0000000..a80a7e0 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/treat.rb @@ -0,0 +1,3 @@ +class Treat < ActiveRecord::Base + +end \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb new file mode 100644 index 0000000..c99857c --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/models/user.rb @@ -0,0 +1,29 @@ +class User < ActiveRecord::Base + has_many :posts + has_many :dogs, :foreign_key => :owner_id, :class_name => "Pets::Dog" + + has_many :friendships + has_many :friends, :through => :friendships + + has_one :address, :as => :addressable, :dependent => :destroy + + named_scope :old, :conditions => "age > 50" + named_scope :eighteen, :conditions => { :age => 18 } + named_scope :recent, lambda {|count| { :limit => count } } + + def self.recent_via_method(count) + scoped(:limit => count) + end + + attr_protected :password + attr_readonly :name + + validates_format_of :email, :with => /\w*@\w*.com/ + validates_length_of :email, :in => 1..100 + validates_numericality_of :age, :greater_than_or_equal_to => 1, + :less_than_or_equal_to => 100 + validates_acceptance_of :eula + validates_uniqueness_of :email, :scope => :name, :case_sensitive => false + validates_length_of :ssn, :is => 9, :message => "Social Security Number is not the right length" + validates_numericality_of :ssn +end diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/layouts/posts.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml similarity index 80% rename from vendor/plugins/shoulda/test/rails_root/app/views/layouts/posts.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml index 9a0e16b..3b15ce3 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/views/layouts/posts.rhtml +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/posts.rhtml @@ -4,6 +4,8 @@ + + Posts: <%= controller.action_name %> <%= stylesheet_link_tag 'scaffold' %> diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/layouts/users.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/users.rhtml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/views/layouts/users.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/users.rhtml diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb new file mode 100644 index 0000000..668d3b7 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/layouts/wide.html.erb @@ -0,0 +1 @@ +<%= yield %> \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/posts/edit.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml similarity index 59% rename from vendor/plugins/shoulda/test/rails_root/app/views/posts/edit.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml index b45ba5c..65bd4fe 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/views/posts/edit.rhtml +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/edit.rhtml @@ -2,7 +2,7 @@ <%= error_messages_for :post %> -<% form_for(:post, :url => post_path(@post.user, @post), :html => { :method => :put }) do |f| %> +<% form_for(:post, :url => user_post_path(@post.user, @post), :html => { :method => :put }) do |f| %>

      User
      <%= f.text_field :user_id %> @@ -23,5 +23,5 @@

      <% end %> -<%= link_to 'Show', post_path(@post.user, @post) %> | -<%= link_to 'Back', posts_path(@post.user) %> \ No newline at end of file +<%= link_to 'Show', user_post_path(@post.user, @post) %> | +<%= link_to 'Back', user_posts_path(@post.user) %> diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml new file mode 100644 index 0000000..f6bb3bd --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/index.rhtml @@ -0,0 +1,25 @@ +

      Listing posts

      + + + + + + + + +<% for post in @posts %> + + + + + + + + +<% end %> +
      UserTitleBody
      <%=h post.user_id %><%=h post.title %><%=h post.body %><%= link_to 'Show', user_post_path(post.user, post) %><%= link_to 'Edit', edit_user_post_path(post.user, post) %><%= link_to 'Destroy', user_post_path(post.user, post), :confirm => 'Are you sure?', + :method => :delete %>
      + +
      + +<%= link_to 'New post', new_user_post_path(post.user) %> diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/posts/new.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml similarity index 74% rename from vendor/plugins/shoulda/test/rails_root/app/views/posts/new.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml index bae6a34..216f1e0 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/views/posts/new.rhtml +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/new.rhtml @@ -2,7 +2,7 @@ <%= error_messages_for :post %> -<% form_for(:post, :url => posts_path(@user)) do |f| %> +<% form_for(:post, :url => user_posts_path(@user)) do |f| %>

      User
      <%= f.text_field :user_id %> @@ -23,4 +23,4 @@

      <% end %> -<%= link_to 'Back', posts_path(@user) %> \ No newline at end of file +<%= link_to 'Back', user_posts_path(@user) %> diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/posts/show.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml similarity index 55% rename from vendor/plugins/shoulda/test/rails_root/app/views/posts/show.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml index 393bb74..b9d3791 100644 --- a/vendor/plugins/shoulda/test/rails_root/app/views/posts/show.rhtml +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/posts/show.rhtml @@ -14,5 +14,5 @@

      -<%= link_to 'Edit', edit_post_path(@post.user, @post) %> | -<%= link_to 'Back', posts_path(@post.user) %> \ No newline at end of file +<%= link_to 'Edit', edit_user_post_path(@post.user, @post) %> | +<%= link_to 'Back', user_posts_path(@post.user) %> diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/users/edit.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/edit.rhtml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/views/users/edit.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/edit.rhtml diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/users/index.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/index.rhtml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/views/users/index.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/index.rhtml diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/users/new.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/new.rhtml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/views/users/new.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/new.rhtml diff --git a/vendor/plugins/shoulda/test/rails_root/app/views/users/show.rhtml b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/show.rhtml similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/app/views/users/show.rhtml rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/app/views/users/show.rhtml diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb new file mode 100644 index 0000000..cd21fb9 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/boot.rb @@ -0,0 +1,109 @@ +# Don't change this file! +# Configure your app in config/environment.rb and config/environments/*.rb + +RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) + +module Rails + class << self + def boot! + unless booted? + preinitialize + pick_boot.run + end + end + + def booted? + defined? Rails::Initializer + end + + def pick_boot + (vendor_rails? ? VendorBoot : GemBoot).new + end + + def vendor_rails? + File.exist?("#{RAILS_ROOT}/vendor/rails") + end + + def preinitialize + load(preinitializer_path) if File.exist?(preinitializer_path) + end + + def preinitializer_path + "#{RAILS_ROOT}/config/preinitializer.rb" + end + end + + class Boot + def run + load_initializer + Rails::Initializer.run(:set_load_path) + end + end + + class VendorBoot < Boot + def load_initializer + require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" + Rails::Initializer.run(:install_gem_spec_stubs) + end + end + + class GemBoot < Boot + def load_initializer + self.class.load_rubygems + load_rails_gem + require 'initializer' + end + + def load_rails_gem + if version = self.class.gem_version + gem 'rails', version + else + gem 'rails' + end + rescue Gem::LoadError => load_error + $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) + exit 1 + end + + class << self + def rubygems_version + Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion + end + + def gem_version + if defined? RAILS_GEM_VERSION + RAILS_GEM_VERSION + elsif ENV.include?('RAILS_GEM_VERSION') + ENV['RAILS_GEM_VERSION'] + else + parse_gem_version(read_environment_rb) + end + end + + def load_rubygems + require 'rubygems' + + unless rubygems_version >= '0.9.4' + $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.) + exit 1 + end + + rescue LoadError + $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org) + exit 1 + end + + def parse_gem_version(text) + $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ + end + + private + def read_environment_rb + File.read("#{RAILS_ROOT}/config/environment.rb") + end + end + end +end + +# All that for this: +Rails.boot! diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb new file mode 100644 index 0000000..a3b00b8 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environment.rb @@ -0,0 +1,14 @@ +# Specifies gem version of Rails to use when vendor/rails is not present +old_verbose, $VERBOSE = $VERBOSE, nil +RAILS_GEM_VERSION = '= 2.2.2' unless defined? RAILS_GEM_VERSION +$VERBOSE = old_verbose + +require File.join(File.dirname(__FILE__), 'boot') + +Rails::Initializer.run do |config| + config.log_level = :debug + config.cache_classes = false + config.whiny_nils = true +end + +# Dependencies.log_activity = true diff --git a/vendor/plugins/shoulda/test/rails_root/public/favicon.ico b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environments/test.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/public/favicon.ico rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/environments/test.rb diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb new file mode 100644 index 0000000..5e60c0a --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/new_rails_defaults.rb @@ -0,0 +1,15 @@ +# These settings change the behavior of Rails 2 apps and will be defaults +# for Rails 3. You can remove this initializer when Rails 3 is released. + +# Include Active Record class name as root for JSON serialized output. +ActiveRecord::Base.include_root_in_json = true + +# Store the full class name (including module namespace) in STI type column. +ActiveRecord::Base.store_full_sti_class = true + +# Use ISO 8601 format for JSON serialized times and dates. +ActiveSupport.use_standard_json_time_format = true + +# Don't escape HTML entities in JSON, leave that for the #json_escape helper. +# if you're including raw json in an HTML page. +ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb new file mode 100644 index 0000000..d132470 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/initializers/shoulda.rb @@ -0,0 +1,8 @@ +# This simulates loading the shoulda plugin, but without relying on +# vendor/plugins + +shoulda_path = File.join(File.dirname(__FILE__), *%w(.. .. .. ..)) +shoulda_lib_path = File.join(shoulda_path, "lib") + +$LOAD_PATH.unshift(shoulda_lib_path) +load File.join(shoulda_path, "init.rb") diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb new file mode 100644 index 0000000..ae2bddd --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/config/routes.rb @@ -0,0 +1,6 @@ +ActionController::Routing::Routes.draw do |map| + + map.resources :posts + map.resources :users, :has_many => :posts + +end diff --git a/vendor/plugins/shoulda/test/rails_root/db/migrate/001_create_users.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb similarity index 52% rename from vendor/plugins/shoulda/test/rails_root/db/migrate/001_create_users.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb index 3c6423e..13abb7b 100644 --- a/vendor/plugins/shoulda/test/rails_root/db/migrate/001_create_users.rb +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/001_create_users.rb @@ -4,7 +4,13 @@ class CreateUsers < ActiveRecord::Migration t.column :name, :string t.column :email, :string t.column :age, :integer + t.column :ssn, :string + t.column :phone, :string end + add_index :users, :email, :unique => true + add_index :users, :name + add_index :users, :age + add_index :users, [:email, :name], :unique => true end def self.down diff --git a/vendor/plugins/shoulda/test/rails_root/db/migrate/002_create_posts.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/002_create_posts.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/db/migrate/002_create_posts.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/002_create_posts.rb diff --git a/vendor/plugins/shoulda/test/rails_root/db/migrate/003_create_taggings.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/003_create_taggings.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/db/migrate/003_create_taggings.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/003_create_taggings.rb diff --git a/vendor/plugins/shoulda/test/rails_root/db/migrate/004_create_tags.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/004_create_tags.rb similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/db/migrate/004_create_tags.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/004_create_tags.rb diff --git a/vendor/plugins/shoulda/test/rails_root/db/migrate/005_create_dogs.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb similarity index 83% rename from vendor/plugins/shoulda/test/rails_root/db/migrate/005_create_dogs.rb rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb index a0d8e03..d1ada90 100644 --- a/vendor/plugins/shoulda/test/rails_root/db/migrate/005_create_dogs.rb +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/005_create_dogs.rb @@ -2,6 +2,7 @@ class CreateDogs < ActiveRecord::Migration def self.up create_table :dogs do |t| t.column :owner_id, :integer + t.column :address_id, :integer end end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb new file mode 100644 index 0000000..151cf45 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/006_create_addresses.rb @@ -0,0 +1,14 @@ +class CreateAddresses < ActiveRecord::Migration + def self.up + create_table :addresses do |t| + t.column :title, :string + t.column :addressable_id, :integer + t.column :addressable_type, :string + t.column :zip, :string + end + end + + def self.down + drop_table :addresses + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb new file mode 100644 index 0000000..81ac051 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/007_create_fleas.rb @@ -0,0 +1,11 @@ +class CreateFleas < ActiveRecord::Migration + def self.up + create_table :fleas do |t| + t.string :name + end + end + + def self.down + drop_table :fleas + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb new file mode 100644 index 0000000..98555ae --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/008_create_dogs_fleas.rb @@ -0,0 +1,12 @@ +class CreateDogsFleas < ActiveRecord::Migration + def self.up + create_table :dogs_fleas do |t| + t.integer :dog_id + t.integer :flea_id + end + end + + def self.down + drop_table :dogs_fleas + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb new file mode 100644 index 0000000..173f948 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/009_create_products.rb @@ -0,0 +1,17 @@ +class CreateProducts < ActiveRecord::Migration + def self.up + create_table :products do |t| + t.string :title + t.integer :price + t.integer :weight + t.string :size + t.boolean :tangible + + t.timestamps + end + end + + def self.down + drop_table :products + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb new file mode 100644 index 0000000..99d0f6c --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/010_create_friendships.rb @@ -0,0 +1,14 @@ +class CreateFriendships < ActiveRecord::Migration + def self.up + create_table :friendships do |t| + t.integer :user_id + t.integer :friend_id + + t.timestamps + end + end + + def self.down + drop_table :friendships + end +end diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb new file mode 100644 index 0000000..1b1a002 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/migrate/011_create_treats.rb @@ -0,0 +1,12 @@ +class CreateTreats < ActiveRecord::Migration + def self.up + create_table :treats do |t| + t.integer :dog_id + t.timestamps + end + end + + def self.down + drop_table :treats + end +end \ No newline at end of file diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/schema.rb b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/db/schema.rb new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/shoulda/test/rails_root/public/404.html b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/404.html similarity index 100% rename from vendor/plugins/shoulda/test/rails_root/public/404.html rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/404.html diff --git a/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html new file mode 100644 index 0000000..b54e4a3 --- /dev/null +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/422.html @@ -0,0 +1,30 @@ + + + + + + + The change you wanted was rejected (422) + + + + + +
      +

      The change you wanted was rejected.

      +

      Maybe you tried to change something you didn't have access to.

      +
      + + \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/public/500.html b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html similarity index 92% rename from vendor/plugins/shoulda/test/rails_root/public/500.html rename to vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html index f0aee0e..0e9c14f 100644 --- a/vendor/plugins/shoulda/test/rails_root/public/500.html +++ b/vendor/gems/thoughtbot-shoulda-2.10.1/test/rails_root/public/500.html @@ -5,7 +5,7 @@ - We're sorry, but something went wrong + We're sorry, but something went wrong (500) - - - - - -
      - - -
      - - - - -
      -

      Getting started

      -

      Here’s how to get rolling:

      - -
        -
      1. -

        Create your databases and edit config/database.yml

        -

        Rails needs to know your login and password.

        -
      2. - -
      3. -

        Use script/generate to create your models and controllers

        -

        To see all available options, run it without parameters.

        -
      4. - -
      5. -

        Set up a default route and remove or rename this file

        -

        Routes are setup in config/routes.rb.

        -
      6. -
      -
      -
      - - -
      - - \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/public/javascripts/application.js b/vendor/plugins/shoulda/test/rails_root/public/javascripts/application.js deleted file mode 100644 index fe45776..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/javascripts/application.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/vendor/plugins/shoulda/test/rails_root/public/javascripts/controls.js b/vendor/plugins/shoulda/test/rails_root/public/javascripts/controls.js deleted file mode 100644 index 8c273f8..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/javascripts/controls.js +++ /dev/null @@ -1,833 +0,0 @@ -// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) -// Contributors: -// Richard Livsey -// Rahul Bhargava -// Rob Wills -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// Autocompleter.Base handles all the autocompletion functionality -// that's independent of the data source for autocompletion. This -// includes drawing the autocompletion menu, observing keyboard -// and mouse events, and similar. -// -// Specific autocompleters need to provide, at the very least, -// a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method -// should get the text for which to provide autocompletion by -// invoking this.getToken(), NOT by directly accessing -// this.element.value. This is to allow incremental tokenized -// autocompletion. Specific auto-completion logic (AJAX, etc) -// belongs in getUpdatedChoices. -// -// Tokenized incremental autocompletion is enabled automatically -// when an autocompleter is instantiated with the 'tokens' option -// in the options parameter, e.g.: -// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); -// will incrementally autocomplete with a comma as the token. -// Additionally, ',' in the above example can be replaced with -// a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it -// allows smart autocompletion after linebreaks. - -if(typeof Effect == 'undefined') - throw("controls.js requires including script.aculo.us' effects.js library"); - -var Autocompleter = {} -Autocompleter.Base = function() {}; -Autocompleter.Base.prototype = { - baseInitialize: function(element, update, options) { - this.element = $(element); - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entryCount = 0; - - if(this.setOptions) - this.setOptions(options); - else - this.options = options || {}; - - this.options.paramName = this.options.paramName || this.element.name; - this.options.tokens = this.options.tokens || []; - this.options.frequency = this.options.frequency || 0.4; - this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, { - setHeight: false, - offsetTop: element.offsetHeight - }); - } - Effect.Appear(update,{duration:0.15}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - - if(typeof(this.options.tokens) == 'string') - this.options.tokens = new Array(this.options.tokens); - - this.observer = null; - - this.element.setAttribute('autocomplete','off'); - - Element.hide(this.update); - - Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); - }, - - show: function() { - if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && - (navigator.appVersion.indexOf('MSIE')>0) && - (navigator.userAgent.indexOf('Opera')<0) && - (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); - }, - - fixIEOverlapping: function() { - Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - }, - - hide: function() { - this.stopIndicator(); - if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.options.indicator) Element.show(this.options.indicator); - }, - - stopIndicator: function() { - if(this.options.indicator) Element.hide(this.options.indicator); - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.selectEntry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - Event.stop(event); - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.markPrevious(); - this.render(); - if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); - return; - case Event.KEY_DOWN: - this.markNext(); - this.render(); - if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || - (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return; - - this.changed = true; - this.hasFocus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - activate: function() { - this.changed = false; - this.hasFocus = true; - this.getUpdatedChoices(); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.hasFocus = false; - this.active = false; - }, - - render: function() { - if(this.entryCount > 0) { - for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : - Element.removeClassName(this.getEntry(i),"selected"); - - if(this.hasFocus) { - this.show(); - this.active = true; - } - } else { - this.active = false; - this.hide(); - } - }, - - markPrevious: function() { - if(this.index > 0) this.index-- - else this.index = this.entryCount-1; - this.getEntry(this.index).scrollIntoView(true); - }, - - markNext: function() { - if(this.index < this.entryCount-1) this.index++ - else this.index = 0; - this.getEntry(this.index).scrollIntoView(false); - }, - - getEntry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - getCurrentEntry: function() { - return this.getEntry(this.index); - }, - - selectEntry: function() { - this.active = false; - this.updateElement(this.getCurrentEntry()); - }, - - updateElement: function(selectedElement) { - if (this.options.updateElement) { - this.options.updateElement(selectedElement); - return; - } - var value = ''; - if (this.options.select) { - var nodes = document.getElementsByClassName(this.options.select, selectedElement) || []; - if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); - } else - value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - - var lastTokenPos = this.findLastToken(); - if (lastTokenPos != -1) { - var newValue = this.element.value.substr(0, lastTokenPos + 1); - var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/); - if (whitespace) - newValue += whitespace[0]; - this.element.value = newValue + value; - } else { - this.element.value = value; - } - this.element.focus(); - - if (this.options.afterUpdateElement) - this.options.afterUpdateElement(this.element, selectedElement); - }, - - updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { - this.update.innerHTML = choices; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.down()); - - if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = - this.update.down().childNodes.length; - for (var i = 0; i < this.entryCount; i++) { - var entry = this.getEntry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entryCount = 0; - } - - this.stopIndicator(); - this.index = 0; - - if(this.entryCount==1 && this.options.autoSelect) { - this.selectEntry(); - this.hide(); - } else { - this.render(); - } - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onObserverEvent: function() { - this.changed = false; - if(this.getToken().length>=this.options.minChars) { - this.startIndicator(); - this.getUpdatedChoices(); - } else { - this.active = false; - this.hide(); - } - }, - - getToken: function() { - var tokenPos = this.findLastToken(); - if (tokenPos != -1) - var ret = this.element.value.substr(tokenPos + 1).replace(/^\s+/,'').replace(/\s+$/,''); - else - var ret = this.element.value; - - return /\n/.test(ret) ? '' : ret; - }, - - findLastToken: function() { - var lastTokenPos = -1; - - for (var i=0; i lastTokenPos) - lastTokenPos = thisTokenPos; - } - return lastTokenPos; - } -} - -Ajax.Autocompleter = Class.create(); -Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.prototype), { - initialize: function(element, update, url, options) { - this.baseInitialize(element, update, options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this); - this.options.defaultParams = this.options.parameters || null; - this.url = url; - }, - - getUpdatedChoices: function() { - entry = encodeURIComponent(this.options.paramName) + '=' + - encodeURIComponent(this.getToken()); - - this.options.parameters = this.options.callback ? - this.options.callback(this.element, entry) : entry; - - if(this.options.defaultParams) - this.options.parameters += '&' + this.options.defaultParams; - - new Ajax.Request(this.url, this.options); - }, - - onComplete: function(request) { - this.updateChoices(request.responseText); - } - -}); - -// The local array autocompleter. Used when you'd prefer to -// inject an array of autocompletion options into the page, rather -// than sending out Ajax queries, which can be quite slow sometimes. -// -// The constructor takes four parameters. The first two are, as usual, -// the id of the monitored textbox, and id of the autocompletion menu. -// The third is the array you want to autocomplete from, and the fourth -// is the options block. -// -// Extra local autocompletion options: -// - choices - How many autocompletion choices to offer -// -// - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the -// autocomplete array. Defaults to true, which will -// match text at the beginning of any *word* in the -// strings in the autocomplete array. If you want to -// search anywhere in the string, additionally set -// the option fullSearch to true (default: off). -// -// - fullSsearch - Search anywhere in autocomplete array strings. -// -// - partialChars - How many characters to enter before triggering -// a partial match (unlike minChars, which defines -// how many characters are required to do any match -// at all). Defaults to 2. -// -// - ignoreCase - Whether to ignore case when autocompleting. -// Defaults to true. -// -// It's possible to pass in a custom function as the 'selector' -// option, if you prefer to write your own autocompletion logic. -// In that case, the other options above will not apply unless -// you support them. - -Autocompleter.Local = Class.create(); -Autocompleter.Local.prototype = Object.extend(new Autocompleter.Base(), { - initialize: function(element, update, array, options) { - this.baseInitialize(element, update, options); - this.options.array = array; - }, - - getUpdatedChoices: function() { - this.updateChoices(this.options.selector(this)); - }, - - setOptions: function(options) { - this.options = Object.extend({ - choices: 10, - partialSearch: true, - partialChars: 2, - ignoreCase: true, - fullSearch: false, - selector: function(instance) { - var ret = []; // Beginning matches - var partial = []; // Inside matches - var entry = instance.getToken(); - var count = 0; - - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { - - var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : - elem.indexOf(entry); - - while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
    • " + elem.substr(0, entry.length) + "" + - elem.substr(entry.length) + "
    • "); - break; - } else if (entry.length >= instance.options.partialChars && - instance.options.partialSearch && foundPos != -1) { - if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { - partial.push("
    • " + elem.substr(0, foundPos) + "" + - elem.substr(foundPos, entry.length) + "" + elem.substr( - foundPos + entry.length) + "
    • "); - break; - } - } - - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : - elem.indexOf(entry, foundPos + 1); - - } - } - if (partial.length) - ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)) - return "
        " + ret.join('') + "
      "; - } - }, options || {}); - } -}); - -// AJAX in-place editor -// -// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor - -// Use this if you notice weird scrolling problems on some browsers, -// the DOM might be a bit confused when this gets called so do this -// waits 1 ms (with setTimeout) until it does the activation -Field.scrollFreeActivate = function(field) { - setTimeout(function() { - Field.activate(field); - }, 1); -} - -Ajax.InPlaceEditor = Class.create(); -Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99"; -Ajax.InPlaceEditor.prototype = { - initialize: function(element, url, options) { - this.url = url; - this.element = $(element); - - this.options = Object.extend({ - paramName: "value", - okButton: true, - okText: "ok", - cancelLink: true, - cancelText: "cancel", - savingText: "Saving...", - clickToEditText: "Click to edit", - okText: "ok", - rows: 1, - onComplete: function(transport, element) { - new Effect.Highlight(element, {startcolor: this.options.highlightcolor}); - }, - onFailure: function(transport) { - alert("Error communicating with the server: " + transport.responseText.stripTags()); - }, - callback: function(form) { - return Form.serialize(form); - }, - handleLineBreaks: true, - loadingText: 'Loading...', - savingClassName: 'inplaceeditor-saving', - loadingClassName: 'inplaceeditor-loading', - formClassName: 'inplaceeditor-form', - highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor, - highlightendcolor: "#FFFFFF", - externalControl: null, - submitOnBlur: false, - ajaxOptions: {}, - evalScripts: false - }, options || {}); - - if(!this.options.formId && this.element.id) { - this.options.formId = this.element.id + "-inplaceeditor"; - if ($(this.options.formId)) { - // there's already a form with that name, don't specify an id - this.options.formId = null; - } - } - - if (this.options.externalControl) { - this.options.externalControl = $(this.options.externalControl); - } - - this.originalBackground = Element.getStyle(this.element, 'background-color'); - if (!this.originalBackground) { - this.originalBackground = "transparent"; - } - - this.element.title = this.options.clickToEditText; - - this.onclickListener = this.enterEditMode.bindAsEventListener(this); - this.mouseoverListener = this.enterHover.bindAsEventListener(this); - this.mouseoutListener = this.leaveHover.bindAsEventListener(this); - Event.observe(this.element, 'click', this.onclickListener); - Event.observe(this.element, 'mouseover', this.mouseoverListener); - Event.observe(this.element, 'mouseout', this.mouseoutListener); - if (this.options.externalControl) { - Event.observe(this.options.externalControl, 'click', this.onclickListener); - Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener); - Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener); - } - }, - enterEditMode: function(evt) { - if (this.saving) return; - if (this.editing) return; - this.editing = true; - this.onEnterEditMode(); - if (this.options.externalControl) { - Element.hide(this.options.externalControl); - } - Element.hide(this.element); - this.createForm(); - this.element.parentNode.insertBefore(this.form, this.element); - if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField); - // stop the event to avoid a page refresh in Safari - if (evt) { - Event.stop(evt); - } - return false; - }, - createForm: function() { - this.form = document.createElement("form"); - this.form.id = this.options.formId; - Element.addClassName(this.form, this.options.formClassName) - this.form.onsubmit = this.onSubmit.bind(this); - - this.createEditField(); - - if (this.options.textarea) { - var br = document.createElement("br"); - this.form.appendChild(br); - } - - if (this.options.okButton) { - okButton = document.createElement("input"); - okButton.type = "submit"; - okButton.value = this.options.okText; - okButton.className = 'editor_ok_button'; - this.form.appendChild(okButton); - } - - if (this.options.cancelLink) { - cancelLink = document.createElement("a"); - cancelLink.href = "#"; - cancelLink.appendChild(document.createTextNode(this.options.cancelText)); - cancelLink.onclick = this.onclickCancel.bind(this); - cancelLink.className = 'editor_cancel'; - this.form.appendChild(cancelLink); - } - }, - hasHTMLLineBreaks: function(string) { - if (!this.options.handleLineBreaks) return false; - return string.match(/
      /i); - }, - convertHTMLLineBreaks: function(string) { - return string.replace(/
      /gi, "\n").replace(//gi, "\n").replace(/<\/p>/gi, "\n").replace(/

      /gi, ""); - }, - createEditField: function() { - var text; - if(this.options.loadTextURL) { - text = this.options.loadingText; - } else { - text = this.getText(); - } - - var obj = this; - - if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) { - this.options.textarea = false; - var textField = document.createElement("input"); - textField.obj = this; - textField.type = "text"; - textField.name = this.options.paramName; - textField.value = text; - textField.style.backgroundColor = this.options.highlightcolor; - textField.className = 'editor_field'; - var size = this.options.size || this.options.cols || 0; - if (size != 0) textField.size = size; - if (this.options.submitOnBlur) - textField.onblur = this.onSubmit.bind(this); - this.editField = textField; - } else { - this.options.textarea = true; - var textArea = document.createElement("textarea"); - textArea.obj = this; - textArea.name = this.options.paramName; - textArea.value = this.convertHTMLLineBreaks(text); - textArea.rows = this.options.rows; - textArea.cols = this.options.cols || 40; - textArea.className = 'editor_field'; - if (this.options.submitOnBlur) - textArea.onblur = this.onSubmit.bind(this); - this.editField = textArea; - } - - if(this.options.loadTextURL) { - this.loadExternalText(); - } - this.form.appendChild(this.editField); - }, - getText: function() { - return this.element.innerHTML; - }, - loadExternalText: function() { - Element.addClassName(this.form, this.options.loadingClassName); - this.editField.disabled = true; - new Ajax.Request( - this.options.loadTextURL, - Object.extend({ - asynchronous: true, - onComplete: this.onLoadedExternalText.bind(this) - }, this.options.ajaxOptions) - ); - }, - onLoadedExternalText: function(transport) { - Element.removeClassName(this.form, this.options.loadingClassName); - this.editField.disabled = false; - this.editField.value = transport.responseText.stripTags(); - Field.scrollFreeActivate(this.editField); - }, - onclickCancel: function() { - this.onComplete(); - this.leaveEditMode(); - return false; - }, - onFailure: function(transport) { - this.options.onFailure(transport); - if (this.oldInnerHTML) { - this.element.innerHTML = this.oldInnerHTML; - this.oldInnerHTML = null; - } - return false; - }, - onSubmit: function() { - // onLoading resets these so we need to save them away for the Ajax call - var form = this.form; - var value = this.editField.value; - - // do this first, sometimes the ajax call returns before we get a chance to switch on Saving... - // which means this will actually switch on Saving... *after* we've left edit mode causing Saving... - // to be displayed indefinitely - this.onLoading(); - - if (this.options.evalScripts) { - new Ajax.Request( - this.url, Object.extend({ - parameters: this.options.callback(form, value), - onComplete: this.onComplete.bind(this), - onFailure: this.onFailure.bind(this), - asynchronous:true, - evalScripts:true - }, this.options.ajaxOptions)); - } else { - new Ajax.Updater( - { success: this.element, - // don't update on failure (this could be an option) - failure: null }, - this.url, Object.extend({ - parameters: this.options.callback(form, value), - onComplete: this.onComplete.bind(this), - onFailure: this.onFailure.bind(this) - }, this.options.ajaxOptions)); - } - // stop the event to avoid a page refresh in Safari - if (arguments.length > 1) { - Event.stop(arguments[0]); - } - return false; - }, - onLoading: function() { - this.saving = true; - this.removeForm(); - this.leaveHover(); - this.showSaving(); - }, - showSaving: function() { - this.oldInnerHTML = this.element.innerHTML; - this.element.innerHTML = this.options.savingText; - Element.addClassName(this.element, this.options.savingClassName); - this.element.style.backgroundColor = this.originalBackground; - Element.show(this.element); - }, - removeForm: function() { - if(this.form) { - if (this.form.parentNode) Element.remove(this.form); - this.form = null; - } - }, - enterHover: function() { - if (this.saving) return; - this.element.style.backgroundColor = this.options.highlightcolor; - if (this.effect) { - this.effect.cancel(); - } - Element.addClassName(this.element, this.options.hoverClassName) - }, - leaveHover: function() { - if (this.options.backgroundColor) { - this.element.style.backgroundColor = this.oldBackground; - } - Element.removeClassName(this.element, this.options.hoverClassName) - if (this.saving) return; - this.effect = new Effect.Highlight(this.element, { - startcolor: this.options.highlightcolor, - endcolor: this.options.highlightendcolor, - restorecolor: this.originalBackground - }); - }, - leaveEditMode: function() { - Element.removeClassName(this.element, this.options.savingClassName); - this.removeForm(); - this.leaveHover(); - this.element.style.backgroundColor = this.originalBackground; - Element.show(this.element); - if (this.options.externalControl) { - Element.show(this.options.externalControl); - } - this.editing = false; - this.saving = false; - this.oldInnerHTML = null; - this.onLeaveEditMode(); - }, - onComplete: function(transport) { - this.leaveEditMode(); - this.options.onComplete.bind(this)(transport, this.element); - }, - onEnterEditMode: function() {}, - onLeaveEditMode: function() {}, - dispose: function() { - if (this.oldInnerHTML) { - this.element.innerHTML = this.oldInnerHTML; - } - this.leaveEditMode(); - Event.stopObserving(this.element, 'click', this.onclickListener); - Event.stopObserving(this.element, 'mouseover', this.mouseoverListener); - Event.stopObserving(this.element, 'mouseout', this.mouseoutListener); - if (this.options.externalControl) { - Event.stopObserving(this.options.externalControl, 'click', this.onclickListener); - Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener); - Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener); - } - } -}; - -Ajax.InPlaceCollectionEditor = Class.create(); -Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype); -Object.extend(Ajax.InPlaceCollectionEditor.prototype, { - createEditField: function() { - if (!this.cached_selectTag) { - var selectTag = document.createElement("select"); - var collection = this.options.collection || []; - var optionTag; - collection.each(function(e,i) { - optionTag = document.createElement("option"); - optionTag.value = (e instanceof Array) ? e[0] : e; - if((typeof this.options.value == 'undefined') && - ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true; - if(this.options.value==optionTag.value) optionTag.selected = true; - optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e)); - selectTag.appendChild(optionTag); - }.bind(this)); - this.cached_selectTag = selectTag; - } - - this.editField = this.cached_selectTag; - if(this.options.loadTextURL) this.loadExternalText(); - this.form.appendChild(this.editField); - this.options.callback = function(form, value) { - return "value=" + encodeURIComponent(value); - } - } -}); - -// Delayed observer, like Form.Element.Observer, -// but waits for delay after last key input -// Ideal for live-search fields - -Form.Element.DelayedObserver = Class.create(); -Form.Element.DelayedObserver.prototype = { - initialize: function(element, delay, callback) { - this.delay = delay || 0.5; - this.element = $(element); - this.callback = callback; - this.timer = null; - this.lastValue = $F(this.element); - Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); - }, - delayedListener: function(event) { - if(this.lastValue == $F(this.element)) return; - if(this.timer) clearTimeout(this.timer); - this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); - this.lastValue = $F(this.element); - }, - onTimerEvent: function() { - this.timer = null; - this.callback(this.element, $F(this.element)); - } -}; diff --git a/vendor/plugins/shoulda/test/rails_root/public/javascripts/dragdrop.js b/vendor/plugins/shoulda/test/rails_root/public/javascripts/dragdrop.js deleted file mode 100644 index c71ddb8..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/javascripts/dragdrop.js +++ /dev/null @@ -1,942 +0,0 @@ -// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -if(typeof Effect == 'undefined') - throw("dragdrop.js requires including script.aculo.us' effects.js library"); - -var Droppables = { - drops: [], - - remove: function(element) { - this.drops = this.drops.reject(function(d) { return d.element==$(element) }); - }, - - add: function(element) { - element = $(element); - var options = Object.extend({ - greedy: true, - hoverclass: null, - tree: false - }, arguments[1] || {}); - - // cache containers - if(options.containment) { - options._containers = []; - var containment = options.containment; - if((typeof containment == 'object') && - (containment.constructor == Array)) { - containment.each( function(c) { options._containers.push($(c)) }); - } else { - options._containers.push($(containment)); - } - } - - if(options.accept) options.accept = [options.accept].flatten(); - - Element.makePositioned(element); // fix IE - options.element = element; - - this.drops.push(options); - }, - - findDeepestChild: function(drops) { - deepest = drops[0]; - - for (i = 1; i < drops.length; ++i) - if (Element.isParent(drops[i].element, deepest.element)) - deepest = drops[i]; - - return deepest; - }, - - isContained: function(element, drop) { - var containmentNode; - if(drop.tree) { - containmentNode = element.treeNode; - } else { - containmentNode = element.parentNode; - } - return drop._containers.detect(function(c) { return containmentNode == c }); - }, - - isAffected: function(point, element, drop) { - return ( - (drop.element!=element) && - ((!drop._containers) || - this.isContained(element, drop)) && - ((!drop.accept) || - (Element.classNames(element).detect( - function(v) { return drop.accept.include(v) } ) )) && - Position.within(drop.element, point[0], point[1]) ); - }, - - deactivate: function(drop) { - if(drop.hoverclass) - Element.removeClassName(drop.element, drop.hoverclass); - this.last_active = null; - }, - - activate: function(drop) { - if(drop.hoverclass) - Element.addClassName(drop.element, drop.hoverclass); - this.last_active = drop; - }, - - show: function(point, element) { - if(!this.drops.length) return; - var affected = []; - - if(this.last_active) this.deactivate(this.last_active); - this.drops.each( function(drop) { - if(Droppables.isAffected(point, element, drop)) - affected.push(drop); - }); - - if(affected.length>0) { - drop = Droppables.findDeepestChild(affected); - Position.within(drop.element, point[0], point[1]); - if(drop.onHover) - drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - - Droppables.activate(drop); - } - }, - - fire: function(event, element) { - if(!this.last_active) return; - Position.prepare(); - - if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) - if (this.last_active.onDrop) - this.last_active.onDrop(element, this.last_active.element, event); - }, - - reset: function() { - if(this.last_active) - this.deactivate(this.last_active); - } -} - -var Draggables = { - drags: [], - observers: [], - - register: function(draggable) { - if(this.drags.length == 0) { - this.eventMouseUp = this.endDrag.bindAsEventListener(this); - this.eventMouseMove = this.updateDrag.bindAsEventListener(this); - this.eventKeypress = this.keyPress.bindAsEventListener(this); - - Event.observe(document, "mouseup", this.eventMouseUp); - Event.observe(document, "mousemove", this.eventMouseMove); - Event.observe(document, "keypress", this.eventKeypress); - } - this.drags.push(draggable); - }, - - unregister: function(draggable) { - this.drags = this.drags.reject(function(d) { return d==draggable }); - if(this.drags.length == 0) { - Event.stopObserving(document, "mouseup", this.eventMouseUp); - Event.stopObserving(document, "mousemove", this.eventMouseMove); - Event.stopObserving(document, "keypress", this.eventKeypress); - } - }, - - activate: function(draggable) { - if(draggable.options.delay) { - this._timeout = setTimeout(function() { - Draggables._timeout = null; - window.focus(); - Draggables.activeDraggable = draggable; - }.bind(this), draggable.options.delay); - } else { - window.focus(); // allows keypress events if window isn't currently focused, fails for Safari - this.activeDraggable = draggable; - } - }, - - deactivate: function() { - this.activeDraggable = null; - }, - - updateDrag: function(event) { - if(!this.activeDraggable) return; - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - // Mozilla-based browsers fire successive mousemove events with - // the same coordinates, prevent needless redrawing (moz bug?) - if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; - this._lastPointer = pointer; - - this.activeDraggable.updateDrag(event, pointer); - }, - - endDrag: function(event) { - if(this._timeout) { - clearTimeout(this._timeout); - this._timeout = null; - } - if(!this.activeDraggable) return; - this._lastPointer = null; - this.activeDraggable.endDrag(event); - this.activeDraggable = null; - }, - - keyPress: function(event) { - if(this.activeDraggable) - this.activeDraggable.keyPress(event); - }, - - addObserver: function(observer) { - this.observers.push(observer); - this._cacheObserverCallbacks(); - }, - - removeObserver: function(element) { // element instead of observer fixes mem leaks - this.observers = this.observers.reject( function(o) { return o.element==element }); - this._cacheObserverCallbacks(); - }, - - notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' - if(this[eventName+'Count'] > 0) - this.observers.each( function(o) { - if(o[eventName]) o[eventName](eventName, draggable, event); - }); - if(draggable.options[eventName]) draggable.options[eventName](draggable, event); - }, - - _cacheObserverCallbacks: function() { - ['onStart','onEnd','onDrag'].each( function(eventName) { - Draggables[eventName+'Count'] = Draggables.observers.select( - function(o) { return o[eventName]; } - ).length; - }); - } -} - -/*--------------------------------------------------------------------------*/ - -var Draggable = Class.create(); -Draggable._dragging = {}; - -Draggable.prototype = { - initialize: function(element) { - var defaults = { - handle: false, - reverteffect: function(element, top_offset, left_offset) { - var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; - new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, - queue: {scope:'_draggable', position:'end'} - }); - }, - endeffect: function(element) { - var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0; - new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, - queue: {scope:'_draggable', position:'end'}, - afterFinish: function(){ - Draggable._dragging[element] = false - } - }); - }, - zindex: 1000, - revert: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } - delay: 0 - }; - - if(!arguments[1] || typeof arguments[1].endeffect == 'undefined') - Object.extend(defaults, { - starteffect: function(element) { - element._opacity = Element.getOpacity(element); - Draggable._dragging[element] = true; - new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); - } - }); - - var options = Object.extend(defaults, arguments[1] || {}); - - this.element = $(element); - - if(options.handle && (typeof options.handle == 'string')) - this.handle = this.element.down('.'+options.handle, 0); - - if(!this.handle) this.handle = $(options.handle); - if(!this.handle) this.handle = this.element; - - if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { - options.scroll = $(options.scroll); - this._isScrollChild = Element.childOf(this.element, options.scroll); - } - - Element.makePositioned(this.element); // fix IE - - this.delta = this.currentDelta(); - this.options = options; - this.dragging = false; - - this.eventMouseDown = this.initDrag.bindAsEventListener(this); - Event.observe(this.handle, "mousedown", this.eventMouseDown); - - Draggables.register(this); - }, - - destroy: function() { - Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); - Draggables.unregister(this); - }, - - currentDelta: function() { - return([ - parseInt(Element.getStyle(this.element,'left') || '0'), - parseInt(Element.getStyle(this.element,'top') || '0')]); - }, - - initDrag: function(event) { - if(typeof Draggable._dragging[this.element] != 'undefined' && - Draggable._dragging[this.element]) return; - if(Event.isLeftClick(event)) { - // abort on form elements, fixes a Firefox issue - var src = Event.element(event); - if(src.tagName && ( - src.tagName=='INPUT' || - src.tagName=='SELECT' || - src.tagName=='OPTION' || - src.tagName=='BUTTON' || - src.tagName=='TEXTAREA')) return; - - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - var pos = Position.cumulativeOffset(this.element); - this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); - - Draggables.activate(this); - Event.stop(event); - } - }, - - startDrag: function(event) { - this.dragging = true; - - if(this.options.zindex) { - this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); - this.element.style.zIndex = this.options.zindex; - } - - if(this.options.ghosting) { - this._clone = this.element.cloneNode(true); - Position.absolutize(this.element); - this.element.parentNode.insertBefore(this._clone, this.element); - } - - if(this.options.scroll) { - if (this.options.scroll == window) { - var where = this._getWindowScroll(this.options.scroll); - this.originalScrollLeft = where.left; - this.originalScrollTop = where.top; - } else { - this.originalScrollLeft = this.options.scroll.scrollLeft; - this.originalScrollTop = this.options.scroll.scrollTop; - } - } - - Draggables.notify('onStart', this, event); - - if(this.options.starteffect) this.options.starteffect(this.element); - }, - - updateDrag: function(event, pointer) { - if(!this.dragging) this.startDrag(event); - Position.prepare(); - Droppables.show(pointer, this.element); - Draggables.notify('onDrag', this, event); - - this.draw(pointer); - if(this.options.change) this.options.change(this); - - if(this.options.scroll) { - this.stopScrolling(); - - var p; - if (this.options.scroll == window) { - with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } - } else { - p = Position.page(this.options.scroll); - p[0] += this.options.scroll.scrollLeft + Position.deltaX; - p[1] += this.options.scroll.scrollTop + Position.deltaY; - p.push(p[0]+this.options.scroll.offsetWidth); - p.push(p[1]+this.options.scroll.offsetHeight); - } - var speed = [0,0]; - if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); - if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); - if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); - if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); - this.startScrolling(speed); - } - - // fix AppleWebKit rendering - if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); - - Event.stop(event); - }, - - finishDrag: function(event, success) { - this.dragging = false; - - if(this.options.ghosting) { - Position.relativize(this.element); - Element.remove(this._clone); - this._clone = null; - } - - if(success) Droppables.fire(event, this.element); - Draggables.notify('onEnd', this, event); - - var revert = this.options.revert; - if(revert && typeof revert == 'function') revert = revert(this.element); - - var d = this.currentDelta(); - if(revert && this.options.reverteffect) { - this.options.reverteffect(this.element, - d[1]-this.delta[1], d[0]-this.delta[0]); - } else { - this.delta = d; - } - - if(this.options.zindex) - this.element.style.zIndex = this.originalZ; - - if(this.options.endeffect) - this.options.endeffect(this.element); - - Draggables.deactivate(this); - Droppables.reset(); - }, - - keyPress: function(event) { - if(event.keyCode!=Event.KEY_ESC) return; - this.finishDrag(event, false); - Event.stop(event); - }, - - endDrag: function(event) { - if(!this.dragging) return; - this.stopScrolling(); - this.finishDrag(event, true); - Event.stop(event); - }, - - draw: function(point) { - var pos = Position.cumulativeOffset(this.element); - if(this.options.ghosting) { - var r = Position.realOffset(this.element); - pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; - } - - var d = this.currentDelta(); - pos[0] -= d[0]; pos[1] -= d[1]; - - if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { - pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; - pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; - } - - var p = [0,1].map(function(i){ - return (point[i]-pos[i]-this.offset[i]) - }.bind(this)); - - if(this.options.snap) { - if(typeof this.options.snap == 'function') { - p = this.options.snap(p[0],p[1],this); - } else { - if(this.options.snap instanceof Array) { - p = p.map( function(v, i) { - return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this)) - } else { - p = p.map( function(v) { - return Math.round(v/this.options.snap)*this.options.snap }.bind(this)) - } - }} - - var style = this.element.style; - if((!this.options.constraint) || (this.options.constraint=='horizontal')) - style.left = p[0] + "px"; - if((!this.options.constraint) || (this.options.constraint=='vertical')) - style.top = p[1] + "px"; - - if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering - }, - - stopScrolling: function() { - if(this.scrollInterval) { - clearInterval(this.scrollInterval); - this.scrollInterval = null; - Draggables._lastScrollPointer = null; - } - }, - - startScrolling: function(speed) { - if(!(speed[0] || speed[1])) return; - this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; - this.lastScrolled = new Date(); - this.scrollInterval = setInterval(this.scroll.bind(this), 10); - }, - - scroll: function() { - var current = new Date(); - var delta = current - this.lastScrolled; - this.lastScrolled = current; - if(this.options.scroll == window) { - with (this._getWindowScroll(this.options.scroll)) { - if (this.scrollSpeed[0] || this.scrollSpeed[1]) { - var d = delta / 1000; - this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); - } - } - } else { - this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; - this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; - } - - Position.prepare(); - Droppables.show(Draggables._lastPointer, this.element); - Draggables.notify('onDrag', this); - if (this._isScrollChild) { - Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); - Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; - Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; - if (Draggables._lastScrollPointer[0] < 0) - Draggables._lastScrollPointer[0] = 0; - if (Draggables._lastScrollPointer[1] < 0) - Draggables._lastScrollPointer[1] = 0; - this.draw(Draggables._lastScrollPointer); - } - - if(this.options.change) this.options.change(this); - }, - - _getWindowScroll: function(w) { - var T, L, W, H; - with (w.document) { - if (w.document.documentElement && documentElement.scrollTop) { - T = documentElement.scrollTop; - L = documentElement.scrollLeft; - } else if (w.document.body) { - T = body.scrollTop; - L = body.scrollLeft; - } - if (w.innerWidth) { - W = w.innerWidth; - H = w.innerHeight; - } else if (w.document.documentElement && documentElement.clientWidth) { - W = documentElement.clientWidth; - H = documentElement.clientHeight; - } else { - W = body.offsetWidth; - H = body.offsetHeight - } - } - return { top: T, left: L, width: W, height: H }; - } -} - -/*--------------------------------------------------------------------------*/ - -var SortableObserver = Class.create(); -SortableObserver.prototype = { - initialize: function(element, observer) { - this.element = $(element); - this.observer = observer; - this.lastValue = Sortable.serialize(this.element); - }, - - onStart: function() { - this.lastValue = Sortable.serialize(this.element); - }, - - onEnd: function() { - Sortable.unmark(); - if(this.lastValue != Sortable.serialize(this.element)) - this.observer(this.element) - } -} - -var Sortable = { - SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - - sortables: {}, - - _findRootElement: function(element) { - while (element.tagName != "BODY") { - if(element.id && Sortable.sortables[element.id]) return element; - element = element.parentNode; - } - }, - - options: function(element) { - element = Sortable._findRootElement($(element)); - if(!element) return; - return Sortable.sortables[element.id]; - }, - - destroy: function(element){ - var s = Sortable.options(element); - - if(s) { - Draggables.removeObserver(s.element); - s.droppables.each(function(d){ Droppables.remove(d) }); - s.draggables.invoke('destroy'); - - delete Sortable.sortables[s.element.id]; - } - }, - - create: function(element) { - element = $(element); - var options = Object.extend({ - element: element, - tag: 'li', // assumes li children, override with tag: 'tagname' - dropOnEmpty: false, - tree: false, - treeTag: 'ul', - overlap: 'vertical', // one of 'vertical', 'horizontal' - constraint: 'vertical', // one of 'vertical', 'horizontal', false - containment: element, // also takes array of elements (or id's); or false - handle: false, // or a CSS class - only: false, - delay: 0, - hoverclass: null, - ghosting: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - format: this.SERIALIZE_RULE, - onChange: Prototype.emptyFunction, - onUpdate: Prototype.emptyFunction - }, arguments[1] || {}); - - // clear any old sortable with same element - this.destroy(element); - - // build options for the draggables - var options_for_draggable = { - revert: true, - scroll: options.scroll, - scrollSpeed: options.scrollSpeed, - scrollSensitivity: options.scrollSensitivity, - delay: options.delay, - ghosting: options.ghosting, - constraint: options.constraint, - handle: options.handle }; - - if(options.starteffect) - options_for_draggable.starteffect = options.starteffect; - - if(options.reverteffect) - options_for_draggable.reverteffect = options.reverteffect; - else - if(options.ghosting) options_for_draggable.reverteffect = function(element) { - element.style.top = 0; - element.style.left = 0; - }; - - if(options.endeffect) - options_for_draggable.endeffect = options.endeffect; - - if(options.zindex) - options_for_draggable.zindex = options.zindex; - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - tree: options.tree, - hoverclass: options.hoverclass, - onHover: Sortable.onHover - } - - var options_for_tree = { - onHover: Sortable.onEmptyHover, - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass - } - - // fix for gecko engine - Element.cleanWhitespace(element); - - options.draggables = []; - options.droppables = []; - - // drop on empty handling - if(options.dropOnEmpty || options.tree) { - Droppables.add(element, options_for_tree); - options.droppables.push(element); - } - - (this.findElements(element, options) || []).each( function(e) { - // handles are per-draggable - var handle = options.handle ? - $(e).down('.'+options.handle,0) : e; - options.draggables.push( - new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); - Droppables.add(e, options_for_droppable); - if(options.tree) e.treeNode = element; - options.droppables.push(e); - }); - - if(options.tree) { - (Sortable.findTreeElements(element, options) || []).each( function(e) { - Droppables.add(e, options_for_tree); - e.treeNode = element; - options.droppables.push(e); - }); - } - - // keep reference - this.sortables[element.id] = options; - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - }, - - // return all suitable-for-sortable elements in a guaranteed order - findElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.tag); - }, - - findTreeElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.treeTag); - }, - - onHover: function(element, dropon, overlap) { - if(Element.isParent(dropon, element)) return; - - if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { - return; - } else if(overlap>0.5) { - Sortable.mark(dropon, 'before'); - if(dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } else { - Sortable.mark(dropon, 'after'); - var nextElement = dropon.nextSibling || null; - if(nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } - }, - - onEmptyHover: function(element, dropon, overlap) { - var oldParentNode = element.parentNode; - var droponOptions = Sortable.options(dropon); - - if(!Element.isParent(dropon, element)) { - var index; - - var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); - var child = null; - - if(children) { - var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - - for (index = 0; index < children.length; index += 1) { - if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { - offset -= Element.offsetSize (children[index], droponOptions.overlap); - } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { - child = index + 1 < children.length ? children[index + 1] : null; - break; - } else { - child = children[index]; - break; - } - } - } - - dropon.insertBefore(element, child); - - Sortable.options(oldParentNode).onChange(element); - droponOptions.onChange(element); - } - }, - - unmark: function() { - if(Sortable._marker) Sortable._marker.hide(); - }, - - mark: function(dropon, position) { - // mark on ghosting only - var sortable = Sortable.options(dropon.parentNode); - if(sortable && !sortable.ghosting) return; - - if(!Sortable._marker) { - Sortable._marker = - ($('dropmarker') || Element.extend(document.createElement('DIV'))). - hide().addClassName('dropmarker').setStyle({position:'absolute'}); - document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); - } - var offsets = Position.cumulativeOffset(dropon); - Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); - - if(position=='after') - if(sortable.overlap == 'horizontal') - Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); - else - Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); - - Sortable._marker.show(); - }, - - _tree: function(element, options, parent) { - var children = Sortable.findElements(element, options) || []; - - for (var i = 0; i < children.length; ++i) { - var match = children[i].id.match(options.format); - - if (!match) continue; - - var child = { - id: encodeURIComponent(match ? match[1] : null), - element: element, - parent: parent, - children: [], - position: parent.children.length, - container: $(children[i]).down(options.treeTag) - } - - /* Get the element containing the children and recurse over it */ - if (child.container) - this._tree(child.container, options, child) - - parent.children.push (child); - } - - return parent; - }, - - tree: function(element) { - element = $(element); - var sortableOptions = this.options(element); - var options = Object.extend({ - tag: sortableOptions.tag, - treeTag: sortableOptions.treeTag, - only: sortableOptions.only, - name: element.id, - format: sortableOptions.format - }, arguments[1] || {}); - - var root = { - id: null, - parent: null, - children: [], - container: element, - position: 0 - } - - return Sortable._tree(element, options, root); - }, - - /* Construct a [i] index for a particular node */ - _constructIndex: function(node) { - var index = ''; - do { - if (node.id) index = '[' + node.position + ']' + index; - } while ((node = node.parent) != null); - return index; - }, - - sequence: function(element) { - element = $(element); - var options = Object.extend(this.options(element), arguments[1] || {}); - - return $(this.findElements(element, options) || []).map( function(item) { - return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; - }); - }, - - setSequence: function(element, new_sequence) { - element = $(element); - var options = Object.extend(this.options(element), arguments[2] || {}); - - var nodeMap = {}; - this.findElements(element, options).each( function(n) { - if (n.id.match(options.format)) - nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; - n.parentNode.removeChild(n); - }); - - new_sequence.each(function(ident) { - var n = nodeMap[ident]; - if (n) { - n[1].appendChild(n[0]); - delete nodeMap[ident]; - } - }); - }, - - serialize: function(element) { - element = $(element); - var options = Object.extend(Sortable.options(element), arguments[1] || {}); - var name = encodeURIComponent( - (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - - if (options.tree) { - return Sortable.tree(element, arguments[1]).children.map( function (item) { - return [name + Sortable._constructIndex(item) + "[id]=" + - encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); - }).flatten().join('&'); - } else { - return Sortable.sequence(element, arguments[1]).map( function(item) { - return name + "[]=" + encodeURIComponent(item); - }).join('&'); - } - } -} - -// Returns true if child is contained within element -Element.isParent = function(child, element) { - if (!child.parentNode || child == element) return false; - if (child.parentNode == element) return true; - return Element.isParent(child.parentNode, element); -} - -Element.findChildren = function(element, only, recursive, tagName) { - if(!element.hasChildNodes()) return null; - tagName = tagName.toUpperCase(); - if(only) only = [only].flatten(); - var elements = []; - $A(element.childNodes).each( function(e) { - if(e.tagName && e.tagName.toUpperCase()==tagName && - (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) - elements.push(e); - if(recursive) { - var grandchildren = Element.findChildren(e, only, recursive, tagName); - if(grandchildren) elements.push(grandchildren); - } - }); - - return (elements.length>0 ? elements.flatten() : []); -} - -Element.offsetSize = function (element, type) { - return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; -} diff --git a/vendor/plugins/shoulda/test/rails_root/public/javascripts/effects.js b/vendor/plugins/shoulda/test/rails_root/public/javascripts/effects.js deleted file mode 100644 index 3b02eda..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/javascripts/effects.js +++ /dev/null @@ -1,1088 +0,0 @@ -// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// Contributors: -// Justin Palmer (http://encytemedia.com/) -// Mark Pilgrim (http://diveintomark.org/) -// Martin Bialasinki -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// converts rgb() and #xxx to #xxxxxx format, -// returns self (or first argument) if not convertable -String.prototype.parseColor = function() { - var color = '#'; - if(this.slice(0,4) == 'rgb(') { - var cols = this.slice(4,this.length-1).split(','); - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); - } else { - if(this.slice(0,1) == '#') { - if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if(this.length==7) color = this.toLowerCase(); - } - } - return(color.length==7 ? color : (arguments[0] || this)); -} - -/*--------------------------------------------------------------------------*/ - -Element.collectTextNodes = function(element) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); - }).flatten().join(''); -} - -Element.collectTextNodesIgnoreClass = function(element, className) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? - Element.collectTextNodesIgnoreClass(node, className) : '')); - }).flatten().join(''); -} - -Element.setContentZoom = function(element, percent) { - element = $(element); - element.setStyle({fontSize: (percent/100) + 'em'}); - if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); - return element; -} - -Element.getOpacity = function(element){ - element = $(element); - var opacity; - if (opacity = element.getStyle('opacity')) - return parseFloat(opacity); - if (opacity = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) - if(opacity[1]) return parseFloat(opacity[1]) / 100; - return 1.0; -} - -Element.setOpacity = function(element, value){ - element= $(element); - if (value == 1){ - element.setStyle({ opacity: - (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? - 0.999999 : 1.0 }); - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.setStyle({filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')}); - } else { - if(value < 0.00001) value = 0; - element.setStyle({opacity: value}); - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.setStyle( - { filter: element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + - 'alpha(opacity='+value*100+')' }); - } - return element; -} - -Element.getInlineOpacity = function(element){ - return $(element).style.opacity || ''; -} - -Element.forceRerendering = function(element) { - try { - element = $(element); - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch(e) { } -}; - -/*--------------------------------------------------------------------------*/ - -Array.prototype.call = function() { - var args = arguments; - this.each(function(f){ f.apply(this, args) }); -} - -/*--------------------------------------------------------------------------*/ - -var Effect = { - _elementDoesNotExistError: { - name: 'ElementDoesNotExistError', - message: 'The specified DOM element does not exist, but is required for this effect to operate' - }, - tagifyText: function(element) { - if(typeof Builder == 'undefined') - throw("Effect.tagifyText requires including script.aculo.us' builder.js library"); - - var tagifyStyle = 'position:relative'; - if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1'; - - element = $(element); - $A(element.childNodes).each( function(child) { - if(child.nodeType==3) { - child.nodeValue.toArray().each( function(character) { - element.insertBefore( - Builder.node('span',{style: tagifyStyle}, - character == ' ' ? String.fromCharCode(160) : character), - child); - }); - Element.remove(child); - } - }); - }, - multiple: function(element, effect) { - var elements; - if(((typeof element == 'object') || - (typeof element == 'function')) && - (element.length)) - elements = element; - else - elements = $(element).childNodes; - - var options = Object.extend({ - speed: 0.1, - delay: 0.0 - }, arguments[2] || {}); - var masterDelay = options.delay; - - $A(elements).each( function(element, index) { - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); - }); - }, - PAIRS: { - 'slide': ['SlideDown','SlideUp'], - 'blind': ['BlindDown','BlindUp'], - 'appear': ['Appear','Fade'] - }, - toggle: function(element, effect) { - element = $(element); - effect = (effect || 'appear').toLowerCase(); - var options = Object.extend({ - queue: { position:'end', scope:(element.id || 'global'), limit: 1 } - }, arguments[2] || {}); - Effect[element.visible() ? - Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); - } -}; - -var Effect2 = Effect; // deprecated - -/* ------------- transitions ------------- */ - -Effect.Transitions = { - linear: Prototype.K, - sinoidal: function(pos) { - return (-Math.cos(pos*Math.PI)/2) + 0.5; - }, - reverse: function(pos) { - return 1-pos; - }, - flicker: function(pos) { - return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; - }, - wobble: function(pos) { - return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; - }, - pulse: function(pos, pulses) { - pulses = pulses || 5; - return ( - Math.round((pos % (1/pulses)) * pulses) == 0 ? - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) : - 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) - ); - }, - none: function(pos) { - return 0; - }, - full: function(pos) { - return 1; - } -}; - -/* ------------- core effects ------------- */ - -Effect.ScopedQueue = Class.create(); -Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { - initialize: function() { - this.effects = []; - this.interval = null; - }, - _each: function(iterator) { - this.effects._each(iterator); - }, - add: function(effect) { - var timestamp = new Date().getTime(); - - var position = (typeof effect.options.queue == 'string') ? - effect.options.queue : effect.options.queue.position; - - switch(position) { - case 'front': - // move unstarted effects after this effect - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { - e.startOn += effect.finishOn; - e.finishOn += effect.finishOn; - }); - break; - case 'with-last': - timestamp = this.effects.pluck('startOn').max() || timestamp; - break; - case 'end': - // start effect after last queued effect has finished - timestamp = this.effects.pluck('finishOn').max() || timestamp; - break; - } - - effect.startOn += timestamp; - effect.finishOn += timestamp; - - if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) - this.effects.push(effect); - - if(!this.interval) - this.interval = setInterval(this.loop.bind(this), 40); - }, - remove: function(effect) { - this.effects = this.effects.reject(function(e) { return e==effect }); - if(this.effects.length == 0) { - clearInterval(this.interval); - this.interval = null; - } - }, - loop: function() { - var timePos = new Date().getTime(); - this.effects.invoke('loop', timePos); - } -}); - -Effect.Queues = { - instances: $H(), - get: function(queueName) { - if(typeof queueName != 'string') return queueName; - - if(!this.instances[queueName]) - this.instances[queueName] = new Effect.ScopedQueue(); - - return this.instances[queueName]; - } -} -Effect.Queue = Effect.Queues.get('global'); - -Effect.DefaultOptions = { - transition: Effect.Transitions.sinoidal, - duration: 1.0, // seconds - fps: 25.0, // max. 25fps due to Effect.Queue implementation - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' -} - -Effect.Base = function() {}; -Effect.Base.prototype = { - position: null, - start: function(options) { - this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {}); - this.currentFrame = 0; - this.state = 'idle'; - this.startOn = this.options.delay*1000; - this.finishOn = this.startOn + (this.options.duration*1000); - this.event('beforeStart'); - if(!this.options.sync) - Effect.Queues.get(typeof this.options.queue == 'string' ? - 'global' : this.options.queue.scope).add(this); - }, - loop: function(timePos) { - if(timePos >= this.startOn) { - if(timePos >= this.finishOn) { - this.render(1.0); - this.cancel(); - this.event('beforeFinish'); - if(this.finish) this.finish(); - this.event('afterFinish'); - return; - } - var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); - var frame = Math.round(pos * this.options.fps * this.options.duration); - if(frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - } - }, - render: function(pos) { - if(this.state == 'idle') { - this.state = 'running'; - this.event('beforeSetup'); - if(this.setup) this.setup(); - this.event('afterSetup'); - } - if(this.state == 'running') { - if(this.options.transition) pos = this.options.transition(pos); - pos *= (this.options.to-this.options.from); - pos += this.options.from; - this.position = pos; - this.event('beforeUpdate'); - if(this.update) this.update(pos); - this.event('afterUpdate'); - } - }, - cancel: function() { - if(!this.options.sync) - Effect.Queues.get(typeof this.options.queue == 'string' ? - 'global' : this.options.queue.scope).remove(this); - this.state = 'finished'; - }, - event: function(eventName) { - if(this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); - if(this.options[eventName]) this.options[eventName](this); - }, - inspect: function() { - return '#'; - } -} - -Effect.Parallel = Class.create(); -Object.extend(Object.extend(Effect.Parallel.prototype, Effect.Base.prototype), { - initialize: function(effects) { - this.effects = effects || []; - this.start(arguments[1]); - }, - update: function(position) { - this.effects.invoke('render', position); - }, - finish: function(position) { - this.effects.each( function(effect) { - effect.render(1.0); - effect.cancel(); - effect.event('beforeFinish'); - if(effect.finish) effect.finish(position); - effect.event('afterFinish'); - }); - } -}); - -Effect.Event = Class.create(); -Object.extend(Object.extend(Effect.Event.prototype, Effect.Base.prototype), { - initialize: function() { - var options = Object.extend({ - duration: 0 - }, arguments[0] || {}); - this.start(options); - }, - update: Prototype.emptyFunction -}); - -Effect.Opacity = Class.create(); -Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), { - initialize: function(element) { - this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); - // make this work on IE on elements without 'layout' - if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - var options = Object.extend({ - from: this.element.getOpacity() || 0.0, - to: 1.0 - }, arguments[1] || {}); - this.start(options); - }, - update: function(position) { - this.element.setOpacity(position); - } -}); - -Effect.Move = Class.create(); -Object.extend(Object.extend(Effect.Move.prototype, Effect.Base.prototype), { - initialize: function(element) { - this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - x: 0, - y: 0, - mode: 'relative' - }, arguments[1] || {}); - this.start(options); - }, - setup: function() { - // Bug in Opera: Opera returns the "real" position of a static element or - // relative element that does not have top/left explicitly set. - // ==> Always set top and left for position relative elements in your stylesheets - // (to 0 if you do not need them) - this.element.makePositioned(); - this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); - this.originalTop = parseFloat(this.element.getStyle('top') || '0'); - if(this.options.mode == 'absolute') { - // absolute movement, so we need to calc deltaX and deltaY - this.options.x = this.options.x - this.originalLeft; - this.options.y = this.options.y - this.originalTop; - } - }, - update: function(position) { - this.element.setStyle({ - left: Math.round(this.options.x * position + this.originalLeft) + 'px', - top: Math.round(this.options.y * position + this.originalTop) + 'px' - }); - } -}); - -// for backwards compatibility -Effect.MoveBy = function(element, toTop, toLeft) { - return new Effect.Move(element, - Object.extend({ x: toLeft, y: toTop }, arguments[3] || {})); -}; - -Effect.Scale = Class.create(); -Object.extend(Object.extend(Effect.Scale.prototype, Effect.Base.prototype), { - initialize: function(element, percent) { - this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or {} with provided values - scaleFrom: 100.0, - scaleTo: percent - }, arguments[2] || {}); - this.start(options); - }, - setup: function() { - this.restoreAfterFinish = this.options.restoreAfterFinish || false; - this.elementPositioning = this.element.getStyle('position'); - - this.originalStyle = {}; - ['top','left','width','height','fontSize'].each( function(k) { - this.originalStyle[k] = this.element.style[k]; - }.bind(this)); - - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - - var fontSize = this.element.getStyle('font-size') || '100%'; - ['em','px','%','pt'].each( function(fontSizeType) { - if(fontSize.indexOf(fontSizeType)>0) { - this.fontSize = parseFloat(fontSize); - this.fontSizeType = fontSizeType; - } - }.bind(this)); - - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - - this.dims = null; - if(this.options.scaleMode=='box') - this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - if(/^content/.test(this.options.scaleMode)) - this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - if(!this.dims) - this.dims = [this.options.scaleMode.originalHeight, - this.options.scaleMode.originalWidth]; - }, - update: function(position) { - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if(this.options.scaleContent && this.fontSize) - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); - }, - finish: function(position) { - if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle); - }, - setDimensions: function(height, width) { - var d = {}; - if(this.options.scaleX) d.width = Math.round(width) + 'px'; - if(this.options.scaleY) d.height = Math.round(height) + 'px'; - if(this.options.scaleFromCenter) { - var topd = (height - this.dims[0])/2; - var leftd = (width - this.dims[1])/2; - if(this.elementPositioning == 'absolute') { - if(this.options.scaleY) d.top = this.originalTop-topd + 'px'; - if(this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; - } else { - if(this.options.scaleY) d.top = -topd + 'px'; - if(this.options.scaleX) d.left = -leftd + 'px'; - } - } - this.element.setStyle(d); - } -}); - -Effect.Highlight = Class.create(); -Object.extend(Object.extend(Effect.Highlight.prototype, Effect.Base.prototype), { - initialize: function(element) { - this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || {}); - this.start(options); - }, - setup: function() { - // Prevent executing on elements not in the layout flow - if(this.element.getStyle('display')=='none') { this.cancel(); return; } - // Disable background image during the effect - this.oldStyle = { - backgroundImage: this.element.getStyle('background-image') }; - this.element.setStyle({backgroundImage: 'none'}); - if(!this.options.endcolor) - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); - if(!this.options.restorecolor) - this.options.restorecolor = this.element.getStyle('background-color'); - // init color calculations - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); - }, - update: function(position) { - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ - return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart()); }.bind(this)) }); - }, - finish: function() { - this.element.setStyle(Object.extend(this.oldStyle, { - backgroundColor: this.options.restorecolor - })); - } -}); - -Effect.ScrollTo = Class.create(); -Object.extend(Object.extend(Effect.ScrollTo.prototype, Effect.Base.prototype), { - initialize: function(element) { - this.element = $(element); - this.start(arguments[1] || {}); - }, - setup: function() { - Position.prepare(); - var offsets = Position.cumulativeOffset(this.element); - if(this.options.offset) offsets[1] += this.options.offset; - var max = window.innerHeight ? - window.height - window.innerHeight : - document.body.scrollHeight - - (document.documentElement.clientHeight ? - document.documentElement.clientHeight : document.body.clientHeight); - this.scrollStart = Position.deltaY; - this.delta = (offsets[1] > max ? max : offsets[1]) - this.scrollStart; - }, - update: function(position) { - Position.prepare(); - window.scrollTo(Position.deltaX, - this.scrollStart + (position*this.delta)); - } -}); - -/* ------------- combination effects ------------- */ - -Effect.Fade = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - var options = Object.extend({ - from: element.getOpacity() || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { - if(effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); - }}, arguments[1] || {}); - return new Effect.Opacity(element,options); -} - -Effect.Appear = function(element) { - element = $(element); - var options = Object.extend({ - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), - to: 1.0, - // force Safari to render floated elements properly - afterFinishInternal: function(effect) { - effect.element.forceRerendering(); - }, - beforeSetup: function(effect) { - effect.element.setOpacity(effect.options.from).show(); - }}, arguments[1] || {}); - return new Effect.Opacity(element,options); -} - -Effect.Puff = function(element) { - element = $(element); - var oldStyle = { - opacity: element.getInlineOpacity(), - position: element.getStyle('position'), - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height - }; - return new Effect.Parallel( - [ new Effect.Scale(element, 200, - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], - Object.extend({ duration: 1.0, - beforeSetupInternal: function(effect) { - Position.absolutize(effect.effects[0].element) - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().setStyle(oldStyle); } - }, arguments[1] || {}) - ); -} - -Effect.BlindUp = function(element) { - element = $(element); - element.makeClipping(); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - restoreAfterFinish: true, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }, arguments[1] || {}) - ); -} - -Effect.BlindDown = function(element) { - element = $(element); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping(); - } - }, arguments[1] || {})); -} - -Effect.SwitchOff = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - return new Effect.Appear(element, Object.extend({ - duration: 0.4, - from: 0, - transition: Effect.Transitions.flicker, - afterFinishInternal: function(effect) { - new Effect.Scale(effect.element, 1, { - duration: 0.3, scaleFromCenter: true, - scaleX: false, scaleContent: false, restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); - } - }) - } - }, arguments[1] || {})); -} - -Effect.DropOut = function(element) { - element = $(element); - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left'), - opacity: element.getInlineOpacity() }; - return new Effect.Parallel( - [ new Effect.Move(element, {x: 0, y: 100, sync: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 }) ], - Object.extend( - { duration: 0.5, - beforeSetup: function(effect) { - effect.effects[0].element.makePositioned(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); - } - }, arguments[1] || {})); -} - -Effect.Shake = function(element) { - element = $(element); - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left') }; - return new Effect.Move(element, - { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) { - effect.element.undoPositioned().setStyle(oldStyle); - }}) }}) }}) }}) }}) }}); -} - -Effect.SlideDown = function(element) { - element = $(element).cleanWhitespace(); - // SlideDown need to have the content of the element wrapped in a container element with fixed height! - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: window.opera ? 0 : 1, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if(window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || {}) - ); -} - -Effect.SlideUp = function(element) { - element = $(element).cleanWhitespace(); - var oldInnerBottom = element.down().getStyle('bottom'); - return new Effect.Scale(element, window.opera ? 0 : 1, - Object.extend({ scaleContent: false, - scaleX: false, - scaleMode: 'box', - scaleFrom: 100, - restoreAfterFinish: true, - beforeStartInternal: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if(window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({bottom: oldInnerBottom}); - effect.element.down().undoPositioned(); - } - }, arguments[1] || {}) - ); -} - -// Bug in opera makes the TD containing this element expand for a instance after finish -Effect.Squish = function(element) { - return new Effect.Scale(element, window.opera ? 1 : 0, { - restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }); -} - -Effect.Grow = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.full - }, arguments[1] || {}); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = dims.width; - initialMoveY = moveY = 0; - moveX = -dims.width; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = dims.height; - moveY = -dims.height; - break; - case 'bottom-right': - initialMoveX = dims.width; - initialMoveY = dims.height; - moveX = -dims.width; - moveY = -dims.height; - break; - case 'center': - initialMoveX = dims.width / 2; - initialMoveY = dims.height / 2; - moveX = -dims.width / 2; - moveY = -dims.height / 2; - break; - } - - return new Effect.Move(element, { - x: initialMoveX, - y: initialMoveY, - duration: 0.01, - beforeSetup: function(effect) { - effect.element.hide().makeClipping().makePositioned(); - }, - afterFinishInternal: function(effect) { - new Effect.Parallel( - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), - new Effect.Scale(effect.element, 100, { - scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) - ], Object.extend({ - beforeSetup: function(effect) { - effect.effects[0].element.setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); - } - }, options) - ) - } - }); -} - -Effect.Shrink = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.none - }, arguments[1] || {}); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = dims.width; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = dims.height; - break; - case 'bottom-right': - moveX = dims.width; - moveY = dims.height; - break; - case 'center': - moveX = dims.width / 2; - moveY = dims.height / 2; - break; - } - - return new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) - ], Object.extend({ - beforeStartInternal: function(effect) { - effect.effects[0].element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } - }, options) - ); -} - -Effect.Pulsate = function(element) { - element = $(element); - var options = arguments[1] || {}; - var oldOpacity = element.getInlineOpacity(); - var transition = options.transition || Effect.Transitions.sinoidal; - var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; - reverser.bind(transition); - return new Effect.Opacity(element, - Object.extend(Object.extend({ duration: 2.0, from: 0, - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } - }, options), {transition: reverser})); -} - -Effect.Fold = function(element) { - element = $(element); - var oldStyle = { - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height }; - element.makeClipping(); - return new Effect.Scale(element, 5, Object.extend({ - scaleContent: false, - scaleX: false, - afterFinishInternal: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, - scaleY: false, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().setStyle(oldStyle); - } }); - }}, arguments[1] || {})); -}; - -Effect.Morph = Class.create(); -Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), { - initialize: function(element) { - this.element = $(element); - if(!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - style: '' - }, arguments[1] || {}); - this.start(options); - }, - setup: function(){ - function parseColor(color){ - if(!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; - color = color.parseColor(); - return $R(0,2).map(function(i){ - return parseInt( color.slice(i*2+1,i*2+3), 16 ) - }); - } - this.transforms = this.options.style.parseStyle().map(function(property){ - var originalValue = this.element.getStyle(property[0]); - return $H({ - style: property[0], - originalValue: property[1].unit=='color' ? - parseColor(originalValue) : parseFloat(originalValue || 0), - targetValue: property[1].unit=='color' ? - parseColor(property[1].value) : property[1].value, - unit: property[1].unit - }); - }.bind(this)).reject(function(transform){ - return ( - (transform.originalValue == transform.targetValue) || - ( - transform.unit != 'color' && - (isNaN(transform.originalValue) || isNaN(transform.targetValue)) - ) - ) - }); - }, - update: function(position) { - var style = $H(), value = null; - this.transforms.each(function(transform){ - value = transform.unit=='color' ? - $R(0,2).inject('#',function(m,v,i){ - return m+(Math.round(transform.originalValue[i]+ - (transform.targetValue[i] - transform.originalValue[i])*position)).toColorPart() }) : - transform.originalValue + Math.round( - ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit; - style[transform.style] = value; - }); - this.element.setStyle(style); - } -}); - -Effect.Transform = Class.create(); -Object.extend(Effect.Transform.prototype, { - initialize: function(tracks){ - this.tracks = []; - this.options = arguments[1] || {}; - this.addTracks(tracks); - }, - addTracks: function(tracks){ - tracks.each(function(track){ - var data = $H(track).values().first(); - this.tracks.push($H({ - ids: $H(track).keys().first(), - effect: Effect.Morph, - options: { style: data } - })); - }.bind(this)); - return this; - }, - play: function(){ - return new Effect.Parallel( - this.tracks.map(function(track){ - var elements = [$(track.ids) || $$(track.ids)].flatten(); - return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) }); - }).flatten(), - this.options - ); - } -}); - -Element.CSS_PROPERTIES = ['azimuth', 'backgroundAttachment', 'backgroundColor', 'backgroundImage', - 'backgroundPosition', 'backgroundRepeat', 'borderBottomColor', 'borderBottomStyle', - 'borderBottomWidth', 'borderCollapse', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', - 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderSpacing', 'borderTopColor', - 'borderTopStyle', 'borderTopWidth', 'bottom', 'captionSide', 'clear', 'clip', 'color', 'content', - 'counterIncrement', 'counterReset', 'cssFloat', 'cueAfter', 'cueBefore', 'cursor', 'direction', - 'display', 'elevation', 'emptyCells', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', - 'fontStyle', 'fontVariant', 'fontWeight', 'height', 'left', 'letterSpacing', 'lineHeight', - 'listStyleImage', 'listStylePosition', 'listStyleType', 'marginBottom', 'marginLeft', 'marginRight', - 'marginTop', 'markerOffset', 'marks', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'opacity', - 'orphans', 'outlineColor', 'outlineOffset', 'outlineStyle', 'outlineWidth', 'overflowX', 'overflowY', - 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'page', 'pageBreakAfter', 'pageBreakBefore', - 'pageBreakInside', 'pauseAfter', 'pauseBefore', 'pitch', 'pitchRange', 'position', 'quotes', - 'richness', 'right', 'size', 'speakHeader', 'speakNumeral', 'speakPunctuation', 'speechRate', 'stress', - 'tableLayout', 'textAlign', 'textDecoration', 'textIndent', 'textShadow', 'textTransform', 'top', - 'unicodeBidi', 'verticalAlign', 'visibility', 'voiceFamily', 'volume', 'whiteSpace', 'widows', - 'width', 'wordSpacing', 'zIndex']; - -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; - -String.prototype.parseStyle = function(){ - var element = Element.extend(document.createElement('div')); - element.innerHTML = '

      '; - var style = element.down().style, styleRules = $H(); - - Element.CSS_PROPERTIES.each(function(property){ - if(style[property]) styleRules[property] = style[property]; - }); - - var result = $H(); - - styleRules.each(function(pair){ - var property = pair[0], value = pair[1], unit = null; - - if(value.parseColor('#zzzzzz') != '#zzzzzz') { - value = value.parseColor(); - unit = 'color'; - } else if(Element.CSS_LENGTH.test(value)) - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/), - value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null; - - result[property.underscore().dasherize()] = $H({ value:value, unit:unit }); - }.bind(this)); - - return result; -}; - -Element.morph = function(element, style) { - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || {})); - return element; -}; - -['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom', - 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each( - function(f) { Element.Methods[f] = Element[f]; } -); - -Element.Methods.visualEffect = function(element, effect, options) { - s = effect.gsub(/_/, '-').camelize(); - effect_class = s.charAt(0).toUpperCase() + s.substring(1); - new Effect[effect_class](element, options); - return $(element); -}; - -Element.addMethods(); \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/public/javascripts/prototype.js b/vendor/plugins/shoulda/test/rails_root/public/javascripts/prototype.js deleted file mode 100644 index 5058221..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/javascripts/prototype.js +++ /dev/null @@ -1,2515 +0,0 @@ -/* Prototype JavaScript framework, version 1.5.0 - * (c) 2005-2007 Sam Stephenson - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://prototype.conio.net/ - * -/*--------------------------------------------------------------------------*/ - -var Prototype = { - Version: '1.5.0', - BrowserFeatures: { - XPath: !!document.evaluate - }, - - ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', - emptyFunction: function() {}, - K: function(x) { return x } -} - -var Class = { - create: function() { - return function() { - this.initialize.apply(this, arguments); - } - } -} - -var Abstract = new Object(); - -Object.extend = function(destination, source) { - for (var property in source) { - destination[property] = source[property]; - } - return destination; -} - -Object.extend(Object, { - inspect: function(object) { - try { - if (object === undefined) return 'undefined'; - if (object === null) return 'null'; - return object.inspect ? object.inspect() : object.toString(); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } - }, - - keys: function(object) { - var keys = []; - for (var property in object) - keys.push(property); - return keys; - }, - - values: function(object) { - var values = []; - for (var property in object) - values.push(object[property]); - return values; - }, - - clone: function(object) { - return Object.extend({}, object); - } -}); - -Function.prototype.bind = function() { - var __method = this, args = $A(arguments), object = args.shift(); - return function() { - return __method.apply(object, args.concat($A(arguments))); - } -} - -Function.prototype.bindAsEventListener = function(object) { - var __method = this, args = $A(arguments), object = args.shift(); - return function(event) { - return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); - } -} - -Object.extend(Number.prototype, { - toColorPart: function() { - var digits = this.toString(16); - if (this < 16) return '0' + digits; - return digits; - }, - - succ: function() { - return this + 1; - }, - - times: function(iterator) { - $R(0, this, true).each(iterator); - return this; - } -}); - -var Try = { - these: function() { - var returnValue; - - for (var i = 0, length = arguments.length; i < length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) {} - } - - return returnValue; - } -} - -/*--------------------------------------------------------------------------*/ - -var PeriodicalExecuter = Class.create(); -PeriodicalExecuter.prototype = { - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - stop: function() { - if (!this.timer) return; - clearInterval(this.timer); - this.timer = null; - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.callback(this); - } finally { - this.currentlyExecuting = false; - } - } - } -} -String.interpret = function(value){ - return value == null ? '' : String(value); -} - -Object.extend(String.prototype, { - gsub: function(pattern, replacement) { - var result = '', source = this, match; - replacement = arguments.callee.prepareReplacement(replacement); - - while (source.length > 0) { - if (match = source.match(pattern)) { - result += source.slice(0, match.index); - result += String.interpret(replacement(match)); - source = source.slice(match.index + match[0].length); - } else { - result += source, source = ''; - } - } - return result; - }, - - sub: function(pattern, replacement, count) { - replacement = this.gsub.prepareReplacement(replacement); - count = count === undefined ? 1 : count; - - return this.gsub(pattern, function(match) { - if (--count < 0) return match[0]; - return replacement(match); - }); - }, - - scan: function(pattern, iterator) { - this.gsub(pattern, iterator); - return this; - }, - - truncate: function(length, truncation) { - length = length || 30; - truncation = truncation === undefined ? '...' : truncation; - return this.length > length ? - this.slice(0, length - truncation.length) + truncation : this; - }, - - strip: function() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); - }, - - stripTags: function() { - return this.replace(/<\/?[^>]+>/gi, ''); - }, - - stripScripts: function() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - }, - - extractScripts: function() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); - var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - }, - - evalScripts: function() { - return this.extractScripts().map(function(script) { return eval(script) }); - }, - - escapeHTML: function() { - var div = document.createElement('div'); - var text = document.createTextNode(this); - div.appendChild(text); - return div.innerHTML; - }, - - unescapeHTML: function() { - var div = document.createElement('div'); - div.innerHTML = this.stripTags(); - return div.childNodes[0] ? (div.childNodes.length > 1 ? - $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : - div.childNodes[0].nodeValue) : ''; - }, - - toQueryParams: function(separator) { - var match = this.strip().match(/([^?#]*)(#.*)?$/); - if (!match) return {}; - - return match[1].split(separator || '&').inject({}, function(hash, pair) { - if ((pair = pair.split('='))[0]) { - var name = decodeURIComponent(pair[0]); - var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; - - if (hash[name] !== undefined) { - if (hash[name].constructor != Array) - hash[name] = [hash[name]]; - if (value) hash[name].push(value); - } - else hash[name] = value; - } - return hash; - }); - }, - - toArray: function() { - return this.split(''); - }, - - succ: function() { - return this.slice(0, this.length - 1) + - String.fromCharCode(this.charCodeAt(this.length - 1) + 1); - }, - - camelize: function() { - var parts = this.split('-'), len = parts.length; - if (len == 1) return parts[0]; - - var camelized = this.charAt(0) == '-' - ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) - : parts[0]; - - for (var i = 1; i < len; i++) - camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); - - return camelized; - }, - - capitalize: function(){ - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); - }, - - underscore: function() { - return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); - }, - - dasherize: function() { - return this.gsub(/_/,'-'); - }, - - inspect: function(useDoubleQuotes) { - var escapedString = this.replace(/\\/g, '\\\\'); - if (useDoubleQuotes) - return '"' + escapedString.replace(/"/g, '\\"') + '"'; - else - return "'" + escapedString.replace(/'/g, '\\\'') + "'"; - } -}); - -String.prototype.gsub.prepareReplacement = function(replacement) { - if (typeof replacement == 'function') return replacement; - var template = new Template(replacement); - return function(match) { return template.evaluate(match) }; -} - -String.prototype.parseQuery = String.prototype.toQueryParams; - -var Template = Class.create(); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; -Template.prototype = { - initialize: function(template, pattern) { - this.template = template.toString(); - this.pattern = pattern || Template.Pattern; - }, - - evaluate: function(object) { - return this.template.gsub(this.pattern, function(match) { - var before = match[1]; - if (before == '\\') return match[2]; - return before + String.interpret(object[match[3]]); - }); - } -} - -var $break = new Object(); -var $continue = new Object(); - -var Enumerable = { - each: function(iterator) { - var index = 0; - try { - this._each(function(value) { - try { - iterator(value, index++); - } catch (e) { - if (e != $continue) throw e; - } - }); - } catch (e) { - if (e != $break) throw e; - } - return this; - }, - - eachSlice: function(number, iterator) { - var index = -number, slices = [], array = this.toArray(); - while ((index += number) < array.length) - slices.push(array.slice(index, index+number)); - return slices.map(iterator); - }, - - all: function(iterator) { - var result = true; - this.each(function(value, index) { - result = result && !!(iterator || Prototype.K)(value, index); - if (!result) throw $break; - }); - return result; - }, - - any: function(iterator) { - var result = false; - this.each(function(value, index) { - if (result = !!(iterator || Prototype.K)(value, index)) - throw $break; - }); - return result; - }, - - collect: function(iterator) { - var results = []; - this.each(function(value, index) { - results.push((iterator || Prototype.K)(value, index)); - }); - return results; - }, - - detect: function(iterator) { - var result; - this.each(function(value, index) { - if (iterator(value, index)) { - result = value; - throw $break; - } - }); - return result; - }, - - findAll: function(iterator) { - var results = []; - this.each(function(value, index) { - if (iterator(value, index)) - results.push(value); - }); - return results; - }, - - grep: function(pattern, iterator) { - var results = []; - this.each(function(value, index) { - var stringValue = value.toString(); - if (stringValue.match(pattern)) - results.push((iterator || Prototype.K)(value, index)); - }) - return results; - }, - - include: function(object) { - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - }, - - inGroupsOf: function(number, fillWith) { - fillWith = fillWith === undefined ? null : fillWith; - return this.eachSlice(number, function(slice) { - while(slice.length < number) slice.push(fillWith); - return slice; - }); - }, - - inject: function(memo, iterator) { - this.each(function(value, index) { - memo = iterator(memo, value, index); - }); - return memo; - }, - - invoke: function(method) { - var args = $A(arguments).slice(1); - return this.map(function(value) { - return value[method].apply(value, args); - }); - }, - - max: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (result == undefined || value >= result) - result = value; - }); - return result; - }, - - min: function(iterator) { - var result; - this.each(function(value, index) { - value = (iterator || Prototype.K)(value, index); - if (result == undefined || value < result) - result = value; - }); - return result; - }, - - partition: function(iterator) { - var trues = [], falses = []; - this.each(function(value, index) { - ((iterator || Prototype.K)(value, index) ? - trues : falses).push(value); - }); - return [trues, falses]; - }, - - pluck: function(property) { - var results = []; - this.each(function(value, index) { - results.push(value[property]); - }); - return results; - }, - - reject: function(iterator) { - var results = []; - this.each(function(value, index) { - if (!iterator(value, index)) - results.push(value); - }); - return results; - }, - - sortBy: function(iterator) { - return this.map(function(value, index) { - return {value: value, criteria: iterator(value, index)}; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - }, - - toArray: function() { - return this.map(); - }, - - zip: function() { - var iterator = Prototype.K, args = $A(arguments); - if (typeof args.last() == 'function') - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - return iterator(collections.pluck(index)); - }); - }, - - size: function() { - return this.toArray().length; - }, - - inspect: function() { - return '#'; - } -} - -Object.extend(Enumerable, { - map: Enumerable.collect, - find: Enumerable.detect, - select: Enumerable.findAll, - member: Enumerable.include, - entries: Enumerable.toArray -}); -var $A = Array.from = function(iterable) { - if (!iterable) return []; - if (iterable.toArray) { - return iterable.toArray(); - } else { - var results = []; - for (var i = 0, length = iterable.length; i < length; i++) - results.push(iterable[i]); - return results; - } -} - -Object.extend(Array.prototype, Enumerable); - -if (!Array.prototype._reverse) - Array.prototype._reverse = Array.prototype.reverse; - -Object.extend(Array.prototype, { - _each: function(iterator) { - for (var i = 0, length = this.length; i < length; i++) - iterator(this[i]); - }, - - clear: function() { - this.length = 0; - return this; - }, - - first: function() { - return this[0]; - }, - - last: function() { - return this[this.length - 1]; - }, - - compact: function() { - return this.select(function(value) { - return value != null; - }); - }, - - flatten: function() { - return this.inject([], function(array, value) { - return array.concat(value && value.constructor == Array ? - value.flatten() : [value]); - }); - }, - - without: function() { - var values = $A(arguments); - return this.select(function(value) { - return !values.include(value); - }); - }, - - indexOf: function(object) { - for (var i = 0, length = this.length; i < length; i++) - if (this[i] == object) return i; - return -1; - }, - - reverse: function(inline) { - return (inline !== false ? this : this.toArray())._reverse(); - }, - - reduce: function() { - return this.length > 1 ? this : this[0]; - }, - - uniq: function() { - return this.inject([], function(array, value) { - return array.include(value) ? array : array.concat([value]); - }); - }, - - clone: function() { - return [].concat(this); - }, - - size: function() { - return this.length; - }, - - inspect: function() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } -}); - -Array.prototype.toArray = Array.prototype.clone; - -function $w(string){ - string = string.strip(); - return string ? string.split(/\s+/) : []; -} - -if(window.opera){ - Array.prototype.concat = function(){ - var array = []; - for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); - for(var i = 0, length = arguments.length; i < length; i++) { - if(arguments[i].constructor == Array) { - for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) - array.push(arguments[i][j]); - } else { - array.push(arguments[i]); - } - } - return array; - } -} -var Hash = function(obj) { - Object.extend(this, obj || {}); -}; - -Object.extend(Hash, { - toQueryString: function(obj) { - var parts = []; - - this.prototype._each.call(obj, function(pair) { - if (!pair.key) return; - - if (pair.value && pair.value.constructor == Array) { - var values = pair.value.compact(); - if (values.length < 2) pair.value = values.reduce(); - else { - key = encodeURIComponent(pair.key); - values.each(function(value) { - value = value != undefined ? encodeURIComponent(value) : ''; - parts.push(key + '=' + encodeURIComponent(value)); - }); - return; - } - } - if (pair.value == undefined) pair[1] = ''; - parts.push(pair.map(encodeURIComponent).join('=')); - }); - - return parts.join('&'); - } -}); - -Object.extend(Hash.prototype, Enumerable); -Object.extend(Hash.prototype, { - _each: function(iterator) { - for (var key in this) { - var value = this[key]; - if (value && value == Hash.prototype[key]) continue; - - var pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - }, - - keys: function() { - return this.pluck('key'); - }, - - values: function() { - return this.pluck('value'); - }, - - merge: function(hash) { - return $H(hash).inject(this, function(mergedHash, pair) { - mergedHash[pair.key] = pair.value; - return mergedHash; - }); - }, - - remove: function() { - var result; - for(var i = 0, length = arguments.length; i < length; i++) { - var value = this[arguments[i]]; - if (value !== undefined){ - if (result === undefined) result = value; - else { - if (result.constructor != Array) result = [result]; - result.push(value) - } - } - delete this[arguments[i]]; - } - return result; - }, - - toQueryString: function() { - return Hash.toQueryString(this); - }, - - inspect: function() { - return '#'; - } -}); - -function $H(object) { - if (object && object.constructor == Hash) return object; - return new Hash(object); -}; -ObjectRange = Class.create(); -Object.extend(ObjectRange.prototype, Enumerable); -Object.extend(ObjectRange.prototype, { - initialize: function(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - }, - - _each: function(iterator) { - var value = this.start; - while (this.include(value)) { - iterator(value); - value = value.succ(); - } - }, - - include: function(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } -}); - -var $R = function(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -} - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new XMLHttpRequest()}, - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')} - ) || false; - }, - - activeRequestCount: 0 -} - -Ajax.Responders = { - responders: [], - - _each: function(iterator) { - this.responders._each(iterator); - }, - - register: function(responder) { - if (!this.include(responder)) - this.responders.push(responder); - }, - - unregister: function(responder) { - this.responders = this.responders.without(responder); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (typeof responder[callback] == 'function') { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) {} - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { - Ajax.activeRequestCount++; - }, - onComplete: function() { - Ajax.activeRequestCount--; - } -}); - -Ajax.Base = function() {}; -Ajax.Base.prototype = { - setOptions: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/x-www-form-urlencoded', - encoding: 'UTF-8', - parameters: '' - } - Object.extend(this.options, options || {}); - - this.options.method = this.options.method.toLowerCase(); - if (typeof this.options.parameters == 'string') - this.options.parameters = this.options.parameters.toQueryParams(); - } -} - -Ajax.Request = Class.create(); -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - -Ajax.Request.prototype = Object.extend(new Ajax.Base(), { - _complete: false, - - initialize: function(url, options) { - this.transport = Ajax.getTransport(); - this.setOptions(options); - this.request(url); - }, - - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = this.options.parameters; - - if (!['get', 'post'].include(this.method)) { - // simulate other verbs over post - params['_method'] = this.method; - this.method = 'post'; - } - - params = Hash.toQueryString(params); - if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' - - // when GET, append parameters to URL - if (this.method == 'get' && params) - this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; - - try { - Ajax.Responders.dispatch('onCreate', this, this.transport); - - this.transport.open(this.method.toUpperCase(), this.url, - this.options.asynchronous); - - if (this.options.asynchronous) - setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); - - this.transport.onreadystatechange = this.onStateChange.bind(this); - this.setRequestHeaders(); - - var body = this.method == 'post' ? (this.options.postBody || params) : null; - - this.transport.send(body); - - /* Force Firefox to handle ready state 4 for synchronous requests */ - if (!this.options.asynchronous && this.transport.overrideMimeType) - this.onStateChange(); - - } - catch (e) { - this.dispatchException(e); - } - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) - this.respondToReadyState(this.transport.readyState); - }, - - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'X-Prototype-Version': Prototype.Version, - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) - headers['Connection'] = 'close'; - } - - // user-defined headers - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (typeof extras.push == 'function') - for (var i = 0, length = extras.length; i < length; i += 2) - headers[extras[i]] = extras[i+1]; - else - $H(extras).each(function(pair) { headers[pair.key] = pair.value }); - } - - for (var name in headers) - this.transport.setRequestHeader(name, headers[name]); - }, - - success: function() { - return !this.transport.status - || (this.transport.status >= 200 && this.transport.status < 300); - }, - - respondToReadyState: function(readyState) { - var state = Ajax.Request.Events[readyState]; - var transport = this.transport, json = this.evalJSON(); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + this.transport.status] - || this.options['on' + (this.success() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(transport, json); - } catch (e) { - this.dispatchException(e); - } - - if ((this.getHeader('Content-type') || 'text/javascript').strip(). - match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) - this.evalResponse(); - } - - try { - (this.options['on' + state] || Prototype.emptyFunction)(transport, json); - Ajax.Responders.dispatch('on' + state, this, transport, json); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - // avoid memory leak in MSIE: clean up - this.transport.onreadystatechange = Prototype.emptyFunction; - } - }, - - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name); - } catch (e) { return null } - }, - - evalJSON: function() { - try { - var json = this.getHeader('X-JSON'); - return json ? eval('(' + json + ')') : null; - } catch (e) { return null } - }, - - evalResponse: function() { - try { - return eval(this.transport.responseText); - } catch (e) { - this.dispatchException(e); - } - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Updater = Class.create(); - -Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { - initialize: function(container, url, options) { - this.container = { - success: (container.success || container), - failure: (container.failure || (container.success ? null : container)) - } - - this.transport = Ajax.getTransport(); - this.setOptions(options); - - var onComplete = this.options.onComplete || Prototype.emptyFunction; - this.options.onComplete = (function(transport, param) { - this.updateContent(); - onComplete(transport, param); - }).bind(this); - - this.request(url); - }, - - updateContent: function() { - var receiver = this.container[this.success() ? 'success' : 'failure']; - var response = this.transport.responseText; - - if (!this.options.evalScripts) response = response.stripScripts(); - - if (receiver = $(receiver)) { - if (this.options.insertion) - new this.options.insertion(receiver, response); - else - receiver.update(response); - } - - if (this.success()) { - if (this.onComplete) - setTimeout(this.onComplete.bind(this), 10); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(); -Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { - initialize: function(container, url, options) { - this.setOptions(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = {}; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.options.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(request) { - if (this.options.decay) { - this.decay = (request.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = request.responseText; - } - this.timer = setTimeout(this.onTimerEvent.bind(this), - this.decay * this.frequency * 1000); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); -function $(element) { - if (arguments.length > 1) { - for (var i = 0, elements = [], length = arguments.length; i < length; i++) - elements.push($(arguments[i])); - return elements; - } - if (typeof element == 'string') - element = document.getElementById(element); - return Element.extend(element); -} - -if (Prototype.BrowserFeatures.XPath) { - document._getElementsByXPath = function(expression, parentElement) { - var results = []; - var query = document.evaluate(expression, $(parentElement) || document, - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - for (var i = 0, length = query.snapshotLength; i < length; i++) - results.push(query.snapshotItem(i)); - return results; - }; -} - -document.getElementsByClassName = function(className, parentElement) { - if (Prototype.BrowserFeatures.XPath) { - var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; - return document._getElementsByXPath(q, parentElement); - } else { - var children = ($(parentElement) || document.body).getElementsByTagName('*'); - var elements = [], child; - for (var i = 0, length = children.length; i < length; i++) { - child = children[i]; - if (Element.hasClassName(child, className)) - elements.push(Element.extend(child)); - } - return elements; - } -}; - -/*--------------------------------------------------------------------------*/ - -if (!window.Element) - var Element = new Object(); - -Element.extend = function(element) { - if (!element || _nativeExtensions || element.nodeType == 3) return element; - - if (!element._extended && element.tagName && element != window) { - var methods = Object.clone(Element.Methods), cache = Element.extend.cache; - - if (element.tagName == 'FORM') - Object.extend(methods, Form.Methods); - if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) - Object.extend(methods, Form.Element.Methods); - - Object.extend(methods, Element.Methods.Simulated); - - for (var property in methods) { - var value = methods[property]; - if (typeof value == 'function' && !(property in element)) - element[property] = cache.findOrStore(value); - } - } - - element._extended = true; - return element; -}; - -Element.extend.cache = { - findOrStore: function(value) { - return this[value] = this[value] || function() { - return value.apply(null, [this].concat($A(arguments))); - } - } -}; - -Element.Methods = { - visible: function(element) { - return $(element).style.display != 'none'; - }, - - toggle: function(element) { - element = $(element); - Element[Element.visible(element) ? 'hide' : 'show'](element); - return element; - }, - - hide: function(element) { - $(element).style.display = 'none'; - return element; - }, - - show: function(element) { - $(element).style.display = ''; - return element; - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - return element; - }, - - update: function(element, html) { - html = typeof html == 'undefined' ? '' : html.toString(); - $(element).innerHTML = html.stripScripts(); - setTimeout(function() {html.evalScripts()}, 10); - return element; - }, - - replace: function(element, html) { - element = $(element); - html = typeof html == 'undefined' ? '' : html.toString(); - if (element.outerHTML) { - element.outerHTML = html.stripScripts(); - } else { - var range = element.ownerDocument.createRange(); - range.selectNodeContents(element); - element.parentNode.replaceChild( - range.createContextualFragment(html.stripScripts()), element); - } - setTimeout(function() {html.evalScripts()}, 10); - return element; - }, - - inspect: function(element) { - element = $(element); - var result = '<' + element.tagName.toLowerCase(); - $H({'id': 'id', 'className': 'class'}).each(function(pair) { - var property = pair.first(), attribute = pair.last(); - var value = (element[property] || '').toString(); - if (value) result += ' ' + attribute + '=' + value.inspect(true); - }); - return result + '>'; - }, - - recursivelyCollect: function(element, property) { - element = $(element); - var elements = []; - while (element = element[property]) - if (element.nodeType == 1) - elements.push(Element.extend(element)); - return elements; - }, - - ancestors: function(element) { - return $(element).recursivelyCollect('parentNode'); - }, - - descendants: function(element) { - return $A($(element).getElementsByTagName('*')); - }, - - immediateDescendants: function(element) { - if (!(element = $(element).firstChild)) return []; - while (element && element.nodeType != 1) element = element.nextSibling; - if (element) return [element].concat($(element).nextSiblings()); - return []; - }, - - previousSiblings: function(element) { - return $(element).recursivelyCollect('previousSibling'); - }, - - nextSiblings: function(element) { - return $(element).recursivelyCollect('nextSibling'); - }, - - siblings: function(element) { - element = $(element); - return element.previousSiblings().reverse().concat(element.nextSiblings()); - }, - - match: function(element, selector) { - if (typeof selector == 'string') - selector = new Selector(selector); - return selector.match($(element)); - }, - - up: function(element, expression, index) { - return Selector.findElement($(element).ancestors(), expression, index); - }, - - down: function(element, expression, index) { - return Selector.findElement($(element).descendants(), expression, index); - }, - - previous: function(element, expression, index) { - return Selector.findElement($(element).previousSiblings(), expression, index); - }, - - next: function(element, expression, index) { - return Selector.findElement($(element).nextSiblings(), expression, index); - }, - - getElementsBySelector: function() { - var args = $A(arguments), element = $(args.shift()); - return Selector.findChildElements(element, args); - }, - - getElementsByClassName: function(element, className) { - return document.getElementsByClassName(className, element); - }, - - readAttribute: function(element, name) { - element = $(element); - if (document.all && !window.opera) { - var t = Element._attributeTranslations; - if (t.values[name]) return t.values[name](element, name); - if (t.names[name]) name = t.names[name]; - var attribute = element.attributes[name]; - if(attribute) return attribute.nodeValue; - } - return element.getAttribute(name); - }, - - getHeight: function(element) { - return $(element).getDimensions().height; - }, - - getWidth: function(element) { - return $(element).getDimensions().width; - }, - - classNames: function(element) { - return new Element.ClassNames(element); - }, - - hasClassName: function(element, className) { - if (!(element = $(element))) return; - var elementClassName = element.className; - if (elementClassName.length == 0) return false; - if (elementClassName == className || - elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) - return true; - return false; - }, - - addClassName: function(element, className) { - if (!(element = $(element))) return; - Element.classNames(element).add(className); - return element; - }, - - removeClassName: function(element, className) { - if (!(element = $(element))) return; - Element.classNames(element).remove(className); - return element; - }, - - toggleClassName: function(element, className) { - if (!(element = $(element))) return; - Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); - return element; - }, - - observe: function() { - Event.observe.apply(Event, arguments); - return $A(arguments).first(); - }, - - stopObserving: function() { - Event.stopObserving.apply(Event, arguments); - return $A(arguments).first(); - }, - - // removes whitespace-only text node children - cleanWhitespace: function(element) { - element = $(element); - var node = element.firstChild; - while (node) { - var nextNode = node.nextSibling; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - element.removeChild(node); - node = nextNode; - } - return element; - }, - - empty: function(element) { - return $(element).innerHTML.match(/^\s*$/); - }, - - descendantOf: function(element, ancestor) { - element = $(element), ancestor = $(ancestor); - while (element = element.parentNode) - if (element == ancestor) return true; - return false; - }, - - scrollTo: function(element) { - element = $(element); - var pos = Position.cumulativeOffset(element); - window.scrollTo(pos[0], pos[1]); - return element; - }, - - getStyle: function(element, style) { - element = $(element); - if (['float','cssFloat'].include(style)) - style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); - style = style.camelize(); - var value = element.style[style]; - if (!value) { - if (document.defaultView && document.defaultView.getComputedStyle) { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } else if (element.currentStyle) { - value = element.currentStyle[style]; - } - } - - if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) - value = element['offset'+style.capitalize()] + 'px'; - - if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) - if (Element.getStyle(element, 'position') == 'static') value = 'auto'; - if(style == 'opacity') { - if(value) return parseFloat(value); - if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) - if(value[1]) return parseFloat(value[1]) / 100; - return 1.0; - } - return value == 'auto' ? null : value; - }, - - setStyle: function(element, style) { - element = $(element); - for (var name in style) { - var value = style[name]; - if(name == 'opacity') { - if (value == 1) { - value = (/Gecko/.test(navigator.userAgent) && - !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); - } else if(value == '') { - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); - } else { - if(value < 0.00001) value = 0; - if(/MSIE/.test(navigator.userAgent) && !window.opera) - element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + - 'alpha(opacity='+value*100+')'; - } - } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; - element.style[name.camelize()] = value; - } - return element; - }, - - getDimensions: function(element) { - element = $(element); - var display = $(element).getStyle('display'); - if (display != 'none' && display != null) // Safari bug - return {width: element.offsetWidth, height: element.offsetHeight}; - - // All *Width and *Height properties give 0 on elements with display none, - // so enable the element temporarily - var els = element.style; - var originalVisibility = els.visibility; - var originalPosition = els.position; - var originalDisplay = els.display; - els.visibility = 'hidden'; - els.position = 'absolute'; - els.display = 'block'; - var originalWidth = element.clientWidth; - var originalHeight = element.clientHeight; - els.display = originalDisplay; - els.position = originalPosition; - els.visibility = originalVisibility; - return {width: originalWidth, height: originalHeight}; - }, - - makePositioned: function(element) { - element = $(element); - var pos = Element.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element._madePositioned = true; - element.style.position = 'relative'; - // Opera returns the offset relative to the positioning context, when an - // element is position relative but top and left have not been defined - if (window.opera) { - element.style.top = 0; - element.style.left = 0; - } - } - return element; - }, - - undoPositioned: function(element) { - element = $(element); - if (element._madePositioned) { - element._madePositioned = undefined; - element.style.position = - element.style.top = - element.style.left = - element.style.bottom = - element.style.right = ''; - } - return element; - }, - - makeClipping: function(element) { - element = $(element); - if (element._overflow) return element; - element._overflow = element.style.overflow || 'auto'; - if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') - element.style.overflow = 'hidden'; - return element; - }, - - undoClipping: function(element) { - element = $(element); - if (!element._overflow) return element; - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; - element._overflow = null; - return element; - } -}; - -Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); - -Element._attributeTranslations = {}; - -Element._attributeTranslations.names = { - colspan: "colSpan", - rowspan: "rowSpan", - valign: "vAlign", - datetime: "dateTime", - accesskey: "accessKey", - tabindex: "tabIndex", - enctype: "encType", - maxlength: "maxLength", - readonly: "readOnly", - longdesc: "longDesc" -}; - -Element._attributeTranslations.values = { - _getAttr: function(element, attribute) { - return element.getAttribute(attribute, 2); - }, - - _flag: function(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - }, - - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - - title: function(element) { - var node = element.getAttributeNode('title'); - return node.specified ? node.nodeValue : null; - } -}; - -Object.extend(Element._attributeTranslations.values, { - href: Element._attributeTranslations.values._getAttr, - src: Element._attributeTranslations.values._getAttr, - disabled: Element._attributeTranslations.values._flag, - checked: Element._attributeTranslations.values._flag, - readonly: Element._attributeTranslations.values._flag, - multiple: Element._attributeTranslations.values._flag -}); - -Element.Methods.Simulated = { - hasAttribute: function(element, attribute) { - var t = Element._attributeTranslations; - attribute = t.names[attribute] || attribute; - return $(element).getAttributeNode(attribute).specified; - } -}; - -// IE is missing .innerHTML support for TABLE-related elements -if (document.all && !window.opera){ - Element.Methods.update = function(element, html) { - element = $(element); - html = typeof html == 'undefined' ? '' : html.toString(); - var tagName = element.tagName.toUpperCase(); - if (['THEAD','TBODY','TR','TD'].include(tagName)) { - var div = document.createElement('div'); - switch (tagName) { - case 'THEAD': - case 'TBODY': - div.innerHTML = '' + html.stripScripts() + '
      '; - depth = 2; - break; - case 'TR': - div.innerHTML = '' + html.stripScripts() + '
      '; - depth = 3; - break; - case 'TD': - div.innerHTML = '
      ' + html.stripScripts() + '
      '; - depth = 4; - } - $A(element.childNodes).each(function(node){ - element.removeChild(node) - }); - depth.times(function(){ div = div.firstChild }); - - $A(div.childNodes).each( - function(node){ element.appendChild(node) }); - } else { - element.innerHTML = html.stripScripts(); - } - setTimeout(function() {html.evalScripts()}, 10); - return element; - } -}; - -Object.extend(Element, Element.Methods); - -var _nativeExtensions = false; - -if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) - ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { - var className = 'HTML' + tag + 'Element'; - if(window[className]) return; - var klass = window[className] = {}; - klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; - }); - -Element.addMethods = function(methods) { - Object.extend(Element.Methods, methods || {}); - - function copy(methods, destination, onlyIfAbsent) { - onlyIfAbsent = onlyIfAbsent || false; - var cache = Element.extend.cache; - for (var property in methods) { - var value = methods[property]; - if (!onlyIfAbsent || !(property in destination)) - destination[property] = cache.findOrStore(value); - } - } - - if (typeof HTMLElement != 'undefined') { - copy(Element.Methods, HTMLElement.prototype); - copy(Element.Methods.Simulated, HTMLElement.prototype, true); - copy(Form.Methods, HTMLFormElement.prototype); - [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { - copy(Form.Element.Methods, klass.prototype); - }); - _nativeExtensions = true; - } -} - -var Toggle = new Object(); -Toggle.display = Element.toggle; - -/*--------------------------------------------------------------------------*/ - -Abstract.Insertion = function(adjacency) { - this.adjacency = adjacency; -} - -Abstract.Insertion.prototype = { - initialize: function(element, content) { - this.element = $(element); - this.content = content.stripScripts(); - - if (this.adjacency && this.element.insertAdjacentHTML) { - try { - this.element.insertAdjacentHTML(this.adjacency, this.content); - } catch (e) { - var tagName = this.element.tagName.toUpperCase(); - if (['TBODY', 'TR'].include(tagName)) { - this.insertContent(this.contentFromAnonymousTable()); - } else { - throw e; - } - } - } else { - this.range = this.element.ownerDocument.createRange(); - if (this.initializeRange) this.initializeRange(); - this.insertContent([this.range.createContextualFragment(this.content)]); - } - - setTimeout(function() {content.evalScripts()}, 10); - }, - - contentFromAnonymousTable: function() { - var div = document.createElement('div'); - div.innerHTML = '' + this.content + '
      '; - return $A(div.childNodes[0].childNodes[0].childNodes); - } -} - -var Insertion = new Object(); - -Insertion.Before = Class.create(); -Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { - initializeRange: function() { - this.range.setStartBefore(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.parentNode.insertBefore(fragment, this.element); - }).bind(this)); - } -}); - -Insertion.Top = Class.create(); -Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(true); - }, - - insertContent: function(fragments) { - fragments.reverse(false).each((function(fragment) { - this.element.insertBefore(fragment, this.element.firstChild); - }).bind(this)); - } -}); - -Insertion.Bottom = Class.create(); -Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { - initializeRange: function() { - this.range.selectNodeContents(this.element); - this.range.collapse(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.appendChild(fragment); - }).bind(this)); - } -}); - -Insertion.After = Class.create(); -Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { - initializeRange: function() { - this.range.setStartAfter(this.element); - }, - - insertContent: function(fragments) { - fragments.each((function(fragment) { - this.element.parentNode.insertBefore(fragment, - this.element.nextSibling); - }).bind(this)); - } -}); - -/*--------------------------------------------------------------------------*/ - -Element.ClassNames = Class.create(); -Element.ClassNames.prototype = { - initialize: function(element) { - this.element = $(element); - }, - - _each: function(iterator) { - this.element.className.split(/\s+/).select(function(name) { - return name.length > 0; - })._each(iterator); - }, - - set: function(className) { - this.element.className = className; - }, - - add: function(classNameToAdd) { - if (this.include(classNameToAdd)) return; - this.set($A(this).concat(classNameToAdd).join(' ')); - }, - - remove: function(classNameToRemove) { - if (!this.include(classNameToRemove)) return; - this.set($A(this).without(classNameToRemove).join(' ')); - }, - - toString: function() { - return $A(this).join(' '); - } -}; - -Object.extend(Element.ClassNames.prototype, Enumerable); -var Selector = Class.create(); -Selector.prototype = { - initialize: function(expression) { - this.params = {classNames: []}; - this.expression = expression.toString().strip(); - this.parseExpression(); - this.compileMatcher(); - }, - - parseExpression: function() { - function abort(message) { throw 'Parse error in selector: ' + message; } - - if (this.expression == '') abort('empty expression'); - - var params = this.params, expr = this.expression, match, modifier, clause, rest; - while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { - params.attributes = params.attributes || []; - params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); - expr = match[1]; - } - - if (expr == '*') return this.params.wildcard = true; - - while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { - modifier = match[1], clause = match[2], rest = match[3]; - switch (modifier) { - case '#': params.id = clause; break; - case '.': params.classNames.push(clause); break; - case '': - case undefined: params.tagName = clause.toUpperCase(); break; - default: abort(expr.inspect()); - } - expr = rest; - } - - if (expr.length > 0) abort(expr.inspect()); - }, - - buildMatchExpression: function() { - var params = this.params, conditions = [], clause; - - if (params.wildcard) - conditions.push('true'); - if (clause = params.id) - conditions.push('element.readAttribute("id") == ' + clause.inspect()); - if (clause = params.tagName) - conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); - if ((clause = params.classNames).length > 0) - for (var i = 0, length = clause.length; i < length; i++) - conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); - if (clause = params.attributes) { - clause.each(function(attribute) { - var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; - var splitValueBy = function(delimiter) { - return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; - } - - switch (attribute.operator) { - case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; - case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; - case '|=': conditions.push( - splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() - ); break; - case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; - case '': - case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; - default: throw 'Unknown operator ' + attribute.operator + ' in selector'; - } - }); - } - - return conditions.join(' && '); - }, - - compileMatcher: function() { - this.match = new Function('element', 'if (!element.tagName) return false; \ - element = $(element); \ - return ' + this.buildMatchExpression()); - }, - - findElements: function(scope) { - var element; - - if (element = $(this.params.id)) - if (this.match(element)) - if (!scope || Element.childOf(element, scope)) - return [element]; - - scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); - - var results = []; - for (var i = 0, length = scope.length; i < length; i++) - if (this.match(element = scope[i])) - results.push(Element.extend(element)); - - return results; - }, - - toString: function() { - return this.expression; - } -} - -Object.extend(Selector, { - matchElements: function(elements, expression) { - var selector = new Selector(expression); - return elements.select(selector.match.bind(selector)).map(Element.extend); - }, - - findElement: function(elements, expression, index) { - if (typeof expression == 'number') index = expression, expression = false; - return Selector.matchElements(elements, expression || '*')[index || 0]; - }, - - findChildElements: function(element, expressions) { - return expressions.map(function(expression) { - return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { - var selector = new Selector(expr); - return results.inject([], function(elements, result) { - return elements.concat(selector.findElements(result || element)); - }); - }); - }).flatten(); - } -}); - -function $$() { - return Selector.findChildElements(document, $A(arguments)); -} -var Form = { - reset: function(form) { - $(form).reset(); - return form; - }, - - serializeElements: function(elements, getHash) { - var data = elements.inject({}, function(result, element) { - if (!element.disabled && element.name) { - var key = element.name, value = $(element).getValue(); - if (value != undefined) { - if (result[key]) { - if (result[key].constructor != Array) result[key] = [result[key]]; - result[key].push(value); - } - else result[key] = value; - } - } - return result; - }); - - return getHash ? data : Hash.toQueryString(data); - } -}; - -Form.Methods = { - serialize: function(form, getHash) { - return Form.serializeElements(Form.getElements(form), getHash); - }, - - getElements: function(form) { - return $A($(form).getElementsByTagName('*')).inject([], - function(elements, child) { - if (Form.Element.Serializers[child.tagName.toLowerCase()]) - elements.push(Element.extend(child)); - return elements; - } - ); - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) return $A(inputs).map(Element.extend); - - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || (name && input.name != name)) - continue; - matchingInputs.push(Element.extend(input)); - } - - return matchingInputs; - }, - - disable: function(form) { - form = $(form); - form.getElements().each(function(element) { - element.blur(); - element.disabled = 'true'; - }); - return form; - }, - - enable: function(form) { - form = $(form); - form.getElements().each(function(element) { - element.disabled = ''; - }); - return form; - }, - - findFirstElement: function(form) { - return $(form).getElements().find(function(element) { - return element.type != 'hidden' && !element.disabled && - ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); - }); - }, - - focusFirstElement: function(form) { - form = $(form); - form.findFirstElement().activate(); - return form; - } -} - -Object.extend(Form, Form.Methods); - -/*--------------------------------------------------------------------------*/ - -Form.Element = { - focus: function(element) { - $(element).focus(); - return element; - }, - - select: function(element) { - $(element).select(); - return element; - } -} - -Form.Element.Methods = { - serialize: function(element) { - element = $(element); - if (!element.disabled && element.name) { - var value = element.getValue(); - if (value != undefined) { - var pair = {}; - pair[element.name] = value; - return Hash.toQueryString(pair); - } - } - return ''; - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - return Form.Element.Serializers[method](element); - }, - - clear: function(element) { - $(element).value = ''; - return element; - }, - - present: function(element) { - return $(element).value != ''; - }, - - activate: function(element) { - element = $(element); - element.focus(); - if (element.select && ( element.tagName.toLowerCase() != 'input' || - !['button', 'reset', 'submit'].include(element.type) ) ) - element.select(); - return element; - }, - - disable: function(element) { - element = $(element); - element.disabled = true; - return element; - }, - - enable: function(element) { - element = $(element); - element.blur(); - element.disabled = false; - return element; - } -} - -Object.extend(Form.Element, Form.Element.Methods); -var Field = Form.Element; -var $F = Form.Element.getValue; - -/*--------------------------------------------------------------------------*/ - -Form.Element.Serializers = { - input: function(element) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element); - default: - return Form.Element.Serializers.textarea(element); - } - }, - - inputSelector: function(element) { - return element.checked ? element.value : null; - }, - - textarea: function(element) { - return element.value; - }, - - select: function(element) { - return this[element.type == 'select-one' ? - 'selectOne' : 'selectMany'](element); - }, - - selectOne: function(element) { - var index = element.selectedIndex; - return index >= 0 ? this.optionValue(element.options[index]) : null; - }, - - selectMany: function(element) { - var values, length = element.length; - if (!length) return null; - - for (var i = 0, values = []; i < length; i++) { - var opt = element.options[i]; - if (opt.selected) values.push(this.optionValue(opt)); - } - return values; - }, - - optionValue: function(opt) { - // extend element because hasAttribute may not be native - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; - } -} - -/*--------------------------------------------------------------------------*/ - -Abstract.TimedObserver = function() {} -Abstract.TimedObserver.prototype = { - initialize: function(element, frequency, callback) { - this.frequency = frequency; - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - this.registerCallback(); - }, - - registerCallback: function() { - setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - onTimerEvent: function() { - var value = this.getValue(); - var changed = ('string' == typeof this.lastValue && 'string' == typeof value - ? this.lastValue != value : String(this.lastValue) != String(value)); - if (changed) { - this.callback(this.element, value); - this.lastValue = value; - } - } -} - -Form.Element.Observer = Class.create(); -Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(); -Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = function() {} -Abstract.EventObserver.prototype = { - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback.bind(this)); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - default: - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -} - -Form.Element.EventObserver = Class.create(); -Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(); -Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { - getValue: function() { - return Form.serialize(this.element); - } -}); -if (!window.Event) { - var Event = new Object(); -} - -Object.extend(Event, { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - KEY_HOME: 36, - KEY_END: 35, - KEY_PAGEUP: 33, - KEY_PAGEDOWN: 34, - - element: function(event) { - return event.target || event.srcElement; - }, - - isLeftClick: function(event) { - return (((event.which) && (event.which == 1)) || - ((event.button) && (event.button == 1))); - }, - - pointerX: function(event) { - return event.pageX || (event.clientX + - (document.documentElement.scrollLeft || document.body.scrollLeft)); - }, - - pointerY: function(event) { - return event.pageY || (event.clientY + - (document.documentElement.scrollTop || document.body.scrollTop)); - }, - - stop: function(event) { - if (event.preventDefault) { - event.preventDefault(); - event.stopPropagation(); - } else { - event.returnValue = false; - event.cancelBubble = true; - } - }, - - // find the first node with the given tagName, starting from the - // node the event was triggered on; traverses the DOM upwards - findElement: function(event, tagName) { - var element = Event.element(event); - while (element.parentNode && (!element.tagName || - (element.tagName.toUpperCase() != tagName.toUpperCase()))) - element = element.parentNode; - return element; - }, - - observers: false, - - _observeAndCache: function(element, name, observer, useCapture) { - if (!this.observers) this.observers = []; - if (element.addEventListener) { - this.observers.push([element, name, observer, useCapture]); - element.addEventListener(name, observer, useCapture); - } else if (element.attachEvent) { - this.observers.push([element, name, observer, useCapture]); - element.attachEvent('on' + name, observer); - } - }, - - unloadCache: function() { - if (!Event.observers) return; - for (var i = 0, length = Event.observers.length; i < length; i++) { - Event.stopObserving.apply(this, Event.observers[i]); - Event.observers[i][0] = null; - } - Event.observers = false; - }, - - observe: function(element, name, observer, useCapture) { - element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.attachEvent)) - name = 'keydown'; - - Event._observeAndCache(element, name, observer, useCapture); - }, - - stopObserving: function(element, name, observer, useCapture) { - element = $(element); - useCapture = useCapture || false; - - if (name == 'keypress' && - (navigator.appVersion.match(/Konqueror|Safari|KHTML/) - || element.detachEvent)) - name = 'keydown'; - - if (element.removeEventListener) { - element.removeEventListener(name, observer, useCapture); - } else if (element.detachEvent) { - try { - element.detachEvent('on' + name, observer); - } catch (e) {} - } - } -}); - -/* prevent memory leaks in IE */ -if (navigator.appVersion.match(/\bMSIE\b/)) - Event.observe(window, 'unload', Event.unloadCache, false); -var Position = { - // set to true if needed, warning: firefox performance problems - // NOT neeeded for page scrolling, only if draggable contained in - // scrollable elements - includeScrollOffsets: false, - - // must be called before calling withinIncludingScrolloffset, every time the - // page is scrolled - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - realOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return [valueL, valueT]; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return [valueL, valueT]; - }, - - positionedOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if(element.tagName=='BODY') break; - var p = Element.getStyle(element, 'position'); - if (p == 'relative' || p == 'absolute') break; - } - } while (element); - return [valueL, valueT]; - }, - - offsetParent: function(element) { - if (element.offsetParent) return element.offsetParent; - if (element == document.body) return element; - - while ((element = element.parentNode) && element != document.body) - if (Element.getStyle(element, 'position') != 'static') - return element; - - return document.body; - }, - - // caches x/y coordinate pair to use with overlap - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = this.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = this.realOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = this.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - // within must be called directly before - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - page: function(forElement) { - var valueT = 0, valueL = 0; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - // Safari fix - if (element.offsetParent==document.body) - if (Element.getStyle(element,'position')=='absolute') break; - - } while (element = element.offsetParent); - - element = forElement; - do { - if (!window.opera || element.tagName=='BODY') { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - - return [valueL, valueT]; - }, - - clone: function(source, target) { - var options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, arguments[2] || {}) - - // find page position of source - source = $(source); - var p = Position.page(source); - - // find coordinate system to use - target = $(target); - var delta = [0, 0]; - var parent = null; - // delta [0,0] will do fine with position: fixed elements, - // position:absolute needs offsetParent deltas - if (Element.getStyle(target,'position') == 'absolute') { - parent = Position.offsetParent(target); - delta = Position.page(parent); - } - - // correct by body offsets (fixes Safari) - if (parent == document.body) { - delta[0] -= document.body.offsetLeft; - delta[1] -= document.body.offsetTop; - } - - // set position - if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if(options.setWidth) target.style.width = source.offsetWidth + 'px'; - if(options.setHeight) target.style.height = source.offsetHeight + 'px'; - }, - - absolutize: function(element) { - element = $(element); - if (element.style.position == 'absolute') return; - Position.prepare(); - - var offsets = Position.positionedOffset(element); - var top = offsets[1]; - var left = offsets[0]; - var width = element.clientWidth; - var height = element.clientHeight; - - element._originalLeft = left - parseFloat(element.style.left || 0); - element._originalTop = top - parseFloat(element.style.top || 0); - element._originalWidth = element.style.width; - element._originalHeight = element.style.height; - - element.style.position = 'absolute'; - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.width = width + 'px'; - element.style.height = height + 'px'; - }, - - relativize: function(element) { - element = $(element); - if (element.style.position == 'relative') return; - Position.prepare(); - - element.style.position = 'relative'; - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); - var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.height = element._originalHeight; - element.style.width = element._originalWidth; - } -} - -// Safari returns margins on body which is incorrect if the child is absolutely -// positioned. For performance reasons, redefine Position.cumulativeOffset for -// KHTML/WebKit only. -if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { - Position.cumulativeOffset = function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) - if (Element.getStyle(element, 'position') == 'absolute') break; - - element = element.offsetParent; - } while (element); - - return [valueL, valueT]; - } -} - -Element.addMethods(); \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/public/robots.txt b/vendor/plugins/shoulda/test/rails_root/public/robots.txt deleted file mode 100644 index 4ab9e89..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/robots.txt +++ /dev/null @@ -1 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/public/stylesheets/scaffold.css b/vendor/plugins/shoulda/test/rails_root/public/stylesheets/scaffold.css deleted file mode 100644 index 8f239a3..0000000 --- a/vendor/plugins/shoulda/test/rails_root/public/stylesheets/scaffold.css +++ /dev/null @@ -1,74 +0,0 @@ -body { background-color: #fff; color: #333; } - -body, p, ol, ul, td { - font-family: verdana, arial, helvetica, sans-serif; - font-size: 13px; - line-height: 18px; -} - -pre { - background-color: #eee; - padding: 10px; - font-size: 11px; -} - -a { color: #000; } -a:visited { color: #666; } -a:hover { color: #fff; background-color:#000; } - -.fieldWithErrors { - padding: 2px; - background-color: red; - display: table; -} - -#errorExplanation { - width: 400px; - border: 2px solid red; - padding: 7px; - padding-bottom: 12px; - margin-bottom: 20px; - background-color: #f0f0f0; -} - -#errorExplanation h2 { - text-align: left; - font-weight: bold; - padding: 5px 5px 5px 15px; - font-size: 12px; - margin: -7px; - background-color: #c00; - color: #fff; -} - -#errorExplanation p { - color: #333; - margin-bottom: 0; - padding: 5px; -} - -#errorExplanation ul li { - font-size: 12px; - list-style: square; -} - -div.uploadStatus { - margin: 5px; -} - -div.progressBar { - margin: 5px; -} - -div.progressBar div.border { - background-color: #fff; - border: 1px solid grey; - width: 100%; -} - -div.progressBar div.background { - background-color: #333; - height: 18px; - width: 0%; -} - diff --git a/vendor/plugins/shoulda/test/rails_root/script/about b/vendor/plugins/shoulda/test/rails_root/script/about deleted file mode 100755 index 7b07d46..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/about +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/about' \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/script/breakpointer b/vendor/plugins/shoulda/test/rails_root/script/breakpointer deleted file mode 100755 index 64af76e..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/breakpointer +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/breakpointer' \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/script/destroy b/vendor/plugins/shoulda/test/rails_root/script/destroy deleted file mode 100755 index fa0e6fc..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/destroy +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/destroy' \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/script/performance/benchmarker b/vendor/plugins/shoulda/test/rails_root/script/performance/benchmarker deleted file mode 100755 index c842d35..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/performance/benchmarker +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/performance/benchmarker' diff --git a/vendor/plugins/shoulda/test/rails_root/script/performance/profiler b/vendor/plugins/shoulda/test/rails_root/script/performance/profiler deleted file mode 100755 index d855ac8..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/performance/profiler +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/performance/profiler' diff --git a/vendor/plugins/shoulda/test/rails_root/script/plugin b/vendor/plugins/shoulda/test/rails_root/script/plugin deleted file mode 100755 index 26ca64c..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/plugin +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/plugin' \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/script/process/inspector b/vendor/plugins/shoulda/test/rails_root/script/process/inspector deleted file mode 100755 index bf25ad8..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/process/inspector +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/process/inspector' diff --git a/vendor/plugins/shoulda/test/rails_root/script/process/reaper b/vendor/plugins/shoulda/test/rails_root/script/process/reaper deleted file mode 100755 index c77f045..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/process/reaper +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/process/reaper' diff --git a/vendor/plugins/shoulda/test/rails_root/script/process/spawner b/vendor/plugins/shoulda/test/rails_root/script/process/spawner deleted file mode 100755 index 7118f39..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/process/spawner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../config/boot' -require 'commands/process/spawner' diff --git a/vendor/plugins/shoulda/test/rails_root/script/runner b/vendor/plugins/shoulda/test/rails_root/script/runner deleted file mode 100755 index ccc30f9..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/runner +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/runner' \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/rails_root/script/server b/vendor/plugins/shoulda/test/rails_root/script/server deleted file mode 100755 index dfabcb8..0000000 --- a/vendor/plugins/shoulda/test/rails_root/script/server +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../config/boot' -require 'commands/server' \ No newline at end of file diff --git a/vendor/plugins/shoulda/test/unit/post_test.rb b/vendor/plugins/shoulda/test/unit/post_test.rb deleted file mode 100644 index 9905147..0000000 --- a/vendor/plugins/shoulda/test/unit/post_test.rb +++ /dev/null @@ -1,14 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class PostTest < Test::Unit::TestCase - load_all_fixtures - - should_belong_to :user - should_belong_to :owner - should_have_many :tags, :through => :taggings - - should_require_unique_attributes :title - should_require_attributes :body, :message => /wtf/ - should_require_attributes :title - should_only_allow_numeric_values_for :user_id -end diff --git a/vendor/plugins/shoulda/test/unit/tag_test.rb b/vendor/plugins/shoulda/test/unit/tag_test.rb deleted file mode 100644 index 4b0f8a2..0000000 --- a/vendor/plugins/shoulda/test/unit/tag_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class TagTest < Test::Unit::TestCase - load_all_fixtures - - should_have_many :taggings - should_have_many :posts -end diff --git a/vendor/plugins/shoulda/test/unit/user_test.rb b/vendor/plugins/shoulda/test/unit/user_test.rb deleted file mode 100644 index 2f0bc4b..0000000 --- a/vendor/plugins/shoulda/test/unit/user_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class UserTest < Test::Unit::TestCase - load_all_fixtures - - should_have_many :posts - should_have_many :dogs - - should_not_allow_values_for :email, "blah", "b lah" - should_allow_values_for :email, "a@b.com", "asdf@asdf.com" - should_ensure_length_in_range :email, 1..100 - should_ensure_value_in_range :age, 1..100 - should_protect_attributes :password - should_have_class_methods :find, :destroy - should_have_instance_methods :email, :age, :email=, :valid? - should_have_db_columns :name, :email, :age - should_have_db_column :id, :type => "integer", :primary => true - should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255, - :null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)' -end diff --git a/vendor/plugins/tzinfo_timezone/README b/vendor/plugins/tzinfo_timezone/README deleted file mode 100644 index 8074758..0000000 --- a/vendor/plugins/tzinfo_timezone/README +++ /dev/null @@ -1,20 +0,0 @@ -TZInfo Timezone -=============== - -This plugin installs a replacement for the TimeZone class. The replacement -uses the TZInfo library (http://tzinfo.rubyforge.org) to do the time zone -conversions, and thus takes into account daylight saving, for free. - -It is not a 100%-compatible replacement, however. If you use TimeZone#unadjust -anywhere, you'll need to replace those calls, possibly with #local_to_utc. -Also, the #adjust method is deprecated--it is better (and easier to read) if -you use the #utc_to_local method instead. - -Note that you will need to have the tzinfo library installed separately--it is -not bundled with this plugin. You can easily install tzinfo as a gem: - - gem install tzinfo - ---------------- -Copyright (c) 2006 Jamis Buck (jamis@37signals.com) -released under the MIT license \ No newline at end of file diff --git a/vendor/plugins/tzinfo_timezone/Rakefile b/vendor/plugins/tzinfo_timezone/Rakefile deleted file mode 100644 index d770b33..0000000 --- a/vendor/plugins/tzinfo_timezone/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the tzinfo_timezone plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the tzinfo_timezone plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'TzinfoTimezone' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/vendor/plugins/tzinfo_timezone/init.rb b/vendor/plugins/tzinfo_timezone/init.rb deleted file mode 100644 index d559b69..0000000 --- a/vendor/plugins/tzinfo_timezone/init.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'tzinfo_timezone' - -# remove the existing TimeZone constant -Object.send(:remove_const, :TimeZone) - -# Use TzinfoTimezone as the TimeZone class -Object::TimeZone = TzinfoTimezone \ No newline at end of file diff --git a/vendor/plugins/tzinfo_timezone/lib/tzinfo_timezone.rb b/vendor/plugins/tzinfo_timezone/lib/tzinfo_timezone.rb deleted file mode 100644 index 43951b5..0000000 --- a/vendor/plugins/tzinfo_timezone/lib/tzinfo_timezone.rb +++ /dev/null @@ -1,330 +0,0 @@ -require 'tzinfo' - -class TzinfoTimezone - MAPPING = { - "International Date Line West" => "Pacific/Midway", - "Midway Island" => "Pacific/Midway", - "Samoa" => "Pacific/Pago_Pago", - "Hawaii" => "Pacific/Honolulu", - "Alaska" => "America/Juneau", - "Pacific Time (US & Canada)" => "America/Los_Angeles", - "Tijuana" => "America/Tijuana", - "Mountain Time (US & Canada)" => "America/Denver", - "Arizona" => "America/Phoenix", - "Chihuahua" => "America/Chihuahua", - "Mazatlan" => "America/Mazatlan", - "Central Time (US & Canada)" => "America/Chicago", - "Saskatchewan" => "America/Regina", - "Guadalajara" => "America/Mexico_City", - "Mexico City" => "America/Mexico_City", - "Monterrey" => "America/Monterrey", - "Central America" => "America/Guatemala", - "Eastern Time (US & Canada)" => "America/New_York", - "Indiana (East)" => "America/Indiana/Indianapolis", - "Bogota" => "America/Bogota", - "Lima" => "America/Lima", - "Quito" => "America/Lima", - "Atlantic Time (Canada)" => "America/Halifax", - "Caracas" => "America/Caracas", - "La Paz" => "America/La_Paz", - "Santiago" => "America/Santiago", - "Newfoundland" => "America/St_Johns", - "Brasilia" => "America/Argentina/Buenos_Aires", - "Buenos Aires" => "America/Argentina/Buenos_Aires", - "Georgetown" => "America/Argentina/San_Juan", - "Greenland" => "America/Godthab", - "Mid-Atlantic" => "Atlantic/South_Georgia", - "Azores" => "Atlantic/Azores", - "Cape Verde Is." => "Atlantic/Cape_Verde", - "Dublin" => "Europe/Dublin", - "Edinburgh" => "Europe/Dublin", - "Lisbon" => "Europe/Lisbon", - "London" => "Europe/London", - "Casablanca" => "Africa/Casablanca", - "Monrovia" => "Africa/Monrovia", - "Belgrade" => "Europe/Belgrade", - "Bratislava" => "Europe/Bratislava", - "Budapest" => "Europe/Budapest", - "Ljubljana" => "Europe/Ljubljana", - "Prague" => "Europe/Prague", - "Sarajevo" => "Europe/Sarajevo", - "Skopje" => "Europe/Skopje", - "Warsaw" => "Europe/Warsaw", - "Zagreb" => "Europe/Zagreb", - "Brussels" => "Europe/Brussels", - "Copenhagen" => "Europe/Copenhagen", - "Madrid" => "Europe/Madrid", - "Paris" => "Europe/Paris", - "Amsterdam" => "Europe/Amsterdam", - "Berlin" => "Europe/Berlin", - "Bern" => "Europe/Berlin", - "Rome" => "Europe/Rome", - "Stockholm" => "Europe/Stockholm", - "Vienna" => "Europe/Vienna", - "West Central Africa" => "Africa/Algiers", - "Bucharest" => "Europe/Bucharest", - "Cairo" => "Africa/Cairo", - "Helsinki" => "Europe/Helsinki", - "Kyev" => "Europe/Kiev", - "Riga" => "Europe/Riga", - "Sofia" => "Europe/Sofia", - "Tallinn" => "Europe/Tallinn", - "Vilnius" => "Europe/Vilnius", - "Athens" => "Europe/Athens", - "Istanbul" => "Europe/Istanbul", - "Minsk" => "Europe/Minsk", - "Jerusalem" => "Asia/Jerusalem", - "Harare" => "Africa/Harare", - "Pretoria" => "Africa/Johannesburg", - "Moscow" => "Europe/Moscow", - "St. Petersburg" => "Europe/Moscow", - "Volgograd" => "Europe/Moscow", - "Kuwait" => "Asia/Kuwait", - "Riyadh" => "Asia/Riyadh", - "Nairobi" => "Africa/Nairobi", - "Baghdad" => "Asia/Baghdad", - "Tehran" => "Asia/Tehran", - "Abu Dhabi" => "Asia/Muscat", - "Muscat" => "Asia/Muscat", - "Baku" => "Asia/Baku", - "Tbilisi" => "Asia/Tbilisi", - "Yerevan" => "Asia/Yerevan", - "Kabul" => "Asia/Kabul", - "Ekaterinburg" => "Asia/Yekaterinburg", - "Islamabad" => "Asia/Karachi", - "Karachi" => "Asia/Karachi", - "Tashkent" => "Asia/Tashkent", - "Chennai" => "Asia/Calcutta", - "Kolkata" => "Asia/Calcutta", - "Mumbai" => "Asia/Calcutta", - "New Delhi" => "Asia/Calcutta", - "Kathmandu" => "Asia/Katmandu", - "Astana" => "Asia/Dhaka", - "Dhaka" => "Asia/Dhaka", - "Sri Jayawardenepura" => "Asia/Dhaka", - "Almaty" => "Asia/Almaty", - "Novosibirsk" => "Asia/Novosibirsk", - "Rangoon" => "Asia/Rangoon", - "Bangkok" => "Asia/Bangkok", - "Hanoi" => "Asia/Bangkok", - "Jakarta" => "Asia/Jakarta", - "Krasnoyarsk" => "Asia/Krasnoyarsk", - "Beijing" => "Asia/Shanghai", - "Chongqing" => "Asia/Chongqing", - "Hong Kong" => "Asia/Hong_Kong", - "Urumqi" => "Asia/Urumqi", - "Kuala Lumpur" => "Asia/Kuala_Lumpur", - "Singapore" => "Asia/Singapore", - "Taipei" => "Asia/Taipei", - "Perth" => "Australia/Perth", - "Irkutsk" => "Asia/Irkutsk", - "Ulaan Bataar" => "Asia/Ulaanbaatar", - "Seoul" => "Asia/Seoul", - "Osaka" => "Asia/Tokyo", - "Sapporo" => "Asia/Tokyo", - "Tokyo" => "Asia/Tokyo", - "Yakutsk" => "Asia/Yakutsk", - "Darwin" => "Australia/Darwin", - "Adelaide" => "Australia/Adelaide", - "Canberra" => "Australia/Melbourne", - "Melbourne" => "Australia/Melbourne", - "Sydney" => "Australia/Sydney", - "Brisbane" => "Australia/Brisbane", - "Hobart" => "Australia/Hobart", - "Vladivostok" => "Asia/Vladivostok", - "Guam" => "Pacific/Guam", - "Port Moresby" => "Pacific/Port_Moresby", - "Magadan" => "Asia/Magadan", - "Solomon Is." => "Asia/Magadan", - "New Caledonia" => "Pacific/Noumea", - "Fiji" => "Pacific/Fiji", - "Kamchatka" => "Asia/Kamchatka", - "Marshall Is." => "Pacific/Majuro", - "Auckland" => "Pacific/Auckland", - "Wellington" => "Pacific/Auckland", - "Nuku'alofa" => "Pacific/Tongatapu" - } - - attr_reader :name, :utc_offset - - # Create a new TzinfoTimezone object with the given name and offset. The - # offset is the number of seconds that this time zone is offset from UTC - # (GMT). Seconds were chosen as the offset unit because that is the unit that - # Ruby uses to represent time zone offsets (see Time#utc_offset). - def initialize(name, utc_offset) - @name = name - @utc_offset = utc_offset - end - - # Returns the offset of this time zone as a formatted string, of the - # format "+HH:MM". If the offset is zero, this returns the empty - # string. If +colon+ is false, a colon will not be inserted into the - # result. - def formatted_offset(colon=true) - utc_offset == 0 ? '' : offset(colon) - end - - # Returns the offset of this time zone as a formatted string, of the - # format "+HH:MM". - def offset(colon=true) - sign = (utc_offset < 0 ? -1 : 1) - hours = utc_offset.abs / 3600 - minutes = (utc_offset.abs % 3600) / 60 - "%+03d%s%02d" % [ hours * sign, colon ? ":" : "", minutes ] - end - - # Compute and return the current time, in the time zone represented by - # +self+. - def now - tzinfo.now - end - - # Return the current date in this time zone. - def today - now.to_date - end - - # Adjust the given time to the time zone represented by +self+. - def utc_to_local(time) - tzinfo.utc_to_local(time) - end - - def local_to_utc(time, dst=true) - tzinfo.local_to_utc(time, dst) - end - - # Adjust the given time to the time zone represented by +self+. - # (Deprecated--use utc_to_local, instead.) - alias :adjust :utc_to_local - - # Compare this time zone to the parameter. The two are comapred first on - # their offsets, and then by name. - def <=>(zone) - result = (utc_offset <=> zone.utc_offset) - result = (name <=> zone.name) if result == 0 - result - end - - # Returns a textual representation of this time zone. - def to_s - "(GMT#{formatted_offset}) #{name}" - end - - def tzinfo - return @tzinfo if @tzinfo - @tzinfo = MAPPING[name] - if String === @tzinfo - @tzinfo = TZInfo::Timezone.get(@tzinfo) - MAPPING[name] = @tzinfo - end - @tzinfo - end - - @@zones = nil - - class << self - alias_method :create, :new - - # Return a TzinfoTimezone instance with the given name, or +nil+ if no - # such TzinfoTimezone instance exists. (This exists to support the use of - # this class with the #composed_of macro.) - def new(name) - self[name] - end - - # Return an array of all TzinfoTimezone objects. There are multiple - # TzinfoTimezone objects per time zone, in many cases, to make it easier - # for users to find their own time zone. - def all - unless @@zones - @@zones = [] - @@zones_map = {} - [[-39_600, "International Date Line West", "Midway Island", "Samoa" ], - [-36_000, "Hawaii" ], - [-32_400, "Alaska" ], - [-28_800, "Pacific Time (US & Canada)", "Tijuana" ], - [-25_200, "Mountain Time (US & Canada)", "Chihuahua", "Mazatlan", - "Arizona" ], - [-21_600, "Central Time (US & Canada)", "Saskatchewan", "Guadalajara", - "Mexico City", "Monterrey", "Central America" ], - [-18_000, "Eastern Time (US & Canada)", "Indiana (East)", "Bogota", - "Lima", "Quito" ], - [-14_400, "Atlantic Time (Canada)", "Caracas", "La Paz", "Santiago" ], - [-12_600, "Newfoundland" ], - [-10_800, "Brasilia", "Buenos Aires", "Georgetown", "Greenland" ], - [ -7_200, "Mid-Atlantic" ], - [ -3_600, "Azores", "Cape Verde Is." ], - [ 0, "Dublin", "Edinburgh", "Lisbon", "London", "Casablanca", - "Monrovia" ], - [ 3_600, "Belgrade", "Bratislava", "Budapest", "Ljubljana", "Prague", - "Sarajevo", "Skopje", "Warsaw", "Zagreb", "Brussels", - "Copenhagen", "Madrid", "Paris", "Amsterdam", "Berlin", - "Bern", "Rome", "Stockholm", "Vienna", - "West Central Africa" ], - [ 7_200, "Bucharest", "Cairo", "Helsinki", "Kyev", "Riga", "Sofia", - "Tallinn", "Vilnius", "Athens", "Istanbul", "Minsk", - "Jerusalem", "Harare", "Pretoria" ], - [ 10_800, "Moscow", "St. Petersburg", "Volgograd", "Kuwait", "Riyadh", - "Nairobi", "Baghdad" ], - [ 12_600, "Tehran" ], - [ 14_400, "Abu Dhabi", "Muscat", "Baku", "Tbilisi", "Yerevan" ], - [ 16_200, "Kabul" ], - [ 18_000, "Ekaterinburg", "Islamabad", "Karachi", "Tashkent" ], - [ 19_800, "Chennai", "Kolkata", "Mumbai", "New Delhi" ], - [ 20_700, "Kathmandu" ], - [ 21_600, "Astana", "Dhaka", "Sri Jayawardenepura", "Almaty", - "Novosibirsk" ], - [ 23_400, "Rangoon" ], - [ 25_200, "Bangkok", "Hanoi", "Jakarta", "Krasnoyarsk" ], - [ 28_800, "Beijing", "Chongqing", "Hong Kong", "Urumqi", - "Kuala Lumpur", "Singapore", "Taipei", "Perth", "Irkutsk", - "Ulaan Bataar" ], - [ 32_400, "Seoul", "Osaka", "Sapporo", "Tokyo", "Yakutsk" ], - [ 34_200, "Darwin", "Adelaide" ], - [ 36_000, "Canberra", "Melbourne", "Sydney", "Brisbane", "Hobart", - "Vladivostok", "Guam", "Port Moresby" ], - [ 39_600, "Magadan", "Solomon Is.", "New Caledonia" ], - [ 43_200, "Fiji", "Kamchatka", "Marshall Is.", "Auckland", - "Wellington" ], - [ 46_800, "Nuku'alofa" ]]. - each do |offset, *places| - places.each do |place| - zone = create(place, offset) - @@zones << zone - @@zones_map[place] = zone - end - end - @@zones.sort! - end - @@zones - end - - # Locate a specific time zone object. If the argument is a string, it - # is interpreted to mean the name of the timezone to locate. If it is a - # numeric value it is either the hour offset, or the second offset, of the - # timezone to find. (The first one with that offset will be returned.) - # Returns +nil+ if no such time zone is known to the system. - def [](arg) - case arg - when String - all # force the zones to be loaded - @@zones_map[arg] - when Numeric - arg *= 3600 if arg.abs <= 13 - all.find { |z| z.utc_offset == arg.to_i } - else - raise ArgumentError, "invalid argument to TzinfoTimezone[]: #{arg.inspect}" - end - end - - # A regular expression that matches the names of all time zones in - # the USA. - US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/ - - # A convenience method for returning a collection of TzinfoTimezone objects - # for time zones in the USA. - def us_zones - all.find_all { |z| z.name =~ US_ZONES } - end - end -end diff --git a/vendor/plugins/tzinfo_timezone/test/tzinfo_timezone_test.rb b/vendor/plugins/tzinfo_timezone/test/tzinfo_timezone_test.rb deleted file mode 100644 index 90fd65d..0000000 --- a/vendor/plugins/tzinfo_timezone/test/tzinfo_timezone_test.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'test/unit' -require 'tzinfo_timezone' - -class TzinfoTimezoneTest < Test::Unit::TestCase - TzinfoTimezone::MAPPING.keys.each do |name| - define_method("test_map_#{name.downcase.gsub(/[^a-z]/, '_')}_to_tzinfo") do - zone = TzinfoTimezone[name] - assert_not_nil zone.tzinfo - end - end - - TzinfoTimezone.all.each do |zone| - name = zone.name.downcase.gsub(/[^a-z]/, '_') - define_method("test_from_#{name}_to_map") do - assert_not_nil TzinfoTimezone[zone.name] - end - - define_method("test_utc_offset_for_#{name}") do - period = zone.tzinfo.period_for_utc(Time.utc(2006,1,1,0,0,0)) - assert_equal period.utc_offset, zone.utc_offset - end - end -end diff --git a/vendor/plugins/tztime/README b/vendor/plugins/tztime/README deleted file mode 100644 index 007ebc2..0000000 --- a/vendor/plugins/tztime/README +++ /dev/null @@ -1,52 +0,0 @@ -TzTime -====== - -[Boring Introduction] - -TzTime is a wrapper for the Time class. It associates a time instance with a time zone, and keeps the two together. It quacks very much like a Time instance, and even provides the same extension methods that Rails adds to time objects. - -By combining the time and the time zone in a single time-like class, you can simplify much of the time-zone gymnastics that you were previously forced to do. - -[Exciting Introduction] - -TzTime is subversive. It even _sounds_ subversive, like sharp incisors snicking together in the dark. It sneaks into your app from the inside and stuffs time zone support into the cracks. It's like a little ruby-colored rat, poking around in the under-basement of your code, but instead of chewing away at the infrastructure with its sharp little teeth (and believe me, they _are_ sharp), it builds fluffy (and oh, so comfortable!) little time-zone flavored nests wherever it can. - -This look familiar? - - class TasksController < ApplicationController - def create - task = account.tasks.build(params[:task]) - task.alert_at = current_user.time_zone.local_to_utc(task.alert_at) - task.save! - end - end - -Oh, that awful bloating sensation! Because the time zone is not globally accessible, you have to jump through hoop and ungainly hoop in your controllers...or pass the unfortunate time zone to method after method. - -No more! Let the Rodent of Unusually Fine TZ Acumen aid you: - - class ApplicationController < ActionController:Base - around_filter :set_timezone - - private - - def set_timezone - TzTime.zone = current_user.time_zone - yield - TzTime.reset! - end - end - - class Task < ActiveRecord::Base - tz_time_attributes :alert_at - end - - class TasksController < ApplicationController - def create - task = account.tasks.create(params[:task]) - end - end - -Let the rat cart the time-zone around for you! Refactor those nasty time zone conversions into your model, where they belong. Soar through the heady winds of your application's stratosphere, comfortable in the knowledge that you have helpful little rats scurrying about in the dark. - -Or maybe they're gnomes. diff --git a/vendor/plugins/tztime/init.rb b/vendor/plugins/tztime/init.rb deleted file mode 100644 index 8ba1741..0000000 --- a/vendor/plugins/tztime/init.rb +++ /dev/null @@ -1 +0,0 @@ -ActiveRecord::Base.extend TzTimeHelpers::ActiveRecordMethods \ No newline at end of file diff --git a/vendor/plugins/tztime/lib/tz_time.rb b/vendor/plugins/tztime/lib/tz_time.rb deleted file mode 100644 index e068a5a..0000000 --- a/vendor/plugins/tztime/lib/tz_time.rb +++ /dev/null @@ -1,166 +0,0 @@ -# --------------------------------------------------------------------------- -# Copyright (c) 2007, 37signals -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# --------------------------------------------------------------------------- - -# A wrapper class that quacks like a Time instance, but which remembers its -# local time zone. Most operations work like normal, but some will automatically -# convert the object to utc, like #to_s(:db). -class TzTime - include Comparable - - # Like the Time class, the TzTime class is its own factory. You will almost - # never create a TzTime instance via +new+. Instead, you will use something - # like TzTime.now (etc.) - class <(value) - time.to_time <=> value.to_time - end - - # This TzTime object always represents the local time in the associated - # timezone. Thus, #utc? should always return false, unless the zone is the - # UTC zone. - def utc? - zone.name == "UTC" - end - - # Returns the underlying TZInfo::TimeZonePeriod instance for the wrapped - # time. - def period(dst=true) - t = time - begin - @period ||= zone.tzinfo.period_for_local(t, dst) - rescue TZInfo::PeriodNotFound - t -= 1.hour - retry - end - end - - # Returns true if the current time is adjusted for daylight savings. - def dst? - period.dst? - end - - # Returns a string repersentation of the time. For the specific case where - # +mode+ is :db or :rfc822, this will return the UTC - # representation of the time. All other conversions will use the local time. - def to_s(mode = :normal) - case mode - when :db, :rfc822 then utc.to_s(mode) - else time.to_s(mode) - end - end - - # Return a reasonable representation of this TzTime object for inspection. - def inspect - "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{period.abbreviation}" - end - - # Because of the method_missing proxy, we want to make sure we report this - # object as responding to a method as long as the method is defined directly - # on TzTime, or if the underlying Time instance responds to the method. - def respond_to?(sym) #:nodoc: - super || @time.respond_to?(sym) - end - - # Proxy anything else through to the underlying Time instance. - def method_missing(sym, *args, &block) #:nodoc: - result = @time.send(sym, *args, &block) - result = TzTime.new(result, zone) if result.is_a? Time - result - end -end diff --git a/vendor/plugins/tztime/lib/tz_time_helpers/active_record_methods.rb b/vendor/plugins/tztime/lib/tz_time_helpers/active_record_methods.rb deleted file mode 100644 index 172b933..0000000 --- a/vendor/plugins/tztime/lib/tz_time_helpers/active_record_methods.rb +++ /dev/null @@ -1,35 +0,0 @@ -module TzTimeHelpers - module ActiveRecordMethods - # Adds the given list of attributes to a class inheritable array #tz_time_attributes. - # All the attributes will have their timezones fixed in a before_save callback, and - # will have a getter method created that converts UTC times from the database into a local - # TzTime. The getter method is important because TzTime values are saved to the database - # as UTC. The getter lets you access the local time without changing your application. - def tz_time_attributes(*attributes) - class_inheritable_array :tz_time_attributes, :instance_writer => false - self.tz_time_attributes = attributes - class_eval do - attributes.each do |attribute| - define_method attribute do - time = read_attribute(attribute) - if (time.acts_like?(:time) || time.acts_like?(:date)) && time.utc? - write_attribute(attribute, TzTime.at(Time.at(TzTime.zone.utc_to_local(time)))) - else - time - end - end - end - - protected - def fix_timezone - tz_time_attributes.each do |attribute| - time = read_attribute(attribute) - fixed = (time.acts_like?(:time) || time.acts_like?(:date)) ? TzTime.at(time) : nil - write_attribute(attribute, fixed) - end - end - end - before_validation :fix_timezone - end - end -end \ No newline at end of file diff --git a/vendor/plugins/tztime/test/active_record_methods_test.rb b/vendor/plugins/tztime/test/active_record_methods_test.rb deleted file mode 100644 index dffd629..0000000 --- a/vendor/plugins/tztime/test/active_record_methods_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.join(File.dirname(__FILE__), '../../../../config/environment') -require 'rubygems' -require 'test/unit' - -class MockRecord - attr_writer :due_on - def self.before_validation(*args) nil end - - protected - def read_attribute(attribute) - instance_variable_get("@#{attribute}") - end - - def write_attribute(attribute, value) - instance_variable_set("@#{attribute}", value) - end -end - -MockRecord.extend TzTimeHelpers::ActiveRecordMethods -MockRecord.tz_time_attributes :due_on - -module TzTimeHelpers - class ActiveRecordMethodsTest < Test::Unit::TestCase - def setup - TzTime.zone = TimeZone["Central Time (US & Canada)"] - @record = MockRecord.new - end - - def test_should_access_utc_time_as_local_with_getter_method - @record.due_on = Time.utc(2006, 1, 1) - assert_equal @record.due_on, TzTime.local(2005, 12, 31, 18) - end - - def test_should_fix_timezones - @record.due_on = Time.utc(2006, 1, 1) - @record.send :fix_timezone - assert_equal @record.due_on, TzTime.local(2006, 1, 1) - end - end -end \ No newline at end of file