jlamfers/RazorMachine

MvcHtmlString and HtmlEncode

Closed this issue · 5 comments

It is possible for MvcHtmlString content to never be html encoded - or am I missing something?

Razormachine is fully MVC framework agnostic and does not know the MvcHtmlString type, It has its own LiteralString type.

OK thanks. I'm playing around and like what I see - starting to write a piece to replace our email templates which are stored in database and transformed by anon objects with a simple replace.

Which is horrible in so many ways.

Wondering if you could allow rootoperator to specified as an full url, so for emails, linking to css files works.

That way I can easily use same template for external usage and web browser.

I'm using viewbag for this currently, but would be nice to )use the root operator.

You could write and add a custom template provider (implementing ITemplateProvider) that maps any request to the corresponding template in your database, so you can keep your layouts in de database as well. Then you could create a (webapi) service that is requested with the template and the model (JSON?) and let that service respond with the razor machine result based on the requested url and the passed model.

Sorry when I said horrible - not the conversion but the current approach of our system.

I'm completed all the ground work, and it running very nicely - so thanks for your library.

The only slight issue is I'm writing code like this:

FAQ page

Where in my views it would be:
@Menu.Public_Faq.Link("Faq page") where this helper in the end calls Url.Content on the root operator.

But for emails I need to be able to resolve the root operator as an fully qualified url, however RazorMachine gives an error if path doesn't start with "/"

I'm not sure I fully understand your problem. If this problem still exists, could you give me some more context? Like what exactly is your source code, what exactly do you expect, en what is the exact (unexpected) result.