[#129195] Is compatibility important for us? — Esteban Manchado Vel痙quez <zoso@...>

Hi all,

28 messages 2005/02/01
[#129199] Re: Is compatibility important for us? — James Britt <jamesUNDERBARb@...> 2005/02/01

Esteban Manchado Vel痙quez wrote:

[#129204] Re: Is compatibility important for us? — Francis Hwang <sera@...> 2005/02/01

[#129207] Re: Is compatibility important for us? — Eric Hodel <drbrain@...7.net> 2005/02/01

On 31 Jan 2005, at 18:21, Francis Hwang wrote:

[#129209] Re: Is compatibility important for us? — Francis Hwang <sera@...> 2005/02/01

[#129214] Re: Is compatibility important for us? — "Trans" <transfire@...> 2005/02/01

Francis,

[#129216] Re: Is compatibility important for us? — Francis Hwang <sera@...> 2005/02/01

[#129698] Re: Is compatibility important for us? — Esteban Manchado Vel痙quez <zoso@...> 2005/02/04

I had this on "postponed", and I just realized. Sorry.

[#129718] Re: Is compatibility important for us? — James Britt <jamesUNDERBARb@...> 2005/02/05

Esteban Manchado Vel痙quez wrote:

[#129808] Re: Is compatibility important for us? — Esteban Manchado Vel痙quez <zoso@...> 2005/02/05

On Sat, Feb 05, 2005 at 10:29:11AM +0900, James Britt wrote:

[#129218] Partial function application (was: Re: Binding precedence for first sym...) — E S <eero.saynatkari@...>

Trans wrote:

13 messages 2005/02/01
[#129220] Re: Partial function application (was: Re: Binding precedence for first sym...) — "Trans" <transfire@...> 2005/02/01

[#129289] Newbie: How to delete a Rails app (Windows) — peter.cutting@...

Hi

25 messages 2005/02/01
[#129362] Re: Newbie: How to delete a Rails app (Windows) — Douglas Livingstone <rampant@...> 2005/02/02

> but how do I delete? (If I just delete then I get a permissions

[#129373] Re: Newbie: How to delete a Rails app (Windows) — Caio Tiago Oliveira <caiot1@...> 2005/02/02

Douglas Livingstone, 2/2/2005 06:04:

[#129380] Re: Newbie: How to delete a Rails app (Windows) — peter.cutting@... 2005/02/02

yes the switching off may have helped (will try logging off next time

[#129385] Nuby needs an intro to testing for Win 2K — Barry Sperling <barry@...> 2005/02/02

[#129293] Re: [QUIZ] To Excel (#17) — "Graham Foster" <graham@...>

> Years ago, on a job developing custom reporting software, this was

15 messages 2005/02/01

[#129316] Wee 0.7.0 + Tutorial Videos — Michael Neumann <mneumann@...>

Hi,

27 messages 2005/02/01
[#129449] Re: Wee 0.7.0 + Tutorial Videos — itsme213@... 2005/02/03

Michael, I may be doing something wrong, but none of the MPEGs worked

[#129345] ANN: ParseTree 1.3.3 and ruby2c 1.0.0 beta 1 — Ryan Davis <ryand-ruby@...>

Actual announcements are on http://blog.zenspider.com/

24 messages 2005/02/02

[#129351] yarv and dbi — jm <jeffm@...>

Anyone out there tried dbi with yarv

18 messages 2005/02/02
[#129358] Re: yarv and dbi — SASADA Koichi <ko1@...> 2005/02/02

jm <jeffm@ghostgun.com> wrote :

[#129451] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...>

"

90 messages 2005/02/03
[#130693] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...> 2005/02/13

Ilias Lazaridis wrote:

[#130749] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Douglas Livingstone <rampant@...> 2005/02/14

> From the communities behaviour, I extract the following answer:

[#130784] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...> 2005/02/14

Douglas Livingstone wrote:

[#130785] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Luke Graham <spoooq@...> 2005/02/14

From the link - "fictive technology collection". Ive worked on some of

[#130786] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Luke Graham <spoooq@...> 2005/02/14

Some of it is possible. I have created persistent Ruby objects, for

[#130823] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Austin Ziegler <halostatue@...> 2005/02/14

On Mon, 14 Feb 2005 17:49:18 +0900, Luke Graham <spoooq@gmail.com> wrote:

[#130856] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...> 2005/02/14

Austin Ziegler wrote:

[#130871] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Austin Ziegler <halostatue@...> 2005/02/14

On Tue, 15 Feb 2005 04:09:54 +0900, Ilias Lazaridis

[#131021] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...> 2005/02/15

Austin Ziegler wrote:

[#131025] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Thomas E Enebo <enebo@...> 2005/02/15

On Wed, 16 Feb 2005, Ilias Lazaridis defenestrated me:

[#131031] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...> 2005/02/15

Thomas E Enebo wrote:

[#131036] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Thomas E Enebo <enebo@...> 2005/02/15

On Wed, 16 Feb 2005, Ilias Lazaridis defenestrated me:

[#131039] Re: [EVALUATION] - E01: The Java Failure - May Ruby Helps? — Ilias Lazaridis <ilias@...> 2005/02/15

Thomas E Enebo wrote:

[#129452] RedCloth 3.0.2 -- Please, oh please, let this be the one — why the lucky stiff <ruby-talk@...>

Okay, okay. The tumblers are clicking, the clouds are parting.

15 messages 2005/02/03

[#129554] lack of reaction to latest ruby implementations — Alexander Kellett <ruby-lists@...>

working on alternatives for the ruby runtime has

37 messages 2005/02/03

[#129686] iteration the ruby way — Navindra Umanee <navindra@...>

Hi,

18 messages 2005/02/04

[#129726] Ruby for closed source projects — Michael Gebhart <mail@...>

Hi,

16 messages 2005/02/05

[#129778] Korundum: error when overriding a KDE::RootPixmap method — Martin Traverso <martin@...>

Hi,

15 messages 2005/02/05

[#129831] Benchmark Mono - Ruby — Michael Gebhart <mail@...>

Hi,

21 messages 2005/02/06

[#129878] Ruby Interactive Shell — "Jenjhiz" <jenjhiz@...>

Hello,

18 messages 2005/02/06

[#129959] delayed string interpolation — Navindra Umanee <navindra@...>

Hi,

14 messages 2005/02/07

[#130044] web testing with Ruby — Jason Sweat <jason.sweat@...>

Does anyone have suggestions for projects/libraries to web test code

12 messages 2005/02/07

[#130068] Grid computing with Ruby? — Alexander Staubo <alex@...>

I have an interest in distributed computing and so-called grid

11 messages 2005/02/08

[#130090] Squeak like environment for Ruby — Logan Capaldo <logancapaldo@...>

Lately I've been playing around with Squeak (http://www.squeak.org/),

20 messages 2005/02/08
[#130091] Re: Squeak like environment for Ruby — Caio Tiago Oliveira <caiot1@...> 2005/02/08

Logan Capaldo, 8/2/2005 00:45:

[#130108] Re: Squeak like environment for Ruby — Alexander Kellett <ruby-lists@...> 2005/02/08

On Feb 8, 2005, at 4:59 AM, Caio Tiago Oliveira wrote:

[#130102] Syck 0.50 -- The new YAML is here for testing — why the lucky stiff <ruby-talk@...>

Finally, I can go back to drawing ponies out on the bridge by the old

13 messages 2005/02/08

[#130180] Ruby users in India? — Premshree Pillai <premshree.pillai@...>

Hi,

20 messages 2005/02/08

[#130280] How to mimic Perl's `s///' in Ruby? — Jos Backus <jos@...>

Given Perl's

18 messages 2005/02/09

[#130305] Phone number to words — Jordi Bunster <jordi@...>

Does anyone have one of those algorithms that convert a phone number to

13 messages 2005/02/10

[#130327] Building a Better Functor — "John W. Long" <ng@...>

Hi,

29 messages 2005/02/10

[#130399] A Ruby-relevant quote from Alan Kay — "Curt Hibbs" <curt@...>

ACM Queue just published an interview with Alan Kay (the creator of

27 messages 2005/02/10
[#130400] Re: A Ruby-relevant quote from Alan Kay — PA <petite.abeille@...> 2005/02/10

[#130408] Re: A Ruby-relevant quote from Alan Kay — Douglas Livingstone <rampant@...> 2005/02/10

> Steve Wart about "why Smalltalk never caught on":

[#130573] utilizing ++ and -- for comments — "Pe, Botp" <botp@...>

Since ++ and -- wont see the light of day in ruby, can we use it for comment

27 messages 2005/02/12
[#130587] Re: utilizing ++ and -- for comments — "George Moschovitis" <george.moschovitis@...> 2005/02/12

I also think that the =begin, =end notation is not comfortable to use.

[#130595] Re: utilizing ++ and -- for comments — Douglas Livingstone <rampant@...> 2005/02/12

> for example /* */

[#130707] Printing why's (poignant) guide to ruby — Richard Dale <Richard_Dale@...>

I'd like to try ruby on non-programmers teaching them using why's amazing

62 messages 2005/02/13
[#130714] Re: Printing why's (poignant) guide to ruby — Navindra Umanee <navindra@...> 2005/02/13

Richard Dale <Richard_Dale@tipitina.demon.co.uk> wrote:

[#130716] Re: Printing why's (poignant) guide to ruby — Alexander Kellett <ruby-lists@...> 2005/02/13

i'm really puzzled by this.

[#130731] Re: Printing why's (poignant) guide to ruby — Navindra Umanee <navindra@...> 2005/02/13

Alexander Kellett <ruby-lists@lypanov.net> wrote:

[#130843] Re: Printing why's (poignant) guide to ruby — Marcus Sharp <brothermarcus@...> 2005/02/14

*putting on flame retardant pants*

[#130715] Ruby on Windows: debugger questions and comments — umptious@... (JC)

'm evaluating scripting languages for a client. Ruby as a language

28 messages 2005/02/13

[#130742] (OT) Programmer's editors for the Mac — Timothy Hunter <cyclists@...>

Just got a new Powerbook, so I'm looking for suggestions for a good

43 messages 2005/02/14

[#130975] Is this old style Ruby? — centrepins@...

In Why's guide, I see the line:

30 messages 2005/02/15
[#130980] Re: Is this old style Ruby? — Jeremy Tregunna <jtregunna@...> 2005/02/15

[#130982] Re: Is this old style Ruby? — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/02/15

* Jeremy Tregunna (Feb 15, 2005 15:10):

[#130986] Re: Is this old style Ruby? — centrepins@... 2005/02/15

Page 349 of the (printed) pickaxe2 mentions '::' and '.', but doesn't

[#130988] Re: Is this old style Ruby? — "David A. Black" <dblack@...> 2005/02/15

Hi --

[#131103] Wee web-framework. It's great! — Joao Pedrosa <joaopedrosa@...>

Hi,

21 messages 2005/02/16
[#131111] Re: Wee web-framework. It's great! — "Vincent Foley" <vfoley@...> 2005/02/16

You know, I think Wee could become really hot if someone could mix it

[#131127] adding a dynamic method handler? (long post) — Mark Hubbart <discordantus@...>

Hi,

12 messages 2005/02/16

[#131132] Ruby + end user applications — "martinus" <martin.ankerl@...>

Ruby definitely needs more cool, simple to use, end user applications.

16 messages 2005/02/16

[#131168] FileSystem 0.1.0: Beta for me, Alpha for you — Francis Hwang <sera@...>

Greetings!

23 messages 2005/02/16

[#131252] Where is Ruby headed etc. — centrepins@... (Glenn)

A few musings/questions/dribble from an excited newbie. And my first

21 messages 2005/02/16
[#131256] Re: Where is Ruby headed etc. — Ben Giddings <bg-rubytalk@...> 2005/02/16

Glenn wrote:

[#131283] Re: Where is Ruby headed etc. — Brian McCallister <brianm@...> 2005/02/17

[#131286] Re: Where is Ruby headed etc. — Yukihiro Matsumoto <matz@...> 2005/02/17

Hi,

[#131275] installed ruby on linux without su access — Eko Budi Setiyo <contact_us@...>

Hi all,

17 messages 2005/02/17

[#131284] Ruby Visual Identity Team — "John W. Long" <ng@...>

Recently I've seen a couple of people mention how much they would like

43 messages 2005/02/17
[#131288] Re: Ruby Visual Identity Team — James Britt <jamesUNDERBARb@...> 2005/02/17

John W. Long wrote:

[#131307] Re: Ruby Visual Identity Team — gabriele renzi <rff_rff@...> 2005/02/17

James Britt ha scritto:

[#131404] - E02 - Nitro, a Ruby Based WebFramework — Ilias Lazaridis <ilias@...>

50 messages 2005/02/17
[#131445] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Aredridel <aredridel@...> 2005/02/17

>

[#131490] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Luke Graham <spoooq@...> 2005/02/18

Wow, I actually predicted this post in another thread. Nitro vs ruby is clearly

[#131494] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Alexander Kellett <ruby-lists@...> 2005/02/18

not too sure to be honest.

[#131496] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Alexander Kellett <ruby-lists@...> 2005/02/18

i take this back i read some of the various

[#131506] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Bill Guindon <agorilla@...> 2005/02/18

On Fri, 18 Feb 2005 11:30:49 +0900, Alexander Kellett

[#131592] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Christian Neukirchen <chneukirchen@...> 2005/02/18

Bill Guindon <agorilla@gmail.com> writes:

[#131605] Re: [EVALUATION] - E02 - Nitro, a Ruby Based WebFramework — Ilias Lazaridis <ilias@...> 2005/02/18

Christian Neukirchen wrote:

[#131422] ICFP Contest Dates Are Set — James Edward Gray II <james@...>

It's pretty early yet, but a lot of coders need time to plan and gather

13 messages 2005/02/17

[#131469] Virtual Ruby Group — Zach Dennis <zdennis@...>

Ok, I have a question for fellow rubyists, rubyiers, etc... There seem

55 messages 2005/02/17
[#131906] Re: Virtual Ruby Group — Zach Dennis <zdennis@...> 2005/02/21

It looks like there are a few folks interested in the Virtual Ruby Group

[#131921] Re: Virtual Ruby Group — "Curt Hibbs" <curt@...> 2005/02/21

One more suggestion: you could make a FreeRIDE plugin out of jabber4r, and

[#131942] Re: Virtual Ruby Group — Tanner Burson <tanner.burson@...> 2005/02/21

On Mon, 21 Feb 2005 21:02:19 +0900, Curt Hibbs <curt@hibbs.com> wrote:

[#131946] Re: Virtual Ruby Group — Bill Guindon <agorilla@...> 2005/02/21

On Tue, 22 Feb 2005 00:41:36 +0900, Tanner Burson

[#132114] Re: Virtual Ruby Group — Zach Dennis <zdennis@...> 2005/02/23

Bill Guindon wrote:

[#131499] pulling my hair out, why won't Kernel.sleep(0) sleep? — Sam Roberts <sroberts@...>

Can anybody give me any hints as to what I should be looking for? What

17 messages 2005/02/18

[#131545] Require when Executed file is required by another file. — "Zev Blut" <rubyzbibd@...>

Hello,

11 messages 2005/02/18

[#131563] 1-800-THE-QUIZ (#20) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

12 messages 2005/02/18

[#131635] Rails presentation — Jamis Buck <jamis_buck@...>

So I gave a presentation on Rails to the Utah Java Users Group last

14 messages 2005/02/18

[#131685] FXIrb 0.14 - a Win32 GUI wrapper around IRB — Martin DeMello <martindemello@...>

- What?

19 messages 2005/02/18

[#131753] Array#join non string arguments — Simon Strandgaard <neoneye@...>

A proposal:

15 messages 2005/02/19

[#131808] destructive! operations — Navindra Umanee <navindra@...>

Hi,

58 messages 2005/02/20
[#131847] Re: destructive! operations — "Robert Klemme" <bob.news@...> 2005/02/20

[#131852] Re: destructive! operations — Caio Tiago Oliveira <caiot1@...> 2005/02/20

Robert Klemme, 20/2/2005 12:04:

[#131859] Re: destructive! operations — James Edward Gray II <james@...> 2005/02/20

On Feb 20, 2005, at 10:23 AM, Caio Tiago Oliveira wrote:

[#131880] Re: destructive! operations — Navindra Umanee <navindra@...> 2005/02/20

James Edward Gray II <james@grayproductions.net> wrote:

[#131929] Re: destructive! operations — Austin Ziegler <halostatue@...> 2005/02/21

On Mon, 21 Feb 2005 06:07:58 +0900, Navindra Umanee

[#131939] Re: destructive! operations — "Bill Kelly" <billk@...> 2005/02/21

From: "Christian Neukirchen" <chneukirchen@gmail.com>

[#131943] Re: destructive! operations — Christian Neukirchen <chneukirchen@...> 2005/02/21

"Bill Kelly" <billk@cts.com> writes:

[#131958] Re: destructive! operations — Pit Capitain <pit@...> 2005/02/21

Christian Neukirchen schrieb:

[#131964] Re: destructive! operations — Christian Neukirchen <chneukirchen@...> 2005/02/21

Pit Capitain <pit@capitain.de> writes:

[#131969] Re: destructive! operations — Pit Capitain <pit@...> 2005/02/21

Christian Neukirchen schrieb:

[#131973] Re: destructive! operations — Christian Neukirchen <chneukirchen@...> 2005/02/21

Pit Capitain <pit@capitain.de> writes:

[#131985] Re: destructive! operations — "ES" <ruby-ml@...> 2005/02/21

On Mon, February 21, 2005 6:07 pm, Christian Neukirchen said:

[#131988] Re: destructive! operations — Pit Capitain <pit@...> 2005/02/21

ES schrieb:

[#131940] ANN: 2005 International Obfuscated Ruby Code Contest (IORCC) — Todd Nathan <iorcc@...>

Dear Fellow Rubists,

39 messages 2005/02/21
[#132095] Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC) — "Josef 'Jupp' Schugt" <jupp@...> 2005/02/22

Todd Nathan wrote:

[#132102] Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC) — Yukihiro Matsumoto <matz@...> 2005/02/22

Hi,

[#132105] Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC) — "David A. Black" <dblack@...> 2005/02/22

Hi --

[#132107] Re: ANN: 2005 International Obfuscated Ruby Code Contest (IORCC) — Bill Guindon <agorilla@...> 2005/02/22

On Wed, 23 Feb 2005 08:23:08 +0900, David A. Black <dblack@wobblini.net> wrote:

[#132036] Proposal for nil, 0, and "" in an if statement — Dan Fitzpatrick <dan@...>

The following was derived from a portion of the destrutive! operations

38 messages 2005/02/22
[#132041] Re: Proposal for nil, 0, and "" in an if statement — David Heinemeier Hansson <david@...> 2005/02/22

> Here is a proposal for evaluating "", 0, and nil in an if statement:

[#132046] Re: Proposal for nil, 0, and "" in an if statement — Pit Capitain <pit@...> 2005/02/22

David Heinemeier Hansson schrieb:

[#132047] Re: Proposal for nil, 0, and "" in an if statement — Gavin Kistner <gavin@...> 2005/02/22

On Feb 22, 2005, at 6:41 AM, Pit Capitain wrote:

[#132053] Re: Proposal for nil, 0, and "" in an if statement — Gavin Kistner <gavin@...> 2005/02/22

On Feb 22, 2005, at 6:47 AM, Gavin Kistner wrote:

[#132054] Re: Proposal for nil, 0, and "" in an if statement — "David A. Black" <dblack@...> 2005/02/22

Hi --

[#132156] surprising: class A; end; A === A ==> false — Sam Roberts <sroberts@...>

I'm used to thinking of === being MORE useful

10 messages 2005/02/23

[#132186] Lighting the candles on the cake? — James Britt <jamesUNDERBARb@...>

Don't want to eat birthday cake too soon, but I know that someplace it's

12 messages 2005/02/24

[#132246] Simple HTML Renderer / Browser? — Randy Kramer <rhkramer@...>

I need a simple HTML renderer (to get started--eventually, I want to be able

18 messages 2005/02/24

[#132257] ruby-talk.com Expired? — James Edward Gray II <james@...>

I use http://ruby-talk.com/# style links on the Ruby Quiz site and I

13 messages 2005/02/24

[#132373] Ajax: A New Approach to Web Applications — "Curt Hibbs" <curt@...>

I always have trouble remembering whether its HttpXmlRequest, or

37 messages 2005/02/25
[#132379] Re: [OT] Ajax: A New Approach to Web Applications — "James G. Britt " <ruby.talk.list@...> 2005/02/25

On Sat, 26 Feb 2005 06:45:34 +0900, Curt Hibbs <curt@hibbs.com> wrote:

[#132382] Re: [OT] Ajax: A New Approach to Web Applications — "Curt Hibbs" <curt@...> 2005/02/25

James G. Britt wrote:

[#132375] Re: [OT] Ajax: A New Approach to Web Applications — PA <petite.abeille@...> 2005/02/25

[#132455] RubyGems 0.8.5 — Jim Weirich <jim@...>

= Announce: RubyGems Release 0.8.5

23 messages 2005/02/27
[#132525] RubyGems 0.8.6 (was Re: [ANN] RubyGems 0.8.5) — Chad Fowler <chadfowler@...> 2005/02/27

On Sun, 27 Feb 2005 10:34:34 +0900, Jim Weirich <jim@weirichhouse.org> wrote:

[#132500] Parsers vs. Homemade "Parsing" via REs — Randy Kramer <rhkramer@...>

I have the need to translate several megabytes of TWiki marked up text to

10 messages 2005/02/27

Re: RedCloth 3.0.2 -- Please, oh please, let this be the one

From: Thomas Counsell <tamc2@...>
Date: 2005-02-03 18:13:38 UTC
List: ruby-talk #129525
I've been wondering whether RedCloth is being stretched in too many 
directions?

On the one hand the use of gsubs! and big old regexps makes Redcloth 
very powerful and great for clever textile commands for writing 
beautiful books like _why's, but on the other they are really hard to 
get right for the 'big pages, but mostly trivial markup' of wikis.

I had a go at re-implementing textile to html conversion as a left to 
right parser using the Strscan library (code below or at 
http://www2.eng.cam.ac.uk/~tamc2/TextileParser.rb).  This, I think, 
manages the conversions mentioned in http://hobix.com/textile/ and 
doesn't stack overflow on big pages, but does not do all the amazing 
extra stuff that RedCloth actually does.   The downside, and the reason 
I haven't pursued it is that not only does it do less, it is also much 
much slower (should have been obvious in advance I guess).

Not sure where I'm going here, except to sympathise with _why that the 
problem is hard, and to share the code in case someone finds it useful 
or spots some way of getting a massive speed up.

Tom

PS The tabs and spaces, and the order of the attribute values in html, 
are different in TextileParser compared to Redcloth, so lots of the 
Redcloth tests fail on this even though they have the same syntactic 
meaning, others fail because TextileParser doesn't implement beyond 
http://hobix.com/textile/, and others just fail of course.

On 3 Feb 2005, at 17:32, Alexey Verkhovsky wrote:

> why the lucky stiff wrote:
>
>> I'm so glad this release is out.  I can let up my concerned look.  
>> What a relief.
>
> I'm sorry, but... still no go. But looks close.

require 'strscan'

# Note: Does not implement anything beyond that on 
http://hobix.com/textile/
# i.e. No markdown, link titles, and converting out of range ASCII
# AND IT IS MUCH SLOWER THAN REDCLOTH !!
#
# Bodged together in a few evenings by Tom Counsell (tamc2@cam.ac.uk)
# Feel free to do whatever you like with the code.
#
# Use is the same as for Redcloth (except that none of the options 
work):
# html = TextileParser.new( "textile string").to_html
#
class TextileParser
	
	# These are applied first
	BLOCK_COMMANDS = [
		[ /<pre.*?>/, :pre_tag ],
		[ /<code.*?>/, :code_tag ],
		[ /<notextile.*?>/, :notextile_tag ],
		[ /h(\d)(.*?)\.\s+/i, :heading_block ],
		[ /bq(.*?)\.\s+/i, :quote_block ],
		[ /(\*+|\#+)\s+/,  :list_block ],
		[ /table(.*?)\.\s+/i, :table_block ],
		[ /\|/i, :unspecified_table_block ],
		[ /\{.+?\}\.\s+\|/i, :unspecified_table_block ], # styled table 
row		
		[ /p(.*?)\.\s+/i, :paragraph_block ],
		[ /fn(\d+)(.*?)\.\s+/i, :footnote_block ],
		[ /\S+/i, :unspecified_block ],
		[ /\s+/i, :skip ],
	]
	
	# Then these
	COMMANDS = [
		[ /<pre.*?>/, :pre_tag ], # Can be inline as well as in a block
		[ /<code.*?>/, :code_tag ],  # Can be inline as well as in a block
		[ /<notextile.*?>/, :notextile_tag ],  # Can be inline as well as in 
a block
		[ /@(\S.*?\S)@/, :quick_escape_code ],
		[ /"(.+?)":(\S*\w\/?)/, :textile_link ],
		[ /\[(.+?)\]:(\S*\w\/?)/, :textile_link_alias ],
		[ /!(.+?)!(\S*)/, :image_link ],
		[ /([A-Z0-9]+)\((.*?)\)/, :acronym ],
		[ /(\S+?)\[(\d+)\]/, :footnote ]
	]	
	
	# Bit of a bodge, but need a different definition of phrase and 
whitespace in a table
	INLINE_COMMANDS = COMMANDS + [
		[ /\S+/i, :phrase ],
		[ /\s+/i, :space ],
	]
	
	TABLE_INLINE_COMMANDS = COMMANDS + [
		[ /[^\s\t\r\n\f\|]+/i, :phrase ],
		[ /\s+/i, :space ],
	]		
	
	# Then these are applied to phrases from above
	PHRASE_MODIFIERS = [
		[ '__', 'i' ],
		[ '**', 'b' ],
		[ '_', 'em' ],
		[ '*', 'strong' ],
		[ '??', 'cite' ],
		[ '-', 'del' ],
		[ '+', 'ins' ],
		[ '^', 'sup' ],
		[ '~', 'sub' ],
		[ '%', 'span' ], # How to avoid when people use % as in 3.0% growth?
		].collect! { |regexp,tag| [ /^#{Regexp.escape(regexp)}/, 
/#{Regexp.escape(regexp)}$/, tag ] }
			
	# Character substitutions done last to any words
	GLYPHS = [
		[ /^\'/, '&#8216;' ], # single opening
		[ /^"/, '&#8220;' ], # double opening
		[ /\'$/, '&#8217;' ], # single closing
        	[ /\"$/, '&#8221;' ], # double closing
         [ /\.{3}$/, '\1&#8230;' ], # ellipsis
         [ '--', '\1&#8212;' ], # em dash
         [ '->', ' &rarr; ' ], # right arrow
         [ '-$', ' &#8211; ' ], # en dash

         [ '(TM)', '&#8482;' ], # trademark
         [ '(R)', '&#174;' ], # registered
         [ '(C)', '&#169;' ] # copyright
     ]

	# This is just used to give the ouput html a more beautiful layout
	# All tags in here will get a newline after they are output
	# and the indent for following lines increased by the number
	INDENTING_TAGS = { 	'ul' => 1,
						'ol' => 1,
						'li' => 0,
						'blockquote' => 1,
						'table' => 1,
						'tr' => 1,
						'td' => 0,
						'th' => 0,
						'p' => 0,
					 }
	
	def initialize( text )
		@text = text
	end

	def to_html( settings = nil )
		reset
		convert_text
		return html.chomp.chomp # the tests don't have any trailing \ns
	end
	
	private
	
	## Methods dealing with blocks of text are called first
	
	def convert_text
		until @scanner.eos?
			send( BLOCK_COMMANDS.detect { |regexp, method| @scanner.scan( regexp 
) }[1] )
			add_to_html "\n" # Prettier html if extra space between blocks
		end
		insert_any_link_aliases
		html
	end
	
	# These are all the block commands
	
	def paragraph_block
		tag( 'p', parse_attributes( @scanner[1] ) ) do
			standard_paragraph
		end
	end
	
	def quote_block
		tag( "blockquote", parse_attributes( @scanner[1] ) ) do
			tag 'p' do
				standard_paragraph
			end
		end
	end
	
	def unspecified_block
		@scanner.unscan
		tag 'p' do
			standard_paragraph
		end
	end
		
	def heading_block
		tag( "h#{@scanner[1]}", parse_attributes( @scanner[2] ) ) do
			standard_line # Assume titles may only be on one line
		end
	end
	
	def list_block
		ordered = list_ordered? # See what sort of list we have
		depth = list_depth
		@scanner.unscan # So that the lines can be scanned individually
		tag( ordered ? 'ol' : 'ul' ) do
			list_line( ordered, depth ) until end_of_list?( depth )
		end
	end
	
	def table_block
		tag( 'table', parse_attributes( @scanner[1] ) ) do
			table_line until end_of_paragraph?
		end
	end
	
	def unspecified_table_block
		@scanner.unscan
		tag( 'table' ) do
			table_line until end_of_paragraph?
		end
	end
	
	def footnote_block
		number = @scanner[1]
		attributes = parse_attributes( @scanner[2] )
		attributes[:id] = "fn#{number}"
		tag 'p', attributes do
			add_to_html "<sup>#{number}</sup> "
			standard_line until end_of_paragraph?
		end
	end
	
	# Now descend into methods dealing with lines of text
	
	def pre_tag
		escape_tag 'pre'
	end
	
	def code_tag
		escape_tag 'code'
	end
	
	def notextile_tag
		escape_tag 'notextile', false
	end
	
	# This escapes until a matching close tag
	def escape_tag( tag, include_tag_in_output = true )
		add_to_html( @scanner.matched ) if include_tag_in_output
		level = 1
		while level > 0
			break unless @scanner.scan(/(.*?)(<(\/)?#{tag}.*?>)/m) # Breaks if 
no closing tag
			add_to_html( htmlesc( @scanner[1] || "" ) )
			level = level + ( @scanner[3] ? -1 : 1 )
			add_to_html( htmlesc( @scanner[2] ) ) unless level == 0
		end
		add_to_html "</#{tag}>" if include_tag_in_output
	end
	
	def quick_escape_code
		tag 'code' do
			add_to_html( htmlesc( @scanner[1] ) )
		end
	end
	
	def list_line( ordered, depth )
		tag 'li' do
			@scanner.scan(/(#+|\*+)\s+/)
			if ( list_ordered? == ordered ) && ( list_depth == depth )
				standard_line
			else # Recursive for sub lists
				list_block
			end
		end
	end
		
	def table_line
		# Are their row attributes at that start of the line?
		attributes = @scanner.scan(/(\{.+?\})\.\s+/) ? 
parse_attributes(@scanner[1]) : {} 	
		@scanner.scan(/\|/) # Get rid of any leading cell opening
		tag( 'tr', attributes ) do
			table_cell until end_of_table_line?
		end
	end	
	
	def standard_paragraph
		until end_of_paragraph?	
			send( INLINE_COMMANDS.detect { |regexp, method| @scanner.scan( 
regexp ) }[1] )
		end
	end
	
	def standard_line
		until end_of_line?
			send( INLINE_COMMANDS.detect { |regexp, method| @scanner.scan( 
regexp ) }[1] )
		end
	end
	
	# Now descend into methods dealing with phrases
	
	def table_cell
		# Style defined at start of cell ?
		attributes = @scanner.scan(/(_)?(\S*?)\.\s*/) ?  
parse_attributes(@scanner[2]) : {}
		tag( @scanner[1] ? 'th' : 'td', attributes) do
			until end_of_table_cell?
				send( TABLE_INLINE_COMMANDS.detect { |regexp, method| 
@scanner.scan( regexp ) }[1] )
			end	
		end
	end
	
	def footnote
		add_to_html "#{@scanner[1]}<sup><a 
href=\"#fn#{@scanner[2]}\">#{@scanner[2]}</a></sup>"
	end
	
	def acronym
		add_to_html "<acronym 
title=\"#{@scanner[2]}\">#{@scanner[1]}</acronym>"
	end
	
	def phrase
		word = @scanner.matched
		
		return add_to_html( parse_glyphs( word ) ) unless word =~ /\w+/ # If 
a word is entirely symbols then we will leave it in peace.
		
		# Open tags
		PHRASE_MODIFIERS.each do |start_r, end_r, tag|
			if word =~ start_r
				word = $' # The bit after the match
				# Look for matching brackets that indicate there are attributes
				if word =~ /(\(.+?\)|\{.+?\}|\[.+?\])/ 				
					open_tag( tag, parse_attributes( $1 ) )
					word = $'
				else
					open_tag tag
				end
				break
			end
		end
		
		# Close tags
		end_tag = nil
		PHRASE_MODIFIERS.each do |start_r, end_r, tag|
			if word =~ end_r
				end_tag = tag
				word = $` # The bit before the match
				break
			end
		end
		add_to_html parse_glyphs( word )
		close_tag( end_tag ) if end_tag
	end
	
	def space
		add_to_html @scanner.matched
	end
		
	def image_link
		@scanner.matched =~ /^!([<>]*)(.*?)(!|\((.*?)\)!)($|(:(.+?)$))/
		alignment, src, title, url = $1, $2, $4, $7
		attributes = {}
		attributes[:style] = 'float:right' if alignment == '>'
		attributes[:style] = 'float:left' if alignment == '<'

		attributes[:src] = src
		attributes[:alt] = attributes[ :title ] = title if title
		if url
			tag 'a', { :href => url } do
				open_tag 'img', attributes, true
			end
		else
			open_tag 'img', attributes, true
		end	
	end
	
	def skip
		# Do nothing !
	end
	
	def textile_link
		add_to_html "<a href=\"#{@scanner[2]}\">#{@scanner[1]}</a>"
	end
	
	def textile_link_alias
		# These are saved for later resubstitution
		@aliases[ @scanner[1] ] = @scanner[2]
	end
	
	# These feels clunky, and is done last
	def insert_any_link_aliases
		@aliases.each do |als, href|
			html.gsub!( /href="#{als}"/, "href=\"#{href}\"" )
		end
	end
	
	# These are helper methods that make sure html is properly closed and 
indented
	
	def tag( tag, attributes = {} )
		open_tag( tag, attributes )
		yield
		close_tag tag
	end
	
	def close_tag( tag = :all_tags )
		# Check the tag has been opened
		return unless open_tags.include?( tag ) || ( tag == :all_tags )
		
		# Close all tags up to that tag (in case one was not closed)
		until open_tags.empty?
			open_tag = open_tags.pop
			# This is just stuff to make the html look pretty
			if (indent = INDENTING_TAGS[ open_tag ] )
				if indent == 0
					add_to_html "</#{open_tag}>"
					add_to_html "\n"
				else
					add_to_html "\n" unless html =~ /\n$/
					@indent -= indent
					add_to_html( "\t" * @indent )
					add_to_html "</#{open_tag}>"
					add_to_html "\n"
				end
			else
				add_to_html "</#{open_tag}>"
			end
			return if open_tag == tag
		end
	end
	
	def open_tag( tag, attributes = {}, no_close_tag = false )
		add_to_html( "\t" * @indent )
		
		add_to_html "<#{tag}"
		
		attributes.each { |key, value| 	add_to_html( " 
#{key.to_s}=\"#{value.to_s}\"" )	}
		
		if no_close_tag
			add_to_html " />"
			return
		end
		
		add_to_html ">"
		
		if (indent = INDENTING_TAGS[ tag ] )			
			add_to_html "\n" unless indent == 0
			@indent += indent
		end
		open_tags << tag
	end
	
	def open_tags
		@open_tags ||= []
	end
	
	def parse_attributes( attribute_text )
		return {} unless attribute_text && attribute_text != ""
		a = { :style => "" }
		
		# The hand-entered classes, ids, styles and langs
		# These are replaced with "" so their content cannot be matched below
		a[:lang] = $1 if attribute_text =~ /\[(.+?)\]/
		a[:class] = $1 if attribute_text.sub!(/\((.+?)\)/,'')
		a[:class], a[:id] = $1, $2 if a[:class] =~  /^(.*?)#(.*)$/
		a[:style] << "#{$1};" if attribute_text.sub!(/\{(.+?)\}/,'')

		# Various padding and indents
		a[:style] << "padding-left:#{ $1.length }em;" if attribute_text =~ 
/(\(+)/
		a[:style] << "padding-right:#{ $1.length }em;" if attribute_text =~ 
/(\)+)/		

		# The various alignments
		a[:style] << "text-align:left;" if attribute_text =~ /<(?!>)/
		a[:style] << "text-align:right;" if attribute_text =~ /(?!<)>/
		a[:style] << "text-align:justify;" if attribute_text =~ /<>/
		a[:style] << "text-align:center;" if attribute_text =~ /=/
		
		#Various column spans on tables
		a[:colspan] = $1 if attribute_text =~ /\\(\d+)/
		a[:rowspan] = $1 if attribute_text =~ /\/(\d+)/
		
		#Vertical alignments on tables
		a[:style] << "vertical-align:top;" if attribute_text =~ /\^/
		a[:style] << "vertical-align:bottom;" if attribute_text =~ /\~/
		
		# Get rid of any empty attributes before returning
		a.delete_if { |k,v| !v || (v == "") }
	end
	
	def parse_glyphs( word )
		GLYPHS.each do |regexp,replacement|
			word.gsub!( regexp, replacement )
		end
		word
	end
	
	# Now some helper methods for spotting the ends of sections
	
	def end_of_paragraph?
		return true if @scanner.eos?
		@scanner.scan(/\n{2,}/)
	end
	
	def end_of_list?( depth )
		return true if @scanner.eos?
		return true unless @scanner.check(/(#+|\*+)\s+/) # Not a list any more
		return true if list_depth < depth # End of this sub list
		@scanner.scan(/\n{2,}/)
	end
	
	def end_of_line?
		return true if @scanner.eos?
		return true if @scanner.check(/\n{2,}/)
		@scanner.scan(/\n/)
	end
	
	def end_of_table_line?
		return true if @scanner.eos?
		return true if @scanner.check(/\n{2,}/)
		@scanner.scan(/\|\s*\n/)
	end
	
	def end_of_table_cell?
		return true if @scanner.eos?
		return true if @scanner.check(/\n/)
		return true if @scanner.check(/\|\s*\n/)
		@scanner.scan(/\|/)
	end
	
	# Now some random helper methods for decoding
	
	def list_ordered?
		@scanner.matched[0,1] == '#'
	end
	
	def list_depth
		@scanner[1].size
	end
	
	def htmlesc( str )
         str.gsub!( '&', '&amp;' )
         str.gsub!( '"', '&quot;' )
         str.gsub!( '<', '&lt;')
         str.gsub!( '>', '&gt;')
         str
     end
	
	# Now the low level matching functions
	
	def add_to_html( object )
		@html << object.to_s
	end
	
	def html
		@html
	end
	
	def reset
		@html, @scanner = "" , StringScanner.new( @text )
		@aliases = {}
		@indent = 0
	end	
end



In This Thread