Eruby editor

Hello. I was wondering if anyone knows of a text editor which will
perform syntax highlighting correctly for eruby/html code. I’m looking
for something similar to the way PHP/html is handled by vim. Thanks.

Kyle

Dear Colleagues,

I am pretty much a ruby newbie – just wrote my first non-toy program. I
am having a good time with it!

I have a fairly new Mandrake distribution(8.2). Here is the contents of
/usr/lib/ruby/1.6/i586-linux-gnu:
curses.so etc.so gdk_imlib.so gtk.so rbconfig.rb socket.so
digest fcntl.so gdk_pixbuf.so nkf.so readline.so syslog.so
digest.so gdbm.so gnome.so pty.so sdbm.so

You will note that it does not contain tk.so. I do have tk installed,
mostly in /usr/lib/tk8.3/, and e.g. ‘wish’ runs fine.

Is there someplace to get ‘tk.so’ for ruby? I have googled, to no avail.
Or is it possible for someone to Attach their tk.so to an E-mail?

The command “ruby --version” on my system yields
ruby 1.6.6 (2001-12-26) [i586-linux-gnu]

Any help/suggestions much appreciated. And the usual humble apologies
if this query should turn out to be a FAQ!

Best wishes,

Alan

···


Alan McConnell : http://patriot.net/users/alan
Just accept the fact that things are back to their natural order, with
employers holding the whip hand.(Business Section, WashPost, 30 Jan 01)

Hello. I was wondering if anyone knows of a text editor which will
perform syntax highlighting correctly for eruby/html code. I’m looking
for something similar to the way PHP/html is handled by vim. Thanks.

I don’t know if one exists already, but I’d imagine that you need to
create an rhtml vim syntax file for these pages, which could be done by
combining the ruby syntax file with the html syntax file. I suspect
that it will be a fairly big job, though. Then I think you need to
look at how vim determines the file type so that it can pick up the
.rhtml file and recognise it correctly.

I don’t know much about writing syntax files, but if you find a way
to escape out of one syntax and into another I think it would be
very useful, for rhtml and for shellscripts with things like ruby -e
program, or sed -e program, or perl -e program, so that the program
can be highlighted correctly.

Kyle

    Hugh
···

On Fri, 16 Aug 2002, Kyle Wilson wrote:

I’m not exactly sure of your environment, but you should give NEdit a look.
It has a downloadable Ruby module that’s pretty good. Also php and html
modules. And it allows you to build customized modules starting from any one
you feel like (or, if you prefer, start from scratch).

···

On Thursday 15 August 2002 11:21, you wrote:

Hello. I was wondering if anyone knows of a text editor which will
perform syntax highlighting correctly for eruby/html code. I’m looking
for something similar to the way PHP/html is handled by vim. Thanks.

Kyle

Alan McConnell wrote:

I have a fairly new Mandrake distribution(8.2). Here is the contents of
/usr/lib/ruby/1.6/i586-linux-gnu:
curses.so etc.so gdk_imlib.so gtk.so rbconfig.rb socket.so
digest fcntl.so gdk_pixbuf.so nkf.so readline.so syslog.so
digest.so gdbm.so gnome.so pty.so sdbm.so

You will note that it does not contain tk.so. I do have tk installed,
mostly in /usr/lib/tk8.3/, and e.g. ‘wish’ runs fine.

Is there someplace to get ‘tk.so’ for ruby? I have googled, to no avail.

For Mandrake Linux, I think you want to install the “ruby-tk” RPM. You
can probably find it on the Mandrake CD-ROM(s) or their ftp site;
otherwise, just check an RPM search site (like http://rpmfind.net).

Hi,

···

In message “Where is tk.so?” on 02/08/16, Alan McConnell alan@patriot.net writes:

Is there someplace to get ‘tk.so’ for ruby? I have googled, to no avail.
Or is it possible for someone to Attach their tk.so to an E-mail?

“tk” is “tk.rb”, which depends on “tcltklib.so” and “tkutil.so”. It
seems you need to install extra package to use Ruby/Tk. I’m a Debian
user, so I have no further knowledge about Mandrake Linux.

						matz.

Not looking for a vi vs emacs flamewar here, but emacs also has
mmm-mode which allows you to embed any major emacs mode into
another, using regexps to toggle between regions. I’ve been
using it quite happily.

···

On Fri, Aug 16, 2002 at 09:53:02PM +0900, Hugh Sasse Staff Elec Eng wrote:

On Fri, 16 Aug 2002, Kyle Wilson wrote:

Hello. I was wondering if anyone knows of a text editor which will
perform syntax highlighting correctly for eruby/html code. I’m looking
for something similar to the way PHP/html is handled by vim. Thanks.

I don’t know if one exists already, but I’d imagine that you need to
create an rhtml vim syntax file for these pages, which could be done by
combining the ruby syntax file with the html syntax file. I suspect
that it will be a fairly big job, though. Then I think you need to
look at how vim determines the file type so that it can pick up the
.rhtml file and recognise it correctly.

I don’t know much about writing syntax files, but if you find a way
to escape out of one syntax and into another I think it would be
very useful, for rhtml and for shellscripts with things like ruby -e
program, or sed -e program, or perl -e program, so that the program
can be highlighted correctly.


Alan Chen
Digikata LLC

Thanks for the responses. I actually thought about creating syntax
files for gvim, but I really wouldn’t know where to start. Plus, I
think I’d rather just spend the time working on my project with eruby
without the highlighting!

Kyle

Alan Chen wrote:

···

On Fri, Aug 16, 2002 at 09:53:02PM +0900, Hugh Sasse Staff Elec Eng wrote:

On Fri, 16 Aug 2002, Kyle Wilson wrote:

Hello. I was wondering if anyone knows of a text editor which will
perform syntax highlighting correctly for eruby/html code. I’m looking
for something similar to the way PHP/html is handled by vim. Thanks.

I don’t know if one exists already, but I’d imagine that you need to
create an rhtml vim syntax file for these pages, which could be done by
combining the ruby syntax file with the html syntax file. I suspect
that it will be a fairly big job, though. Then I think you need to
look at how vim determines the file type so that it can pick up the
.rhtml file and recognise it correctly.

I don’t know much about writing syntax files, but if you find a way
to escape out of one syntax and into another I think it would be
very useful, for rhtml and for shellscripts with things like ruby -e
program, or sed -e program, or perl -e program, so that the program
can be highlighted correctly.

Not looking for a vi vs emacs flamewar here, but emacs also has
mmm-mode which allows you to embed any major emacs mode into
another, using regexps to toggle between regions. I’ve been
using it quite happily.

I had a sudden burst of inspiration, and managed to create such a
syntax file in 2 minutes. (I don’t even know how to write vim syntax
files! laugh)

All I did was take “aspperl.vim”, which is what you want except that
it uses Perl, and replace every occurance of ‘perl’ with ‘ruby’ and it
worked. :slight_smile:

Here’s the attached file.

aspruby.vim (1016 Bytes)

···

On Sat, Aug 17, 2002 at 07:00:49AM +0900, Kyle Wilson wrote:

Thanks for the responses. I actually thought about creating syntax
files for gvim, but I really wouldn’t know where to start. Plus, I
think I’d rather just spend the time working on my project with eruby
without the highlighting!

SWEEEEET!! Thanks. I’ll give it a try.

Kyle

Philip Mak wrote:

···

On Sat, Aug 17, 2002 at 07:00:49AM +0900, Kyle Wilson wrote:

Thanks for the responses. I actually thought about creating syntax
files for gvim, but I really wouldn’t know where to start. Plus, I
think I’d rather just spend the time working on my project with eruby
without the highlighting!

I had a sudden burst of inspiration, and managed to create such a
syntax file in 2 minutes. (I don’t even know how to write vim syntax
files! laugh)

All I did was take “aspperl.vim”, which is what you want except that
it uses Perl, and replace every occurance of ‘perl’ with ‘ruby’ and it
worked. :slight_smile:

Here’s the attached file.


" Vim syntax file
" Language: Active State’s PerlScript (ASP)
" Maintainer: Aaron Hope edh@brioforge.com
" URL: http://nim.dhs.org/~edh/aspperl.vim
" Last Change: 2001 May 09

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists(“b:current_syntax”)
finish
endif

if !exists(“main_syntax”)
let main_syntax = 'rubyscript’
endif

if version < 600
so :p:h/html.vim
syn include @AspPerlScript :p:h/ruby.vim
else
runtime! syntax/html.vim
unlet b:current_syntax
syn include @AspPerlScript syntax/ruby.vim
endif

syn cluster htmlPreproc add=AspPerlScriptInsideHtmlTags

syn region AspPerlScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<%==+ skip=+".%>."+ end=+%>+ contains=@AspPerlScript
syn region AspPerlScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<script\s+language="=rubyscript"=[^>]*>+ end=++ contains=@AspPerlScript

let b:current_syntax = “aspruby”

Philip,

The eruby syntax hack works great for me. Thanks again. You should
submit this to the vim maintainers and see if they will add it to the
next release. If nothing else, you might get your name in some credits!

Kyle

Philip Mak wrote:

···

On Sat, Aug 17, 2002 at 07:00:49AM +0900, Kyle Wilson wrote:

Thanks for the responses. I actually thought about creating syntax
files for gvim, but I really wouldn’t know where to start. Plus, I
think I’d rather just spend the time working on my project with eruby
without the highlighting!

I had a sudden burst of inspiration, and managed to create such a
syntax file in 2 minutes. (I don’t even know how to write vim syntax
files! laugh)

All I did was take “aspperl.vim”, which is what you want except that
it uses Perl, and replace every occurance of ‘perl’ with ‘ruby’ and it
worked. :slight_smile:

Here’s the attached file.


" Vim syntax file
" Language: Active State’s PerlScript (ASP)
" Maintainer: Aaron Hope edh@brioforge.com
" URL: http://nim.dhs.org/~edh/aspperl.vim
" Last Change: 2001 May 09

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists(“b:current_syntax”)
finish
endif

if !exists(“main_syntax”)
let main_syntax = 'rubyscript’
endif

if version < 600
so :p:h/html.vim
syn include @AspPerlScript :p:h/ruby.vim
else
runtime! syntax/html.vim
unlet b:current_syntax
syn include @AspPerlScript syntax/ruby.vim
endif

syn cluster htmlPreproc add=AspPerlScriptInsideHtmlTags

syn region AspPerlScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<%==+ skip=+".%>."+ end=+%>+ contains=@AspPerlScript
syn region AspPerlScriptInsideHtmlTags keepend matchgroup=Delimiter start=+<script\s+language="=rubyscript"=[^>]*>+ end=++ contains=@AspPerlScript

let b:current_syntax = “aspruby”

Here’s what I have - 91 characters with everything you’d need for a Flash
XMLSocket ‘echo’ server::

Not pretty version -
require
"socket";s=TCPServer.open(“10.0.0.2”,4444).accept;loop{;s.gets("\0");s.write
($_);};

Pretty version -
require “socket"
s=TCPServer.open(“10.0.0.2”,4444).accept
loop{
s.gets(”\0")
s.write($_)
}

Looking at it now - maybe I could::

require "socket"
    s=TCPServer.open("10.0.0.2",4444).accept
    loop{
        s.gets("\0").write($_)
    }

Then I thought I remembered reading somewhere about something like -
TCPServer.open(0)

Where that code would listen on ‘all devices’… if I’m making any sense…
But then how could I specify the port??

Thanks for any help I can get! : )

-Rich
P.s. - Since I came from a Perl-ish background… the ‘short’ perl version
was 300 characters…

This is very cool.

The code you are looking for is TCPServer.open(“0.0.0.0”,4444)

That listens on all devices.

BTW: I just joined this project:

http://freemovie.sourceforge.net

to get the Ruby library up to the current PHP reference implementation.
This will allow us to generate .swf files from a pure Ruby script.

I think that flash/actionscript and ruby (as the backend) would ROCK.

-rich

From: Rich [mailto:rich@lithinos.com]
Sent: Friday, August 16, 2002 6:20 PM
To: ruby-talk ML
Subject: Flash socket server - can I make it any shorter??

Here’s what I have - 91 characters with everything you’d need for a
Flash
XMLSocket ‘echo’ server::

Not pretty version -
require

“socket”;s=TCPServer.open(“10.0.0.2”,4444).accept;loop{;s.gets("\0");s.w
ri

te
($_);};

Pretty version -
require “socket"
s=TCPServer.open(“10.0.0.2”,4444).accept
loop{
s.gets(”\0")
s.write($_)
}

Looking at it now - maybe I could::

require "socket"
    s=TCPServer.open("10.0.0.2",4444).accept
    loop{
        s.gets("\0").write($_)
    }

Then I thought I remembered reading somewhere about something like -
TCPServer.open(0)

Where that code would listen on ‘all devices’… if I’m making any
sense…
But then how could I specify the port??

Thanks for any help I can get! : )

-Rich
P.s. - Since I came from a Perl-ish background… the ‘short’ perl
version

···

-----Original Message-----
was 300 characters…

I’ve looked into the lists that are around for things like FreeMovie /
ming…

They aren’t where I’d like them to be, so I’m going a different route.

Plus, I’ve never been a fan of doing it all with one tool… oh well.

In any case - there’s so much potential for applications with Flash on the
front-end and Ruby on the back-end that I often can’t go to sleep at
night…

work() { | thought | SWF(thought) + RB(thought) == insomnia }

; )

Thanks for the comments!!

-Rich
P.s. - Funny how we sign our emails the same!! This could get confusing…
: )

···

----- Original Message -----
From: “Rich Kilmer” rich@infoether.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, August 18, 2002 11:50 AM
Subject: RE: Flash socket server - can I make it any shorter??

This is very cool.

The code you are looking for is TCPServer.open(“0.0.0.0”,4444)

That listens on all devices.

BTW: I just joined this project:

http://freemovie.sourceforge.net

to get the Ruby library up to the current PHP reference implementation.
This will allow us to generate .swf files from a pure Ruby script.

I think that flash/actionscript and ruby (as the backend) would ROCK.

-rich

“Rich Kilmer” rich@infoether.com wrote in message news:000c01c246df$7e622dd0$3301a8c0@TECHNO

I think that flash/actionscript and ruby (as the backend) would ROCK.

no doubt, this is exciting…

Is there a good reference for flash / xml integration? This is the
most interesting angle on web client / server I’ve seen in a while.

~ Patrick

From: Rich [mailto:rich@lithinos.com]
Sent: Sunday, August 18, 2002 5:17 PM
To: ruby-talk ML
Subject: Re: Flash socket server - can I make it any shorter??

I’ve looked into the lists that are around for things like FreeMovie /
ming…

They aren’t where I’d like them to be, so I’m going a different route.

Plus, I’ve never been a fan of doing it all with one tool… oh well.

Absolutely agree. My idea is to be able to write your Flash UI in
ActionScript and compile it w/Ruby to an SWF file. Flash MX finally
brings you the full capabilities of Flash graphics programming to
ActionScript. Not to say that using the GUI to create things is bad, I
would just rather use the command line :wink:

In any case - there’s so much potential for applications with Flash on
the
front-end and Ruby on the back-end that I often can’t go to sleep at
night…

I am absolutely right there with you. What are your thoughts along this
line? Are you thinking of a general purpose XMLSocket driven UI
w/widgets/events etc? I too have lost some sleep contemplating this.

-Rich
P.S. This should not be an issue unless one of use is used to talking to
himself :wink:

work() { | thought | SWF(thought) + RB(thought) == insomnia }

; )

Thanks for the comments!!

-Rich
P.s. - Funny how we sign our emails the same!! This could get
confusing…
: )

From: “Rich Kilmer” rich@infoether.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, August 18, 2002 11:50 AM
Subject: RE: Flash socket server - can I make it any shorter??

This is very cool.

The code you are looking for is TCPServer.open(“0.0.0.0”,4444)

That listens on all devices.

BTW: I just joined this project:

http://freemovie.sourceforge.net

to get the Ruby library up to the current PHP reference
implementation.

This will allow us to generate .swf files from a pure Ruby script.

I think that flash/actionscript and ruby (as the backend) would
ROCK.

···

-----Original Message-----
----- Original Message -----

-rich

I’m used to it!! Me too!! lol

Yeah - I’m coding out the Flash and Ruby sides of communication.

XMLSockets to transfer everything…

I guess I should get around to putting it out on the net when it get’s
’stable’.

The only thing I want to be able to change in the already-compiled-swf is
the stage size. Unfotunately Stage._height and Stage._width are read-only
properties, so I’d have to isolate the part of the SWF that I need to
change… shouldn’t be too hard, I just haven’t looked at it yet… If the
developer could set the stage height, there shouldn’t be any
’user-interaction’ related thing they can’t do with Flash, and there
shouldn’t be any ‘functional-related’ thing they can’t do with Ruby.

Anyway - like I said, I’m working on it… I’ll try to keep you updated,
which should be easy, since I’ll probably have questions now and then.

( I’m thinkin’ of calling it “FUI” Flash User Interface…)
Other FUI’s include - Fingerprint User Identification… Functional User
Interface (for showing functions)… and others, but no Flash User
Interface…

-Rich

···

----- Original Message -----
From: “Rich Kilmer” rich@infoether.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Sunday, August 18, 2002 3:39 PM
Subject: RE: Flash socket server - can I make it any shorter??

-----Original Message-----
From: Rich [mailto:rich@lithinos.com]
Sent: Sunday, August 18, 2002 5:17 PM
To: ruby-talk ML
Subject: Re: Flash socket server - can I make it any shorter??

I’ve looked into the lists that are around for things like FreeMovie /
ming…

They aren’t where I’d like them to be, so I’m going a different route.

Plus, I’ve never been a fan of doing it all with one tool… oh well.

Absolutely agree. My idea is to be able to write your Flash UI in
ActionScript and compile it w/Ruby to an SWF file. Flash MX finally
brings you the full capabilities of Flash graphics programming to
ActionScript. Not to say that using the GUI to create things is bad, I
would just rather use the command line :wink:

In any case - there’s so much potential for applications with Flash on
the
front-end and Ruby on the back-end that I often can’t go to sleep at
night…

I am absolutely right there with you. What are your thoughts along this
line? Are you thinking of a general purpose XMLSocket driven UI
w/widgets/events etc? I too have lost some sleep contemplating this.

-Rich
P.S. This should not be an issue unless one of use is used to talking to
himself :wink: