Salvation for Textile Drupal Module!

The last version of PHP seems to break the current Textile module for Drupal. I also experienced the bug – OLs and LIs suddenly doesn’t work as expected, and later I also discovered that one of my page also suffer from the blank page bug . Dreamhost issue (also this one which is basically the same) and the bug I experienced, apparently have the same root of evil: the core Textile module.

I don’t really think that TextilePHP, the code base this module is using is maintained anymore. Instead, the Textile implementation of Treshold State seems to be much better (if it is maintained at all). I tweaked around a bit to integrate it to textile.module (throwing out the original TextilePHP), tested it, and boom – bugs went nowhere! Hooray!

I also found that there is an issue about integrating Treshold State implementation. So how about that for single-sweep-for-three-issues? :p

So edit the file textile.module, replace function _textile_process() with the following code (hey, I’m not really good at patch files!):

function _textile_process($matches) {
  static $textile = NULL;
  if ($textile === NULL) {
    require_once(dirname(__FILE__) . '/classTextile.inc');
    $textile = new Textile();
    //$textile->hu is the string that preceeds all relative URLs.
    //So I copied the part of url() implementation in common.inc
    //not tested in real non-Apache webserver yet
    $textile->hu =
      base_path()
      . ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE) ? 'index.php' : '')
      . ((bool)variable_get('clean_url', '0') ? '' : '?q=')
    ;
  }
  //should there be any encoding declaration of some sort?  Can't find how to do it though
  return $textile->TextileThis($matches[1]);
}

After that:

  1. download the implementation from Treshold State.
  2. extract classTextile.php to the textile module directory, so it resides on the same directory as textile.module.
  3. rename classTextile.php to classTextile.inc (to conform Drupal’s convention of included files!).
  4. either empty the filter cache (DELETE FROM {cache_filter} WHERE 1) or manually re-save every buggy node to reflect the new filter.

For the impatient, I have made the module attached ready for use. Also, I think the implementation differs a slight way from TextilePHP, for example deeply nested lists may not work the same.

Of course, after the integration there are lots of things that IMO must be done (and I must say that mumbling is easier than coding!):

  • add the option to disable “smart-quoting”. This is possible by defining the entities used for opening/closing quotes before including classTextile.inc.
  • add the second filter, the “Restricted Textile” – a feature for this particular implementation. It is supposed to provide Textile filtering without risking security.

Another note:

Copyright 2006 Alex Shiels / Threshold State. All rights reserved. Email for documentation licensing info.

Sadly the author does not want to share the documentation…

AttachmentSize
textile-5.x-1.1alt.tar.gz26.87 KB

13 comments

Thanks a lot!

Thanks a lot!

And I would really. And I would really appreciate confirmation that this _does_ work...
Woot! Thanks a bunch, Alex!

Woot! Thanks a bunch, Alex! This error totally borked my site and I was at a loss as to what to do. I appreciate your making the patched module available for download. Now I don't have to retrofit all my nodes to Texy!

Woot.

This works. I am going to roll a patch.

Patch.

Patch available here for those who like that kind of thing:

http://drupal.org/node/143730

Also, note that you still have to download the textile class file (classTextile.php) separately from threshhold state. This will likely be standard going forward, and is the Drupal Way for including third-party code.

This is an old post, but...

...I thought I would comment for those still wanting to use Textile with Drupal.

FYI, the best place to get the latest copy of Textile is here:

"Dev" version (can sometimes be more stable than "stable"):
http://textpattern-cms.googlecode.com/svn/development/4.0/textpattern/li...

Current latest stable version:
http://textpattern-cms.googlecode.com/svn/releases/4.0.6/source/textpatt...

Alex (Threshold State) doesn't maintain Textile anymore, as he's no longer a Textpattern developer (they have been developed in tandem for some time). IIRC, there's been at least one bug fix since Alex worked on it as well. :)

I think Textile module.

I think Textile module maintainers already updated the source path. It is best if you double-check and post an issue if it hasn't already done. Thanks for the interest though!

Vos commentaires sont.

Vos commentaires sont intéressants. Merci bien pour vos eclaircissements !

Agen Bola.

You should comment on the competition comparison of the blog. You can highlight it's mind boggling. Your blog exploration/tour will broaden your conversions.

なセット商品でも通常このコーティングのなされシャネル腕時計.

なセット商品でも通常このコーティングのなされシャネル腕時計たレンズが付属するので、値段を理由にこのコーティングを省くことはあまり無い。ガラスでもプラスチックでも素材自体に紫外線を通しにくい性質があり、紫外線をカットしないレ

obatpenyakitdarahtinggiherbal.web.id/.

information is very useful

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <pre> <i> <b>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.

Recent comments