# Ruby in HTML

**URL:** <https://www.ruby-forum.com/t/ruby-in-html/136884>\
**Category:** Ruby\
**Created:** [May 7, 2008, 4:12am UTC](https://www.ruby-forum.com/t/ruby-in-html/136884 "2008-05-07T04:12:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 7, 2008, 4:12am UTC](https://www.ruby-forum.com/t/ruby-in-html/136884/1 "2008-05-07T04:12:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 7, 2008, 5:36am UTC](https://www.ruby-forum.com/t/ruby-in-html/136884/2 "2008-05-07T05:36:21Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 7, 2008, 9:21am UTC](https://www.ruby-forum.com/t/ruby-in-html/136884/3 "2008-05-07T09:21:04Z")

</div>

-----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](http://twitter.com/cynicalryan)  
Blog: [http://justarubyist.blogspot.com](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](http://enigmail.mozdev.org)

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

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [May 8, 2008, 7:13am UTC](https://www.ruby-forum.com/t/ruby-in-html/136884/4 "2008-05-08T07:13:08Z")

</div>

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’.  
[http://code.whytheluckystiff.net/hpricot/](http://code.whytheluckystiff.net/hpricot/)

enjoy,

-jeremy
