RejectedSoftware Forums

Sign up

Diet Templates extends not working as I'd expect

Hi everyone,

I'm trying to use the diet templates, and in particular the extends function; however I think I'm doing something wrong. My index.dt file is set up like this:

//- index.dt
extends template
block pageContent
h1	Hello, World!
p This is a diet template generated page

When I go to this page however I get the following HTML:

<extends>template</extends>
<h1>	Hello, World!</h1>
<p>This is a diet template generated page</p>

template.dt does exist in the views folder, and does contain a block pageContent.

Did I do anything obviously wrong? I can't seem to find documentation for this, and the forum searches I found regarding this are essentially what I'm doing already.

Re: Diet Templates extends not working as I'd expect

Forgot to mention:

I'm using:

  • DMD 2.067
  • DUB 0.9.22
  • "vibe-d": "~>0.7.19"

Re: Diet Templates extends not working as I'd expect

On Fri, 17 Apr 2015 18:32:08 GMT, Charles wrote:

Forgot to mention:

I'm using:

  • DMD 2.067
  • DUB 0.9.22
  • "vibe-d": "~>0.7.19"

Changed dub.json to "vibe-d": "~>0.7.23", and still experiencing the same issue. Sorry about the triple post (is their an edit button?)

Re: Diet Templates extends not working as I'd expect

Am 17.04.2015 um 20:27 schrieb Charles:

Hi everyone,

I'm trying to use the diet templates, and in particular the extends function; however I think I'm doing something wrong. My index.dt file is set up like this:

 //- index.dt
 extends template
 block pageContent
h1	Hello, World!
p This is a diet template generated page

When I go to this page however I get the following HTML:

 <extends>template</extends>
 <h1>	Hello, World!</h1>
 <p>This is a diet template generated page</p>

template.dt does exist in the views folder, and does contain a block pageContent.

Did I do anything obviously wrong? I can't seem to find documentation for this, and the forum searches I found regarding this are essentially what I'm doing already.

The problem lies in the comment at the top. Not sure how Jade handles
this, if it works there, the Diet compiler should be fixed accordingly.
But currently comments are only allowed inside of blocks or normal
templates.

Re: Diet Templates extends not working as I'd expect

On Fri, 17 Apr 2015 20:50:27 +0200, Sönke Ludwig wrote:

The problem lies in the comment at the top. Not sure how Jade handles
this, if it works there, the Diet compiler should be fixed accordingly.
But currently comments are only allowed inside of blocks or normal
templates.

I can confirm that removing the comment fixed this. Jade's language reference at least insinuates this should work. http://jade-lang.com/reference/extends/

Re: Diet Templates extends not working as I'd expect

On Fri, 17 Apr 2015 18:56:52 GMT, Charles wrote:

On Fri, 17 Apr 2015 20:50:27 +0200, Sönke Ludwig wrote:

The problem lies in the comment at the top. Not sure how Jade handles
this, if it works there, the Diet compiler should be fixed accordingly.
But currently comments are only allowed inside of blocks or normal
templates.

I can confirm that removing the comment fixed this. Jade's language reference at least insinuates this should work. http://jade-lang.com/reference/extends/

Okay, I've opened a ticket for this: #1073