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

10 Comments

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

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

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

  • @Андрей

    Спасибо.

  • 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!!!

  • Spiceba!

  • Сергей!

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

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

  • 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

  • Hi Mirvoda,

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

    Cheers,

    Andrew.

  • 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

Comments have been disabled for this content.