Bluecloth v2.0.10 with windows 7 not working

自作多情 提交于 2019-12-05 04:55:15
Alfred

If you need 2.2.0 (the latest version), here's how I got it to work:

  1. Install DevKit

  2. Run the command below to install bluecloth:

    gem install bluecloth

    this will fail miserably when building "native extensions", but will successfully install the gem's source code.

  3. Patch bluecloth.h file (for me, this is found in: D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\ext), with the patch from here: https://gist.github.com/1539611

  4. Go to bluecloth's gem installation folder. For me, this looks like below:

    D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0

  5. Run the following command:

    rake gem

    It may prompt you to install some other gems, follow accordingly. When it's done, you should see a bluecloth-2.2.0.gem created. For me, it is found here:

    D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\pkg\bluecloth-2.2.0.gem

  6. Go to bluecloth-2.2.0.gem location, and run the following command:

    gem install bluecloth-2.2.0.gem --platform=ruby

It seems there is a bug/issue with version 2.0.10 of BlueCloth. You can try using an older version like 2.0.7:

gem install bluecloth -v 2.0.7

Which seems to work.

Also probably this worth checking latest version (2.2.0?) and if not work, report it back to gem author:

http://deveiate.org/projects/BlueCloth/query

This is the patched bluecloth.h code, for people in a hurry...

#ifndef BLUECLOTH_H
#define BLUECLOTH_H
 
#include "ruby.h"

#if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
#	define M17N_SUPPORTED
#	include "ruby/encoding.h"
#endif

#include "config.h"
#include "assert.h"
 
#include "mkdio.h"
 
void mkd_initialize  		_(( void ));
void mkd_with_html5_tags	_(( void ));
 
/* Replace the macro from encoding.h that refers to static 'rb_encoding_list' */
#ifdef ENC_FROM_ENCINDEX
#undef ENC_FROM_ENCINDEX
#define ENC_FROM_ENCINDEX(idx) (rb_enc_from_index(idx))
#endif

#endif

There's a fork on github that already includes the patch:

https://github.com/drakontia/bluecloth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!