Ruby in HTML

Hello,
I’ve been googling this, but with no concrete answers… Ruby 186-26 is
installed on my system - I was wondering if I could use Ruby in HTML
files that are just on my local machine. Thus far I’ve been
unsuccessful. I’d just like to do some reading of local files and
parsing then show it in the browser. Can I do this with Ruby? If so, any
suggestions as to how?

Thanks!

  • Jeff M.

On May 6, 2008, at 8:12 PM, Jeff M. wrote:

Hello,
I’ve been googling this, but with no concrete answers… Ruby 186-26
is
installed on my system - I was wondering if I could use Ruby in HTML
files that are just on my local machine. Thus far I’ve been
unsuccessful. I’d just like to do some reading of local files and
parsing then show it in the browser. Can I do this with Ruby? If so,
any
suggestions as to how?

Might you be looking for something like Webby?

http://webby.rubyforge.org/

It’s a tool for generating HTML files from other text files containing
markup (textile, markdown, haml, or HTML with embedded Ruby). It
includes the Heel webserver for displaying local pages after they are
rendered. Read through the Webby tutorial and see if that meets your
needs.

Blessings,
TwP

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff M. wrote:
| Hello,
| I’ve been googling this, but with no concrete answers… Ruby 186-26 is
| installed on my system - I was wondering if I could use Ruby in HTML
| files that are just on my local machine. Thus far I’ve been
| unsuccessful. I’d just like to do some reading of local files and
| parsing then show it in the browser. Can I do this with Ruby? If so, any
| suggestions as to how?

Rails and Merb are probably the easiest way to get started.

Otherwise, look for ERb or eruby, and you might want to try your hand at
mod_ruby (which is ok to run one concurrent instance of Ruby, it might
get interesting with more than one).


Phillip G.
Twitter: twitter.com/cynicalryan
Blog: http://justarubyist.blogspot.com

Write and test a big program in small pieces.
~ - The Elements of Programming Style (Kernighan & Plaugher)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkghWCgACgkQbtAgaoJTgL/xfgCfd8UQkeaBfEZUBicubpjZykQQ
rzUAoI2Izio17nx7eDjwjDGVDrv8VVbE
=wlJn
-----END PGP SIGNATURE-----

On Wed, May 07, 2008 at 11:12:56AM +0900, Jeff M. wrote:

Hello,
I’ve been googling this, but with no concrete answers… Ruby 186-26 is
installed on my system - I was wondering if I could use Ruby in HTML
files that are just on my local machine. Thus far I’ve been
unsuccessful. I’d just like to do some reading of local files and
parsing then show it in the browser. Can I do this with Ruby? If so, any
suggestions as to how?

Do you mean use ruby to serve the local html files to your browser?
This can be
accomplished with the ‘heel’ gem.

gem install heel

heel -r directory/to/html/files

If you mean parse the html files and extract information from them, you
would
probably want to look at ‘hpricot’.

enjoy,

-jeremy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs