Musings about software development, agile methodologies, random thoughts, etc.       Bookmark and Share
Monday, June 26, 2006 - Re-writing and copying HTML files with Ruby
A personal goal of mine is to read through the Bible this year on a daily basis. To assist me in this I have an HTML file for each month of the year with links that call a JavaScript function passing the text-section value and then putting the value into a URL QueryString and opening a new window with the loaded URL. This worked OK but because the JavaScript opens a new window, the daily links were not showing with the visited style that I set in the CSS file. Here is where Ruby came in.

I thought about just rewriting the HTML but having to create 12 separate files, one for each month, was not what I wanted to do. Why not, as I am learning to use Ruby, use it to parse the existing HTML into a new file, a txt file in this case and then run script to rename the new into the old files, with links that use the traditional target attribute to open a new browser.

Click here to see what I did to parse the existing HTML files into TXT files.

Click here to see the copy of the TXT into HTML files.

posted by Mark McFadden @ 7:14 PM   0 comments
0 Comments:
<< Home
 

My Photo
Name: Mark McFadden
Location: Erlanger, Kentucky

I am a software developer that lives in Northern Kentucky with my wonderful wife.


This work is licensed under a Creative Commons Attribution 3.0 United States License. Creative Commons License

Site Feed

Previous Posts

Archives