These are chat archives for Antaris/RazorEngine

25th
Mar 2015
Anders
@brigs
Mar 25 2015 20:10
Hi. Just wanted to say cheers for putting in so much work on this project / library. I am currently testing it as an alternative to t4 templates
Matthias Dittrich
@matthid
Mar 25 2015 20:11
Hey, thanks and nice to hear :)
Sadly RazorEngine only shines for Html and XML (and xml can already be hard)...
Anders
@brigs
Mar 25 2015 20:15
I agree it's not an ideal fit, but it still feels vastly simpler than T4 in some cases
Matthias Dittrich
@matthid
Mar 25 2015 20:18
Ideally we would have Antaris/RazorEngine#223, which would improve this scenario a lot. But I don't think this will be implemented anytime soon :(
Anders
@brigs
Mar 25 2015 20:22
Looks interesting! Have you got any pointers to custom parser implementations ?
Ie. have any other projects done similar things with razor
Matthias Dittrich
@matthid
Mar 25 2015 20:28
Yes I have started to implement a custom one for F# but never manged to finish it... On this occasion I always looked into the html parser and actually implementing the <text></text> only parser should just be a matter of removing everything from the html parser, which is here: https://github.com/aspnet/Razor/blob/dev/src/Microsoft.AspNet.Razor/Parser/HtmlMarkupParser.cs
But I warn you it is a bit hard to get into this double parser thing initially
Anders
@brigs
Mar 25 2015 20:33
I can imagine :)
Anders
@brigs
Mar 25 2015 20:48
Just a thought about the "quick start" documentation, I get that you want it in the simplest form possible, but I think an actual sample of a a simle cshtml would be very nice to have there. What do you think?
Matthias Dittrich
@matthid
Mar 25 2015 20:54
Yeah the idea was that people using RazorEngine are already familiar with Razor itself... That could be wrong though.
Anders
@brigs
Mar 25 2015 21:02
I have used razor previously but a simple @model directive just didn't work for me
I googled and found an example (perhaps outdated)
let me show a gist
but then again, I haven't used Razor for years so I might be horribly mistaken :-D
Matthias Dittrich
@matthid
Mar 25 2015 21:08
K2Template must be in the hosting application, but the rest should work what's the exact problem?
Anders
@brigs
Mar 25 2015 21:12
Sorry I was a bit unprecise, what I pasted works just fine, but I was, perhaps very naively, expecting to just declare a model like this: @model MyNameSpace.MyModel
Matthias Dittrich
@matthid
Mar 25 2015 21:15
instead of @inherits? Yes that should work as well, but I personally always use @inherits because it works better with the Visual Studio designer...
Anders
@brigs
Mar 25 2015 21:16
yeah instead of, I always just used @model before
but as I said, I haven't really messed with razor since mvc3 so I'm really outdated
Anders
@brigs
Mar 25 2015 21:34
It seems @inherits is clearly preferred when outside of a web context anyway