ROFISH / redcloth

RedCloth is a Ruby library for converting Textile into HTML. This fork is the customizations for use with the Fangamer Forums. It includes BBCode support and ability to disable parsing certain elements.
http://redcloth.org
Other
6 stars 0 forks source link

Not being able to use locally from a path? #1

Open cobalamin opened 13 years ago

cobalamin commented 13 years ago

Hello! I tried to clone this git repo to modify some HTML output a bit, and use the gem from there inside my Rails 3 application. So I did:

gem 'BBRedCloth', :path => 'vendor/redcloth' which won't work:

Could not find gem 'BBRedCloth (>= 0)' in source at vendor/redcloth. Source does not contain any versions of 'BBRedCloth (>= 0)'

Guess because there's no .gemspec here. So what I did was, download the 0.8.4 versioned gem from rubygems.org itself, and well, of course there is a BBRedCloth.gemspec inside the data.tar.gz of the .gem archive.

Copied the contents of the data.tar.gz into the vendor/redcloth, and bundler will do its job. But now, the whole stuff is screwing up.

Showing /home/chipf0rk/RailsProjects/FourRealms/app/views/reports/show.html.erb where line #17 raised: wrong number of arguments (1 for 2) Extracted source (around line #17): 14: <% end %> 15:

16:
17: <%= raw parse_bb(@report.content) %> 18: <%= link_to "< Back to All News", reports_path, :class => "back" %> 19:
20:

The interesting stacktrace stuff is this: vendor/redcloth/lib/case_sensitive_require/./redcloth/textile_doc.rb:174:in 'method_missing' vendor/redcloth/lib/case_sensitive_require/./redcloth/textile_doc.rb:174:in 'to' vendor/redcloth/lib/case_sensitive_require/./redcloth/textile_doc.rb:174:in 'to_html' app/helpers/application_helper.rb:25:in 'parse_bb' app/views/reports/show.html.erb:17:in '_app_views_reports_show_html_erb__542381288__613620788_0'

My function to parse the stuff is: def parse_bb(input) require 'rubygems' gem 'BBRedCloth' require 'RedCloth' RedCloth.new( input, [:bbcode_only] ).to_html end

and to get RedCloth working with BBRedCloth at all, I got this in my Gemfile. gem 'RedCloth', '4.2.4' gem 'BBRedCloth', :path => 'vendor/redcloth'

Hope you can fix this, because I got to modify some parsing behavior in there... ;) Thanks for the nice gem here so far, it seems to be the first good BBCode parser for Ruby/Rails that I have found yet.

Cheers! Simon

ROFISH commented 13 years ago

Huh, apparently Github doesn't email me when I get a message.

One of these days I'm going to remove the BBCode stuff into it's own path. The issue is that it uglifies dual parsing that I really need, (ie. "[b]some linky text[/b]":http://google.com)

cobalamin commented 13 years ago

You could also try fixing your gemspec on the github repo here. Because there's apparently something wrong with it... :/