#251 new
Daniel Martin

can't convert Symbol into String

Reported by Daniel Martin | September 21st, 2012 @ 02:57 PM

Looks like some sort of problem in:

RedCloth (4.2.9) lib/redcloth/formatters/base.rb:35:in `delete'

Adding debug traces to the function:

    def pba(opts)
      opts.delete(:style) if filter_styles
      opts.delete(:class) if filter_classes
      opts.delete(:id) if filter_ids

      atts = ''
Rails.logger.info "="*80
Rails.logger.info  opts
Rails.logger.info "~"*80
      opts[:"text-align"] = opts.delete(:align)

#...

This is what I get:

================================================================================
{:indent_before_start=>nil}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
================================================================================
inline_html()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A self-contained example:

1.9.3p194 :022 > SOURCE =<<TEXTILE
1.9.3p194 :023"> </del><ins class="differ">#[Title]#
1.9.3p194 :024"> </ins>a three-headed monkey
1.9.3p194 :025"> 
1.9.3p194 :026"> <ins class="differ">#[Description]#
1.9.3p194 :027"> </ins>enters a bar
1.9.3p194 :028"> TEXTILE
(irb):22: warning: already initialized constant SOURCE
 => "</del><ins class=\"differ\">#[Title]#\n</ins>a three-headed monkey\n\n<ins class=\"differ\">#[Description]#\n</ins>enters a bar\n" 
1.9.3p194 :029 > RedCloth.new( SOURCE, [:filter_html] ).to_html
TypeError: can't convert Symbol into String
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/RedCloth-4.2.9/lib/redcloth/formatters/base.rb:35:in `delete'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/RedCloth-4.2.9/lib/redcloth/formatters/base.rb:35:in `pba'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/RedCloth-4.2.9/lib/redcloth/formatters/html.rb:6:in `block (2 levels) in <module:HTML>'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/RedCloth-4.2.9/lib/redcloth/formatters/html.rb:244:in `inline_html'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/RedCloth-4.2.9/lib/redcloth/textile_doc.rb:81:in `to'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/RedCloth-4.2.9/lib/redcloth/textile_doc.rb:81:in `to_html'
    from (irb):29
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
    from /Users/etd/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
1.9.3p194 :030 > RedCloth::VERSION
 => 4.2.9

Comments and changes to this ticket

  • alyssa

    alyssa May 25th, 2021 @ 12:58 PM

    This is the first time I have come across this website and here it discusses the details www.cbdcandy.com regarding some kind of programming issue. There is a problem in the code that we can't convert symbols into strings. How can we do that? I am looking for expert opinions from here. Keep up the good work.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

RedCloth is a Ruby library for converting Textile into HTML

Shared Ticket Bins

People watching this ticket

Pages