Line Breaks in Webby
For the past few weeks, I’ve been using a tool called Webby for static html pages. Webby is a Ruby-based tool which produces static html pages based on templates you create. Think of it as using master pages in ASP.Net, except that the final product is files with a .html extension instead of .aspx (and you don’t get the asp.net processor kicking in each time this static page is called). It’s a great tool, because most of my sites need to have a consistent look and feel. I don’t want to copy html from one file to another and I can use a master page-like concept. And it gives me the chance to toy around with Ruby a little bit (but not much). In Webby, you create a layout page and the other pages as .txt files with html. Run the command “webby autobuild” in a command window and each time you make a change to any of the files, it will create a folder called output with all of your processed html pages. A problem I did have with the tool is that it was adding <br /> tags into my html where the line breaks where in my files. I absolutely hate it when something tries to inject html into my code. This is why I didn’t use Frontpage and won’t use tools like Dreamweaver. I know html is a lost art but . . . So, in my files, I would type
<p>I would type a paragraph that might be lengthy, so I use multiple lines in the code but don't expect the browser to interpret these. I just want it to look for the tags.</p>
What I got back in return was
<p>I would type a paragraph that might be <br />lengthy, so I use multiple lines in the code<br />but don't expect the browser to interpret these.<br />I just want it to look for the tags.</p><br />
It took me a few hours to figure out why this was happening (I couldn’t find anything on Google with a “BR tags in Webby” search). The problem is not with Webby, but with a tool called RedCloth, which Webby uses. Redcloth does the html processing with something called Textile. This is not a problem, but a feature in Redcloth from very 4 onwards. After searching for hours (and contemplating whether to just transfer everything to aspx pages), I found that Webby was automatically adding a “- textile” filter to all of the pages:
--- title: <%= title %>created_at: <%= Time.now.to_y %>filter: - erb - textile ---
The simple solution, was the remove the textfile flag from all pages. Remove the flag from the “templates/page.erb” file in the project and you should remove it from all pages in the project. Then you are master of all your html, my son. I hope this