From jg at jasongarber.com Fri Nov 12 04:57:44 2010 From: jg at jasongarber.com (Jason Garber) Date: Fri, 12 Nov 2010 03:57:44 -0600 Subject: RedCloth, JRuby and national characters In-Reply-To: References: <509710a18d5ae52efd21741542d5c89f@ruby-forum.com> <44b23f593b41e41d820a3c0412f47cfc@ruby-forum.com> Message-ID: <628C10B4-4CD2-4516-927A-6F570C2C914E@jasongarber.com> Great work, Marek! I pulled your work into a branch: jruby-mbc The problem, as you pointed out, is extra whitespace. I'm hoping you or someone else can help me get it figured out so I can release it! It seems to be just when there's HTML in the input. (At least that's all I've found so far.) When it's a standalone HTML tag (just a block tag on a line), it puts two BRs after. When it's an HTML block (start tag, contents, end tag), it puts the BR inside the beginning of the next block. When just one newline ends the document, it puts a BR inside the end of the last block; two newlines before EOF behave fine though. >
html_block
> > This is a paragraph with > a line break > > standalone_html coming up. > >
> > Another p > >
test
> > Another p. Results in: >
html_block
>


> This is a paragraph with
> a line break

>

standalone_html coming up.

>

>
> >

Another p

>
test
>


> Another p.
>

Weird, huh? I'd greatly appreciate anyone who can help this Java dunce (me). Here's the fast way to get it checked out and set up: > git clone git at github.com:jgarber/redcloth.git > cd redcloth > git checkout jruby-mbc > rvm use jruby-1.5.3 at redcloth # assuming you're using rvm and you've done 'rvm install jruby' > bundle > rake compile Thanks! Jason On Oct 18, 2010, at 6:00 AM, Marek Kowalski wrote: > Hi Georg, > I went the same went. Eventually I managed to kind of solve the > problem, I have the proper jar generated which handles UTF characters > properly. What basicly what needs to be done is to use char (16-bit) > datatype in Ragel code instead of byte (8-bit). You can take a look > here at my work: > http://github.com/kowalski/redcloth > Problem is, that when you run rspec now on the new code, there is a > number of tests that fails. The difference is the extra whitespaces > added to the resulting html code. For me it is no harm so I have this > jar working on production for a few months now. > > Cheers, > Marek Kowalski > > 2010/10/18 Georg M. : >> Hi Claus, >> >> I hit the same issue (Linux, Redcloth 4.2.3). >> >> My workaround was to html-escape non-standard characters before passing >> them to redcloth. It works but my solution is a little bit fragile. Did >> you find a proper solution? >> >> Best, Georg >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Redcloth-upwards mailing list >> Redcloth-upwards at rubyforge.org >> http://rubyforge.org/mailman/listinfo/redcloth-upwards >> > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards -------------- next part -------------- An HTML attachment was scrubbed... URL: From kowalski0123 at gmail.com Fri Nov 12 06:25:32 2010 From: kowalski0123 at gmail.com (Marek Kowalski) Date: Fri, 12 Nov 2010 12:25:32 +0100 Subject: RedCloth, JRuby and national characters In-Reply-To: <628C10B4-4CD2-4516-927A-6F570C2C914E@jasongarber.com> References: <509710a18d5ae52efd21741542d5c89f@ruby-forum.com> <44b23f593b41e41d820a3c0412f47cfc@ruby-forum.com> <628C10B4-4CD2-4516-927A-6F570C2C914E@jasongarber.com> Message-ID: Hey, I'm glad I could contribute a little :) I spent a lot of time trying to figure out the reason for extra whitespace and failed. I came to the conclusion that the newline coding for ragel had to be updated so that it matches the 32bit characters. I know nothing about Ragel so I gave up. Nowadays I'm doing python, so I cannot help any further. Still I guess that the whitespace problem should be far easier to spot and fix. Last but not least it could be just ignored, this is what I did, I just deployed the code as it is to the webapp I've been working on. Regards and good luck! Marek Kowalski 2010/11/12 Jason Garber : > Great work, Marek! ?I pulled your work into a branch:?jruby-mbc > The problem, as you pointed out, is extra whitespace. ?I'm hoping you or > someone else can help me get it figured out so I can release it! > It seems to be just when there's HTML in the input. (At least that's all > I've found so far.) ?When it's a standalone HTML tag (just a block tag on a > line), it puts two BRs after. ?When it's an HTML block (start tag, contents, > end tag), it puts the BR inside the beginning of the next block. ?When just > one newline ends the document, it puts a BR inside the end of the last > block; two newlines before EOF behave fine though. > >
html_block
> This is a paragraph with > a line break > standalone_html coming up. >
> Another p >
test
> Another p. > > Results in: > >
html_block
>


> This is a paragraph with
> a line break

>

standalone_html coming up.

>

>
>

Another p

>
test
>


> Another p.
>

> > Weird, huh? ?I'd greatly appreciate anyone who can help this Java dunce > (me). ?Here's the fast way to get it checked out and set up: > > git clone?git at github.com:jgarber/redcloth.git > cd redcloth > git checkout jruby-mbc > rvm use jruby-1.5.3 at redcloth ?# assuming you're using rvm and you've done > 'rvm install jruby' > bundle > rake compile > > Thanks! > Jason > On Oct 18, 2010, at 6:00 AM, Marek Kowalski wrote: > > Hi Georg, > I went the same went. Eventually I managed to kind of solve the > problem, I have the proper jar generated which handles UTF characters > properly. What basicly what needs to be done is to use char (16-bit) > datatype in Ragel code instead of byte (8-bit). You can take a look > here at my work: > http://github.com/kowalski/redcloth > Problem is, that when you run rspec now on the new code, there is a > number of tests that fails. The difference is the extra whitespaces > added to the resulting html code. For me it is no harm so I have this > jar working on production for a few months now. > > Cheers, > Marek Kowalski > > 2010/10/18 Georg M. : > > Hi Claus, > > I hit the same issue (Linux, Redcloth 4.2.3). > > My workaround was to html-escape non-standard characters before passing > > them to redcloth. It works but my solution is a little bit fragile. Did > > you find a proper solution? > > Best, Georg > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > From etd at nomejortu.com Fri Nov 19 11:06:00 2010 From: etd at nomejortu.com (etd) Date: Fri, 19 Nov 2010 16:06:00 +0000 Subject: RedCloth + Ruby installer 1.9.2p0 Message-ID: <4CE6A068.9070006@nomejortu.com> Hi, We are using RedCloth to provide note formatting inside an open source project called the Dradis Framework [i] and [ii]. This is a Rails-based application that end users install in their computers. What we have done in the past is including RedCloth's binary .gem into the Dradis installer and that has worked out perfectly. However, we are looking into upgrading Dradis to Rails 3 and Ruby 1.9.2. Unfortunately, we are running into some issues in Windows with the Ruby Installer (1.9.2p0) and the binary version of RedCloth (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then fails when trying to load 'msvcrt-ruby18.dll'. I have successfully used DevKit to compile and use RedCloth 4.2.3 in a test system, but I would like to be able to create a Ruby Installer compatible binary gem to distribute it with the installer (thus removing the extra dependency on DevKit for end users). Is this possible? What is the best way to do this? Going to the gem folder (C:\Ruby192\lib\ruby\gems\1.9.1\gems\RedCloth-4.2.3) and running rake fails with a "no such file to load" error. After tweaking the Rakefile and running 'rake mingw compile' also fails [iii]. Can anyone give me a hand to figure out what is going on? Many thanks, Daniel [i] http://dradisframework.org/ [ii] http://dradisframework.org/images/screenshot/v2.5/rich_note_editor.png [iii] http://pastie.org/1311243 From jon.forums at gmail.com Fri Nov 19 14:53:41 2010 From: jon.forums at gmail.com (Jon) Date: Fri, 19 Nov 2010 14:53:41 -0500 Subject: RedCloth + Ruby installer 1.9.2p0 In-Reply-To: <4CE6A068.9070006@nomejortu.com> References: <4CE6A068.9070006@nomejortu.com> Message-ID: <20101119145341.cc49c2b9.jon.forums@gmail.com> > However, we are looking into upgrading Dradis to Rails 3 and Ruby 1.9.2. > Unfortunately, we are running into some issues in Windows with the Ruby > Installer (1.9.2p0) and the binary version of RedCloth > (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then fails when > trying to load 'msvcrt-ruby18.dll'. Hi Daniel, One of the problems that you found was that the RedCloth binary gem was only built to support Ruby 1.8. RedCloth would need to provide a version of its native .so library linked against the Ruby 1.9 DLL in order to run correctly under Ruby 1.9.x. > I have successfully used DevKit to compile and use RedCloth 4.2.3 in a > test system, but I would like to be able to create a Ruby Installer > compatible binary gem to distribute it with the installer (thus removing > the extra dependency on DevKit for end users). Is this possible? What is > the best way to do this? It's possible by creating what many call a "fat binary" gem. A fat gem is basically one that includes a version of their native library linked against 1.8 and a version linked against 1.9, both in the same gem. At runtime, the gems code determines what Ruby version it's running under and loads the correct native library. Two well known libraries that do this are https://github.com/tenderlove/nokogiri and https://github.com/luislavena/sqlite3-ruby I believe the authors of these mingw binary fat gems build them on Linux or OSX using the tool https://github.com/luislavena/rake-compiler which makes it easy for *nix-based gem authors to provide fat binary gems for their Windows users. It would be great to have a fat binary RedCloth :) If you have any questions on the rake-compiler tool after you check it out, search our group at http://groups.google.com/group/rubyinstaller and if you can't find anything that helps, post a question. Luis (author of rake-compiler) can point you in the right direction. Jon From jg at jasongarber.com Sat Nov 20 09:37:23 2010 From: jg at jasongarber.com (Jason Garber) Date: Sat, 20 Nov 2010 08:37:23 -0600 Subject: RedCloth + Ruby installer 1.9.2p0 In-Reply-To: <20101119145341.cc49c2b9.jon.forums@gmail.com> References: <4CE6A068.9070006@nomejortu.com> <20101119145341.cc49c2b9.jon.forums@gmail.com> Message-ID: Daniel, I've been hard at work the last couple weeks on RedCloth. Give the master a try and let me know how it goes. You'll need rake-compiler to cross-compile the fat binary like Jon mentioned. There is a very specific version of Ruby you need to make it work (1.9.1-p243), so use rvm as well. rake gems:build should take care of everything, then. Thanks for giving it a test run. I'm hoping to release it soon if I can get a Java expert to help me fix the JRuby whitespace problem. Jason On Fri, Nov 19, 2010 at 1:53 PM, Jon wrote: > > However, we are looking into upgrading Dradis to Rails 3 and Ruby 1.9.2. > > Unfortunately, we are running into some issues in Windows with the Ruby > > Installer (1.9.2p0) and the binary version of RedCloth > > (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then fails when > > trying to load 'msvcrt-ruby18.dll'. > > Hi Daniel, > > One of the problems that you found was that the RedCloth binary gem was > only built to support Ruby 1.8. RedCloth would need to provide a version of > its native .so library linked against the Ruby 1.9 DLL in order to run > correctly under Ruby 1.9.x. > > > > I have successfully used DevKit to compile and use RedCloth 4.2.3 in a > > test system, but I would like to be able to create a Ruby Installer > > compatible binary gem to distribute it with the installer (thus removing > > the extra dependency on DevKit for end users). Is this possible? What is > > the best way to do this? > > It's possible by creating what many call a "fat binary" gem. > > A fat gem is basically one that includes a version of their native library > linked against 1.8 and a version linked against 1.9, both in the same gem. > At runtime, the gems code determines what Ruby version it's running under > and loads the correct native library. > > Two well known libraries that do this are > https://github.com/tenderlove/nokogiri and > https://github.com/luislavena/sqlite3-ruby > > I believe the authors of these mingw binary fat gems build them on Linux or > OSX using the tool https://github.com/luislavena/rake-compiler which makes > it easy for *nix-based gem authors to provide fat binary gems for their > Windows users. > > It would be great to have a fat binary RedCloth :) > > If you have any questions on the rake-compiler tool after you check it out, > search our group at http://groups.google.com/group/rubyinstaller and if > you can't find anything that helps, post a question. Luis (author of > rake-compiler) can point you in the right direction. > > Jon > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > -------------- next part -------------- An HTML attachment was scrubbed... URL: From etd at nomejortu.com Sun Nov 21 16:25:25 2010 From: etd at nomejortu.com (etd) Date: Sun, 21 Nov 2010 21:25:25 +0000 Subject: RedCloth + Ruby installer 1.9.2p0 In-Reply-To: References: <4CE6A068.9070006@nomejortu.com> <20101119145341.cc49c2b9.jon.forums@gmail.com> Message-ID: <4CE98E45.3000405@nomejortu.com> Thanks Jon and Jason, After some tweaks I was able to get the gem cross-compiled (from master). First thing I had to do was amend the Rakefile to include after 'rake/clean' the following: require 'rake/gempackagetask' Otherwise I would get an error running rake. After that I installed ragel, rake-compiler, mingw32 and got that up and running. Running rake gems:build also worked. It created a lib/redcloth_scan.so and lib/1.9/redcloth_scan.so and a pkg/redcloth-4.2.3.gem Unfortunately this .gem didn't contain any of the .so files. Copying the gem across to the Windows box would install Ok but then fail when requiring 'redcloth' with: no such file to load -- 1.9/redcloth_scan So I copied the 1.9/ folder to by windows path and it worked like a charm. I guess that there is some tweaking around to be made in the gemspec to ensure that the .so files are included in the gem file. Is this an easy fix? I'm asking because I've never distributed a Gem myself and I was thinking that probably someone with more experience will spot the issue more quickly. Many thanks for your help, Daniel On 20/11/2010 14:37, Jason Garber wrote: > Daniel, I've been hard at work the last couple weeks on RedCloth. Give > the master a try and let me know > how it goes. You'll need rake-compiler to cross-compile the fat binary > like Jon mentioned. There is a very specific version of Ruby you need > to make it work (1.9.1-p243), so use rvm as well. rake gems:build > should take care of everything, then. > > Thanks for giving it a test run. I'm hoping to release it soon if I can > get a Java expert to help me fix the JRuby whitespace problem. > > Jason > > On Fri, Nov 19, 2010 at 1:53 PM, Jon > wrote: > > > However, we are looking into upgrading Dradis to Rails 3 and Ruby > 1.9.2. > > Unfortunately, we are running into some issues in Windows with the > Ruby > > Installer (1.9.2p0) and the binary version of RedCloth > > (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then fails > when > > trying to load 'msvcrt-ruby18.dll'. > > Hi Daniel, > > One of the problems that you found was that the RedCloth binary gem > was only built to support Ruby 1.8. RedCloth would need to provide > a version of its native .so library linked against the Ruby 1.9 DLL > in order to run correctly under Ruby 1.9.x. > > > > I have successfully used DevKit to compile and use RedCloth 4.2.3 in a > > test system, but I would like to be able to create a Ruby Installer > > compatible binary gem to distribute it with the installer (thus > removing > > the extra dependency on DevKit for end users). Is this possible? > What is > > the best way to do this? > > It's possible by creating what many call a "fat binary" gem. > > A fat gem is basically one that includes a version of their native > library linked against 1.8 and a version linked against 1.9, both in > the same gem. At runtime, the gems code determines what Ruby > version it's running under and loads the correct native library. > > Two well known libraries that do this are > https://github.com/tenderlove/nokogiri and > https://github.com/luislavena/sqlite3-ruby > > I believe the authors of these mingw binary fat gems build them on > Linux or OSX using the tool > https://github.com/luislavena/rake-compiler which makes it easy for > *nix-based gem authors to provide fat binary gems for their Windows > users. > > It would be great to have a fat binary RedCloth :) > > If you have any questions on the rake-compiler tool after you check > it out, search our group at > http://groups.google.com/group/rubyinstaller and if you can't find > anything that helps, post a question. Luis (author of > rake-compiler) can point you in the right direction. > > Jon > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards From jg at jasongarber.com Tue Nov 23 00:55:17 2010 From: jg at jasongarber.com (Jason Garber) Date: Mon, 22 Nov 2010 23:55:17 -0600 Subject: RedCloth + Ruby installer 1.9.2p0 In-Reply-To: <4CE98E45.3000405@nomejortu.com> References: <4CE6A068.9070006@nomejortu.com> <20101119145341.cc49c2b9.jon.forums@gmail.com> <4CE98E45.3000405@nomejortu.com> Message-ID: Daniel, I've fixed the README to include instructions about bundler and rvm and fixed the gem build tasks to include the proper files. I tested it on Ruby installer 1.9.2p0. You can try it out by pulling the latest from master or use the pre-compiled one I pushed up to rubygems.org with rake install RedCloth --pre Let me know how it goes! Jason On Sun, Nov 21, 2010 at 3:25 PM, etd wrote: > > Thanks Jon and Jason, > > After some tweaks I was able to get the gem cross-compiled (from master). > > First thing I had to do was amend the Rakefile to include after > 'rake/clean' the following: > > require 'rake/gempackagetask' > > Otherwise I would get an error running rake. > > After that I installed ragel, rake-compiler, mingw32 and got that up and > running. > > Running rake gems:build also worked. It created a lib/redcloth_scan.so > and lib/1.9/redcloth_scan.so and a pkg/redcloth-4.2.3.gem > > Unfortunately this .gem didn't contain any of the .so files. Copying the > gem across to the Windows box would install Ok but then fail when > requiring 'redcloth' with: > > no such file to load -- 1.9/redcloth_scan > > So I copied the 1.9/ folder to by windows path and > it worked like a charm. > > I guess that there is some tweaking around to be made in the gemspec to > ensure that the .so files are included in the gem file. > > Is this an easy fix? I'm asking because I've never distributed a Gem > myself and I was thinking that probably someone with more experience > will spot the issue more quickly. > > Many thanks for your help, > Daniel > > On 20/11/2010 14:37, Jason Garber wrote: > > Daniel, I've been hard at work the last couple weeks on RedCloth. Give > > the master a try and let me know > > how it goes. You'll need rake-compiler to cross-compile the fat binary > > like Jon mentioned. There is a very specific version of Ruby you need > > to make it work (1.9.1-p243), so use rvm as well. rake gems:build > > should take care of everything, then. > > > > Thanks for giving it a test run. I'm hoping to release it soon if I can > > get a Java expert to help me fix the JRuby whitespace problem. > > > > Jason > > > > On Fri, Nov 19, 2010 at 1:53 PM, Jon > > wrote: > > > > > However, we are looking into upgrading Dradis to Rails 3 and Ruby > > 1.9.2. > > > Unfortunately, we are running into some issues in Windows with the > > Ruby > > > Installer (1.9.2p0) and the binary version of RedCloth > > > (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then fails > > when > > > trying to load 'msvcrt-ruby18.dll'. > > > > Hi Daniel, > > > > One of the problems that you found was that the RedCloth binary gem > > was only built to support Ruby 1.8. RedCloth would need to provide > > a version of its native .so library linked against the Ruby 1.9 DLL > > in order to run correctly under Ruby 1.9.x. > > > > > > > I have successfully used DevKit to compile and use RedCloth 4.2.3 > in a > > > test system, but I would like to be able to create a Ruby Installer > > > compatible binary gem to distribute it with the installer (thus > > removing > > > the extra dependency on DevKit for end users). Is this possible? > > What is > > > the best way to do this? > > > > It's possible by creating what many call a "fat binary" gem. > > > > A fat gem is basically one that includes a version of their native > > library linked against 1.8 and a version linked against 1.9, both in > > the same gem. At runtime, the gems code determines what Ruby > > version it's running under and loads the correct native library. > > > > Two well known libraries that do this are > > https://github.com/tenderlove/nokogiri and > > https://github.com/luislavena/sqlite3-ruby > > > > I believe the authors of these mingw binary fat gems build them on > > Linux or OSX using the tool > > https://github.com/luislavena/rake-compiler which makes it easy for > > *nix-based gem authors to provide fat binary gems for their Windows > > users. > > > > It would be great to have a fat binary RedCloth :) > > > > If you have any questions on the rake-compiler tool after you check > > it out, search our group at > > http://groups.google.com/group/rubyinstaller and if you can't find > > anything that helps, post a question. Luis (author of > > rake-compiler) can point you in the right direction. > > > > Jon > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org Redcloth-upwards at rubyforge.org> > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > > > > > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > -------------- next part -------------- An HTML attachment was scrubbed... URL: From etd at nomejortu.com Tue Nov 23 02:56:05 2010 From: etd at nomejortu.com (etd) Date: Tue, 23 Nov 2010 07:56:05 +0000 Subject: RedCloth + Ruby installer 1.9.2p0 In-Reply-To: References: <4CE6A068.9070006@nomejortu.com> <20101119145341.cc49c2b9.jon.forums@gmail.com> <4CE98E45.3000405@nomejortu.com> Message-ID: <4CEB7395.7020802@nomejortu.com> Hi Jason, This worked. I didn't have to touch the Rake file and the .so files were included in the gem. The gem ran flawlessly on the Windows box. Many thanks for your support on getting this up and running. The only thing I had to tweak was to comment out tasks/gems.rake#18 rvm ruby-1.8.6-p398 at redcloth rake cross compile RUBY_CC_VERSION=1.8.6 This is because my rake-compiler only had support for 1.9.1 but that is more specific to my case. I reckon that the hole rake-compiler business is a bit messy for people not familiar with it so maybe adding a couple of basic steps in the README will help people out. Something along the lines of what you have when running rake build:win if rake-compiler is not properly configured. Or maybe a wiki page in GitHub on how to get everything up and running for cross-compilation (and a reference to it in the README). Let me know if you need a hand with documentation, I'm more than happy to spend some time putting that together if you think it would be of use. Otherwise I may just write a blog post so I have it for myself in case I need to run through this again. Anyways, thank you very much for your time, Daniel On 23/11/2010 05:55, Jason Garber wrote: > Daniel, > I've fixed the README to include instructions about bundler and rvm and > fixed the gem build tasks to include the proper files. I tested it on > Ruby installer 1.9.2p0. > > You can try it out by pulling the latest from master or use the > pre-compiled one I pushed up to rubygems.org with > rake install RedCloth --pre > > Let me know how it goes! > Jason > > On Sun, Nov 21, 2010 at 3:25 PM, etd > wrote: > > > Thanks Jon and Jason, > > After some tweaks I was able to get the gem cross-compiled (from > master). > > First thing I had to do was amend the Rakefile to include after > 'rake/clean' the following: > > require 'rake/gempackagetask' > > Otherwise I would get an error running rake. > > After that I installed ragel, rake-compiler, mingw32 and got that up and > running. > > Running rake gems:build also worked. It created a lib/redcloth_scan.so > and lib/1.9/redcloth_scan.so and a pkg/redcloth-4.2.3.gem > > Unfortunately this .gem didn't contain any of the .so files. Copying the > gem across to the Windows box would install Ok but then fail when > requiring 'redcloth' with: > > no such file to load -- 1.9/redcloth_scan > > So I copied the 1.9/ folder to by windows path and > it worked like a charm. > > I guess that there is some tweaking around to be made in the gemspec to > ensure that the .so files are included in the gem file. > > Is this an easy fix? I'm asking because I've never distributed a Gem > myself and I was thinking that probably someone with more experience > will spot the issue more quickly. > > Many thanks for your help, > Daniel > > On 20/11/2010 14:37, Jason Garber wrote: > > Daniel, I've been hard at work the last couple weeks on RedCloth. > Give > > the master a try and let me know > > how it goes. You'll need rake-compiler to cross-compile the fat > binary > > like Jon mentioned. There is a very specific version of Ruby you need > > to make it work (1.9.1-p243), so use rvm as well. rake gems:build > > should take care of everything, then. > > > > Thanks for giving it a test run. I'm hoping to release it soon if > I can > > get a Java expert to help me fix the JRuby whitespace problem. > > > > Jason > > > > On Fri, Nov 19, 2010 at 1:53 PM, Jon > > >> wrote: > > > > > However, we are looking into upgrading Dradis to Rails 3 and > Ruby > > 1.9.2. > > > Unfortunately, we are running into some issues in Windows > with the > > Ruby > > > Installer (1.9.2p0) and the binary version of RedCloth > > > (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then > fails > > when > > > trying to load 'msvcrt-ruby18.dll'. > > > > Hi Daniel, > > > > One of the problems that you found was that the RedCloth > binary gem > > was only built to support Ruby 1.8. RedCloth would need to > provide > > a version of its native .so library linked against the Ruby > 1.9 DLL > > in order to run correctly under Ruby 1.9.x. > > > > > > > I have successfully used DevKit to compile and use RedCloth > 4.2.3 in a > > > test system, but I would like to be able to create a Ruby > Installer > > > compatible binary gem to distribute it with the installer (thus > > removing > > > the extra dependency on DevKit for end users). Is this possible? > > What is > > > the best way to do this? > > > > It's possible by creating what many call a "fat binary" gem. > > > > A fat gem is basically one that includes a version of their native > > library linked against 1.8 and a version linked against 1.9, > both in > > the same gem. At runtime, the gems code determines what Ruby > > version it's running under and loads the correct native library. > > > > Two well known libraries that do this are > > https://github.com/tenderlove/nokogiri and > > https://github.com/luislavena/sqlite3-ruby > > > > I believe the authors of these mingw binary fat gems build them on > > Linux or OSX using the tool > > https://github.com/luislavena/rake-compiler which makes it > easy for > > *nix-based gem authors to provide fat binary gems for their > Windows > > users. > > > > It would be great to have a fat binary RedCloth :) > > > > If you have any questions on the rake-compiler tool after you > check > > it out, search our group at > > http://groups.google.com/group/rubyinstaller and if you can't find > > anything that helps, post a question. Luis (author of > > rake-compiler) can point you in the right direction. > > > > Jon > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > > > > > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards From jg at jasongarber.com Tue Nov 23 09:33:15 2010 From: jg at jasongarber.com (Jason Garber) Date: Tue, 23 Nov 2010 08:33:15 -0600 Subject: RedCloth + Ruby installer 1.9.2p0 In-Reply-To: <4CEB7395.7020802@nomejortu.com> References: <4CE6A068.9070006@nomejortu.com> <20101119145341.cc49c2b9.jon.forums@gmail.com> <4CE98E45.3000405@nomejortu.com> <4CEB7395.7020802@nomejortu.com> Message-ID: Great! The thing with not having 1.8.6 installed for rake-compiler is because a warning message that you don't have it installed only shows up when you don't have *any* rubies installed for rake-compiler. Thus, you didn't see it. I added it to the compile steps in the README per your suggestion. Thanks! That should save people a lot of trouble. Best, Jason On Tue, Nov 23, 2010 at 1:56 AM, etd wrote: > Hi Jason, > > This worked. I didn't have to touch the Rake file and the .so files were > included in the gem. The gem ran flawlessly on the Windows box. > > Many thanks for your support on getting this up and running. > > The only thing I had to tweak was to comment out tasks/gems.rake#18 > > rvm ruby-1.8.6-p398 at redcloth rake cross compile RUBY_CC_VERSION=1.8.6 > > This is because my rake-compiler only had support for 1.9.1 but that is > more specific to my case. > > I reckon that the hole rake-compiler business is a bit messy for people > not familiar with it so maybe adding a couple of basic steps in the > README will help people out. Something along the lines of what you have > when running rake build:win if rake-compiler is not properly configured. > Or maybe a wiki page in GitHub on how to get everything up and running > for cross-compilation (and a reference to it in the README). > > Let me know if you need a hand with documentation, I'm more than happy > to spend some time putting that together if you think it would be of > use. Otherwise I may just write a blog post so I have it for myself in > case I need to run through this again. > > Anyways, thank you very much for your time, > > Daniel > > On 23/11/2010 05:55, Jason Garber wrote: > > Daniel, > > I've fixed the README to include instructions about bundler and rvm and > > fixed the gem build tasks to include the proper files. I tested it on > > Ruby installer 1.9.2p0. > > > > You can try it out by pulling the latest from master or use the > > pre-compiled one I pushed up to rubygems.org with > > rake install RedCloth --pre > > > > Let me know how it goes! > > Jason > > > > On Sun, Nov 21, 2010 at 3:25 PM, etd > > wrote: > > > > > > Thanks Jon and Jason, > > > > After some tweaks I was able to get the gem cross-compiled (from > > master). > > > > First thing I had to do was amend the Rakefile to include after > > 'rake/clean' the following: > > > > require 'rake/gempackagetask' > > > > Otherwise I would get an error running rake. > > > > After that I installed ragel, rake-compiler, mingw32 and got that up > and > > running. > > > > Running rake gems:build also worked. It created a > lib/redcloth_scan.so > > and lib/1.9/redcloth_scan.so and a pkg/redcloth-4.2.3.gem > > > > Unfortunately this .gem didn't contain any of the .so files. Copying > the > > gem across to the Windows box would install Ok but then fail when > > requiring 'redcloth' with: > > > > no such file to load -- 1.9/redcloth_scan > > > > So I copied the 1.9/ folder to by windows path > and > > it worked like a charm. > > > > I guess that there is some tweaking around to be made in the gemspec > to > > ensure that the .so files are included in the gem file. > > > > Is this an easy fix? I'm asking because I've never distributed a Gem > > myself and I was thinking that probably someone with more experience > > will spot the issue more quickly. > > > > Many thanks for your help, > > Daniel > > > > On 20/11/2010 14:37, Jason Garber wrote: > > > Daniel, I've been hard at work the last couple weeks on RedCloth. > > Give > > > the master a try and let me > know > > > how it goes. You'll need rake-compiler to cross-compile the fat > > binary > > > like Jon mentioned. There is a very specific version of Ruby you > need > > > to make it work (1.9.1-p243), so use rvm as well. rake gems:build > > > should take care of everything, then. > > > > > > Thanks for giving it a test run. I'm hoping to release it soon if > > I can > > > get a Java expert to help me fix the JRuby whitespace problem. > > > > > > Jason > > > > > > On Fri, Nov 19, 2010 at 1:53 PM, Jon > > > > >> > wrote: > > > > > > > However, we are looking into upgrading Dradis to Rails 3 and > > Ruby > > > 1.9.2. > > > > Unfortunately, we are running into some issues in Windows > > with the > > > Ruby > > > > Installer (1.9.2p0) and the binary version of RedCloth > > > > (RedCloth-4.2.2-x86-mswin32-60.gem). It installs ok but then > > fails > > > when > > > > trying to load 'msvcrt-ruby18.dll'. > > > > > > Hi Daniel, > > > > > > One of the problems that you found was that the RedCloth > > binary gem > > > was only built to support Ruby 1.8. RedCloth would need to > > provide > > > a version of its native .so library linked against the Ruby > > 1.9 DLL > > > in order to run correctly under Ruby 1.9.x. > > > > > > > > > > I have successfully used DevKit to compile and use RedCloth > > 4.2.3 in a > > > > test system, but I would like to be able to create a Ruby > > Installer > > > > compatible binary gem to distribute it with the installer > (thus > > > removing > > > > the extra dependency on DevKit for end users). Is this > possible? > > > What is > > > > the best way to do this? > > > > > > It's possible by creating what many call a "fat binary" gem. > > > > > > A fat gem is basically one that includes a version of their > native > > > library linked against 1.8 and a version linked against 1.9, > > both in > > > the same gem. At runtime, the gems code determines what Ruby > > > version it's running under and loads the correct native > library. > > > > > > Two well known libraries that do this are > > > https://github.com/tenderlove/nokogiri and > > > https://github.com/luislavena/sqlite3-ruby > > > > > > I believe the authors of these mingw binary fat gems build them > on > > > Linux or OSX using the tool > > > https://github.com/luislavena/rake-compiler which makes it > > easy for > > > *nix-based gem authors to provide fat binary gems for their > > Windows > > > users. > > > > > > It would be great to have a fat binary RedCloth :) > > > > > > If you have any questions on the rake-compiler tool after you > > check > > > it out, search our group at > > > http://groups.google.com/group/rubyinstaller and if you can't > find > > > anything that helps, post a question. Luis (author of > > > rake-compiler) can point you in the right direction. > > > > > > Jon > > > _______________________________________________ > > > Redcloth-upwards mailing list > > > Redcloth-upwards at rubyforge.org > > > > > > > > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > > > > > > > > > > > _______________________________________________ > > > Redcloth-upwards mailing list > > > Redcloth-upwards at rubyforge.org Redcloth-upwards at rubyforge.org> > > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > > > > > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jg at jasongarber.com Sat Nov 27 07:49:25 2010 From: jg at jasongarber.com (Jason Garber) Date: Sat, 27 Nov 2010 06:49:25 -0600 Subject: RedCloth, JRuby and national characters In-Reply-To: <628C10B4-4CD2-4516-927A-6F570C2C914E@jasongarber.com> References: <509710a18d5ae52efd21741542d5c89f@ruby-forum.com> <44b23f593b41e41d820a3c0412f47cfc@ruby-forum.com> <628C10B4-4CD2-4516-927A-6F570C2C914E@jasongarber.com> Message-ID: I've posted this task to oDesk with a $100 budget. Let's hope someone takes the job! http://www.odesk.com/jobs/JRuby-fix-for-RedCloth_%7E%7E273ff7a15a938782 On Fri, Nov 12, 2010 at 3:57 AM, Jason Garber wrote: > Great work, Marek! I pulled your work into a branch: jruby-mbc > > The problem, as you pointed out, is extra whitespace. I'm hoping you or > someone else can help me get it figured out so I can release it! > > It seems to be just when there's HTML in the input. (At least that's all > I've found so far.) When it's a standalone HTML tag (just a block tag on a > line), it puts two BRs after. When it's an HTML block (start tag, contents, > end tag), it puts the BR inside the beginning of the next block. When just > one newline ends the document, it puts a BR inside the end of the last > block; two newlines before EOF behave fine though. > >
html_block
> > This is a paragraph with > a line break > > standalone_html coming up. > >
> > Another p > >
test
> > Another p. > > > Results in: > >
html_block
>


> This is a paragraph with
> a line break

>

standalone_html coming up.

>

>
> >

Another p

>
test
>


> Another p.
>

> > > Weird, huh? I'd greatly appreciate anyone who can help this Java dunce > (me). Here's the fast way to get it checked out and set up: > > git clone git at github.com:jgarber/redcloth.git > cd redcloth > git checkout jruby-mbc > rvm use jruby-1.5.3 at redcloth # assuming you're using rvm and you've done > 'rvm install jruby' > bundle > rake compile > > > Thanks! > Jason > > On Oct 18, 2010, at 6:00 AM, Marek Kowalski wrote: > > Hi Georg, > I went the same went. Eventually I managed to kind of solve the > problem, I have the proper jar generated which handles UTF characters > properly. What basicly what needs to be done is to use char (16-bit) > datatype in Ragel code instead of byte (8-bit). You can take a look > here at my work: > http://github.com/kowalski/redcloth > Problem is, that when you run rspec now on the new code, there is a > number of tests that fails. The difference is the extra whitespaces > added to the resulting html code. For me it is no harm so I have this > jar working on production for a few months now. > > Cheers, > Marek Kowalski > > 2010/10/18 Georg M. : > > Hi Claus, > > > I hit the same issue (Linux, Redcloth 4.2.3). > > > My workaround was to html-escape non-standard characters before passing > > them to redcloth. It works but my solution is a little bit fragile. Did > > you find a proper solution? > > > Best, Georg > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Mon Nov 29 09:14:35 2010 From: lists at ruby-forum.com (Steve Austen) Date: Mon, 29 Nov 2010 15:14:35 +0100 Subject: Bug: NoMethodError: private method `gsub' called for nil:NilClass In-Reply-To: References: Message-ID: hi its seems like you have done a hard work on it. I have got lots of information from your post. Really appreciate your work.!! It was describe very nicely keep us doing good work.. http://www.dealsourcedirect.com/ion-tape2pc.html -- Posted via http://www.ruby-forum.com/. From jg at jasongarber.com Mon Nov 29 19:18:02 2010 From: jg at jasongarber.com (Jason Garber) Date: Mon, 29 Nov 2010 18:18:02 -0600 Subject: Bug: NoMethodError: private method `gsub' called for nil:NilClass In-Reply-To: References: Message-ID: I copied it into a Lighthouse ticket. Thanks for reporting the bug http://jgarber.lighthouseapp.com/projects/13054-redcloth/tickets/200-nil-gsub-when-img-with-src-and-filter_html-is-on On Tue, Dec 4, 2007 at 9:05 AM, Douglas F Shearer wrote: > Hi there. > > I'm using RedCloth as part of a social network's blog system. > > I came across the following bug when an img tag with the src attribute > is inputted, and filter_html is set to true. > > I have pasted the code sample below. > > >> require 'RubyGems' > => true > >> require 'RedCloth' > => true > >> RedCloth.new('',[:filter_html]).to_html > NoMethodError: private method `gsub' called for nil:NilClass > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1118:in `clean_html' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1113:in `each' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1113:in `clean_html' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1112:in `each' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1112:in `clean_html' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1107:in `gsub!' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:1107:in `clean_html' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/gems/1.8/gems/RedCloth-3.0.4/lib/RedCloth.rb:310:in `to_html' > from (irb):3 > >> > > Thanks. > > Douglas F Shearer > dougal.s at gmail.com > http://douglasfshearer.com > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > -------------- next part -------------- An HTML attachment was scrubbed... URL: