The calendar is gone.
Click here to view posts


Lazy site syntax
I use the wonderful gem call syntax to convert my ruby code to pretty html blocks. My biggest problem with this is that I wrote my own CRUD interface. I have no fancy helpers for formatting or links. I thought that ruby code formatting would be a good first start. As I thought about it some more why should I need to convert the ruby when I am creating the post. Why can't my code convert it when it displays it? Lets try it..

All I need to do is wrap my ruby code in a code tag
if data =~ /<code>.*<\/code>/m
	data.gsub!(/<code>.*<\/code>/m){|code|  code.gsub!(/<[\/]*code>/,""); cvert(code.strip)}
end

def cvert(string)
	convertor = Syntax::Convertors::HTML.for_syntax "ruby"
	return convertor.convert( string )
end


I Could have had the converter code not be its own method, but I plan on using cvert else where in code. I also want to be able to set type attributes in my code tags that can change the converter.