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 02, 2008 8:27 PM by w4x
Filed under: , ,

Comments

# NHAML on Monorail

Monday, June 02, 2008 1:23 PM by NHAML on Monorail

Pingback from  NHAML on Monorail

# re: Introducing MonoRail NHAML

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

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

# re: Introducing MonoRail NHAML

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

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

# re: Introducing MonoRail NHAML

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

@Victor

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

# re: Introducing MonoRail NHAML

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

@Андрей

Спасибо.

# re: Introducing MonoRail NHAML

Tuesday, June 03, 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!!!

# Introducing MonoRail NHAML

Tuesday, June 03, 2008 10:30 AM by DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# Haml for MonoRail

Friday, June 06, 2008 8:46 AM by Andre Loker

Haml for MonoRail

# re: Introducing MonoRail NHAML

Monday, June 09, 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

Sunday, June 15, 2008 7:35 PM by Andrew Peters

Hi Mirvoda,

The NHaml core is now a separate project at code.google.com/.../nhaml - Perhaps you would like to maintain your view engine here too?

Cheers,

Andrew.

# 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

# Moving from NVelocity to Brail

Thursday, July 10, 2008 11:58 PM by Patrick Steele's .NET Blog

I'm a big fan of Castle's Monorail -- an MVC implementation for ASP.NET. One of the nice things about

# Moving from NVelocity to Brail

Friday, July 11, 2008 12:05 AM by Patrick Steele

I'm a big fan of Castle's Monorail -- an MVC implementation for ASP.NET. One of the nice things

# 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

# re: Introducing MonoRail NHAML

Monday, July 28, 2008 10:28 PM by Andrew Peters

Hi Sergey,

Cool. The reason I ask is that I've moved the core stuff out of MVCContrib and over to http://code.google.com/p/nhaml. As part of this I've started looking at dropping back to a .NET 2 requirement with a view to incorporating your Monorail engine. As you probably noted, the 3.5 anonymous types make doing the attribute eval pretty straight-forward - hence me looking at your view engine to see how you were dealing with it :-)

I'm loath to do a parser but it seems we do need a reliable way of picking the attributes apart.

Cheers,

Andrew.

Leave a Comment

(required) 
(required) 
(optional)
(required)