Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-06-04 17:27:25

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

TextilePHP -- port of Choate's "Textile 2" available

Jim Riggs has ported Brad Choate’s enhanced Textile 2 implementation to PHP, and it’s already been turned into a WordPress plugin. Is something similar possible for Textpattern?

Last edited by Logoleptic (2004-06-04 17:27:40)

Offline

#2 2004-06-04 18:03:46

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: TextilePHP -- port of Choate's "Textile 2" available

Right now, the only way I could see it being implemented as a plugin would be to have your post wrapped in a some tag, and have everything between the tags processed with the texttile 2 code. You would need to turn off textile processing on all posts as well, so they don’t get textiled twice. It might be better to modify the php code so that when there are calls made to textile text, those calls use the textile 2 code instead of dean’s code. Anyway, I’m sure someone here will take it upon themselves to port the thing over.

Offline

#3 2004-06-04 18:45:39

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: TextilePHP -- port of Choate's "Textile 2" available

> ramanan wrote:

I’m sure someone here will take it upon themselves to port the thing over.

With Textpattern’s new open-source license, I’m sure you’re right. I use WordPress, personally, but my experiences there are really helping me fall in love with the open source development model!

Offline

#4 2004-06-04 22:26:13

greenrift
Archived Plugin Author
Registered: 2004-03-08
Posts: 186
Website

Re: TextilePHP -- port of Choate's "Textile 2" available

All you’d have to do is replace classTextile.php with your version of a Textile like language.

The only requirements in doing this are as follows:

  • It must be a class that can be dynamically created
  • The class must be named Textile
  • The class must contain a function called “TextileThis” that does two things:
    • Accept five parameters, the first being the input that you wish to transform (but if only one of them are used in your implementation, you can set the rest to a default NULL)
    • Return the XHTML version of the inputted text.

There are some things with the lite and strict options in the currently included Textile that should be taken into consideration. It seems that “lite” mode is the only important part, and lite mode just doesn’t allow block elements, strict mode just does some basic cleanup.

Offline

#5 2004-06-05 01:15:20

Kibitzer
Member
From: Melbourne, Australia
Registered: 2004-05-24
Posts: 44

Re: TextilePHP -- port of Choate's "Textile 2" available

Uhhh… dumb question here — why would you want a Textile plugin for Textpattern? I mean, Textpattern already does Textile, right?


VC200 Member #69 — VCTWO Member — Mixed Gorilla
YES!” “That would be an ecumenical matter!”

Offline

#6 2004-06-05 01:54:29

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: TextilePHP -- port of Choate's "Textile 2" available

Kibitzer,

Brad Choate’s implementation of Textile adds several new features and fixes some limitations. I’m hoping to see it built into a future version of Textpattern.

Offline

#7 2004-06-05 03:01:53

pwg
Member
From: *sunny* Melbourne, Au
Registered: 2004-02-24
Posts: 14
Website

Re: TextilePHP -- port of Choate's "Textile 2" available

> greenrift wrote:
> All you’d have to do is replace classTextile.php with your version of a Textile like language.

It seems to me, although I’m no programmer, that this should not be difficult using the interface to Jim Rigg’s php port of Textile2. The interface is specified here

As you’ll see, Jim’s implementation would readily(?) allow re-naming of the ‘process’ function to include the additional paramters.

I recently took Rigg’s port and turned it into a textile2 filter for BBedit using a stub file to call Riggs’ code thus:

<code>
#! /usr/bin/php
<?
include once(‘/path/to/Rigg’s/Textile.php’);
// grab the contents of the BBedit window; should be parentheses around “1” in the next line but textile mucks them up
$input = file_get_contents($argv 1) or die(“Only one fatal errror, my friend”);
$textile = new Textile; //instantiate a new Textile object
$xhtml = $textile->process($input);
print $xhtml;
?>
</code>

This works fine in BBedit because OS X now includes PHP CLI version.

Hope someone who knows PHP will do this for Txp (maybe as a plugin?). It’s probably above my pay-grade.

Last edited by pwg (2004-06-05 03:36:02)


Peter Gallagher — www.petergallagher.com.au — inquit pty ltd

Offline

#8 2004-06-05 12:42:03

Kibitzer
Member
From: Melbourne, Australia
Registered: 2004-05-24
Posts: 44

Re: TextilePHP -- port of Choate's "Textile 2" available

> Logoleptic wrote:

> Kibitzer,

> Brad Choate’s implementation of Textile adds several new features and fixes some limitations. I’m hoping to see it built into a future version of Textpattern.

Interesting. I’ll have to check it out. I was using his plugin with MT on my previous host (before TextDrive!!) and I found it a little buggy. In particular, I found that multiple citations in the same paragraph weren’t correctly parsed.


VC200 Member #69 — VCTWO Member — Mixed Gorilla
YES!” “That would be an ecumenical matter!”

Offline

#9 2004-06-05 16:29:04

greenrift
Archived Plugin Author
Registered: 2004-03-08
Posts: 186
Website

Re: TextilePHP -- port of Choate's "Textile 2" available

> pwg wrote:

> > greenrift wrote:
> All you’d have to do is replace classTextile.php with your version of a Textile like language.

It seems to me, although I’m no programmer, that this should not be difficult using the interface to Jim Rigg’s php port of Textile2. The interface is specified here

Your right, it is very easy to do (I tested it last night).

The hardest part is that TXP uses Textile for its Title’s as well, and it uses a “lite” mode for that which doesn’t wrap the title in any block elements. So if you use TextilePHP you have to take that into account (aka, add a lite mode) otherwise your title’s get wrapped in paragraphs and that isn’t good.

Offline

#10 2004-06-05 18:46:21

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: TextilePHP -- port of Choate's "Textile 2" available

greenrift wrote:

Your right, it is very easy to do (I tested it last night).

I hope you’ll consider submitting your changes to Dean for possible inclusion in the official Textpattern build. :-)

Last edited by Logoleptic (2004-06-05 18:48:47)

Offline

#11 2004-06-05 18:52:24

DougBTX
Archived Plugin Author
Registered: 2004-05-23
Posts: 22

Re: TextilePHP -- port of Choate's "Textile 2" available

or post your new textile.php file if you really like us :)

Douglas

Offline

#12 2004-06-06 01:23:56

greenrift
Archived Plugin Author
Registered: 2004-03-08
Posts: 186
Website

Re: TextilePHP -- port of Choate's "Textile 2" available

Well, doing the article textiling is easy to do, its just the lite mode is much harder. The “process” function mentioned earlier is this 5 page function that does everything (Dean’s classTextile is much easier to follow). I’ve figured out a really dirty hack that would work, but the directions to follow them are a little complicated (you’d have to rename a bunch of stuff).

I’m gonna keep working on it and see what I can do.

Offline

Board footer

Powered by FluxBB