Introducing MonoRail NHAML

Introduction

It is about four months passed since Joe Stagner activated my Blog on http://weblogs.asp.net. All that time I could not make a decision how to become a new community member, because the level of some other people here so impressive, that very hard to be notable. Some time ago I found very interesting project HAML. The idea behind this project is to make markup easy to read and fun to write. It very impressed me and I decided to implement View Engine for upcoming ASP.NET MVC Framework. Unfortunately (for me of course :)), it was already implemented by this guy. Not a problem! I simply decided to port Andrew’s work to the Castle Monorail (ASP.NET MVC elder brother) and extended Andrew’s work a bit.

Here is a result of my (and Andrew) work.

  1. Full HAML support – implemented by Andrew Peters
http://andrewpeters.net/2007/12/19/introducing-nhaml-an-aspnet-mvc-view-engine/ 
  1. MonoRail Layouts, Helpers, Partial Support
 MonoRail NHAML  

MonoRail NHAML

  1. Support for Macros, Parameters, Dictionaries, Rescues – you can even write c# in your View :)
   MonoRail NHAML

Source code and downloads

You can check out full code with samples form http://w4x.unfuddle.com/svn/w4x_mrnhamlUsername – user password – user 

Work is incomplete

There are many things that should be implemented – full test support, type cache for views, code clean up. If you are interested and want to implement such a feature – send me a patch for it :)

 

 

kick it on DotNetKicks.com
Published Monday, June 2, 2008 8:27 PM by w4x
Filed under: , ,

Comments

# re: Introducing MonoRail NHAML

Monday, June 2, 2008 3:10 PM by Андрей Гаевский

Олтичная идея, Сергей! Скачаю и обязательно помогу, чем смогу.

# re: Introducing MonoRail NHAML

Monday, June 2, 2008 7:54 PM by Victor Kornov

"send me a patch" link leads to a wrong place

# re: Introducing MonoRail NHAML

Tuesday, June 3, 2008 1:07 AM by w4x

@Victor

It's a joke :) stolen from Oren's blog.

# re: Introducing MonoRail NHAML

Tuesday, June 3, 2008 1:09 AM by w4x

@Андрей

Спасибо.

# re: Introducing MonoRail NHAML

Tuesday, June 3, 2008 2:53 AM by Pawel Tarnik

It's a great news, Sergey.

Indeed, Haml is very impressing and I'm glad that now it's available also on MonoRail.

Thanks a lot!!!

# re: Introducing MonoRail NHAML

Monday, June 9, 2008 3:45 PM by mxmissile

Spiceba!

# re: Introducing MonoRail NHAML

Wednesday, June 11, 2008 10:20 AM by Igor Loginov

Сергей!

Я в мае делал попытку собрать standalone версию NHaml (т.е. не привязанную к ASP.NET MVC). Споткнулся на передаче компилятору унаследованных типов и generics. Будет очень интересно посмотреть, как это сделал ты. Второй проблемой была низкая производительность подхода, основанного на CodeDom генерации. NVelocity выдавала мне те же результаты примерно в 10 раз быстрее даже с Production=true.

К моему сожалению, поучаствовать сейчас не смогу - завален работой. В блог буду регулярно заглядывать...

# re: Introducing MonoRail NHAML

Monday, June 16, 2008 1:13 AM by w4x

Hi Andrew!

Thanks for invitation.

Unfortunately your codegen uses c# 3.0 features and it is not an option for me. I've ported your code gen to 2.0, it was simple though :)

Or may be we introduce codegen settings?

Regards,

Sergey

# re: Introducing MonoRail NHAML

Monday, July 28, 2008 5:52 AM by Andrew Peters

Hi Mirvoda,

I just noticed that you don't support evaling of attributes e.g. href="foo"+"bar" - Is this by design?

Cheers,

Andrew.

# re: Introducing MonoRail NHAML

Monday, July 28, 2008 6:06 AM by w4x

Hi Andrew,

It is not by Design.

The last two month has been very busy.

I'll try to add this in a couple of days.

Or may be you suggest something?

I slowly moving towards to boo's code generation like in brail. Dynamic languages give more power. What do you think? Or may be write parser like in Spark?

Thanks,

Sergey