New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diet attribute names can't contain $ #1554

Closed
WebFreak001 opened this Issue Aug 26, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@WebFreak001
Contributor

WebFreak001 commented Aug 26, 2016

This causes the diet compiler to throw an exception:

a(href$="/list/[[list]]")
    button test

This is annoying when using libraries like polymer where some reserved dynamic attributes are marked with a $ at the end. Right now I need to use this workaround:

| <a href$="/list/[[list]]">
    button test
| </a>
@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Aug 26, 2016

Member

I think it should work with diet-ng, which I would recommend to use nowadays (use the latest vibe.d alpha + add a dependency to diet-ng in the main project).

Member

s-ludwig commented Aug 26, 2016

I think it should work with diet-ng, which I would recommend to use nowadays (use the latest vibe.d alpha + add a dependency to diet-ng in the main project).

@WebFreak001

This comment has been minimized.

Show comment
Hide comment
@WebFreak001

WebFreak001 Aug 26, 2016

Contributor

gonna try when im back at work

Contributor

WebFreak001 commented Aug 26, 2016

gonna try when im back at work

@WebFreak001

This comment has been minimized.

Show comment
Hide comment
@WebFreak001

WebFreak001 Sep 1, 2016

Contributor

I don't think its much better there. Now I get a lot of problems about my inline javascript code and the error messages have just gotten much worse to read. This is the error log now:

Compiling Diet HTML template register.dt...
Compiling Diet HTML template register-done.dt...
Compiling Diet HTML template register.dt...
Compiling Diet HTML template login.dt...
Compiling Diet HTML template login.dt...
Compiling Diet HTML template firstauth.dt...
Compiling Diet HTML template firstauth.dt...
Compiling Diet HTML template firstauth.dt...
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(558,9): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(570,20): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(576,9): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(581,20): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(593,24): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(618,37): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(642,33): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(480,16): Error: template instance app.RTPService.postFirstauth.render!("firstauth.dt", error).render!("app", "app.RTPService.postFirstauth").render.parseDie
t!(translate).parseDiet.MapResult!(__lambda2, InputFile[]) error instantiating
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(65,33):        instantiated from here: map!(InputFile[])
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(61,84):        instantiated from here: parseDiet!(translate)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,3):        instantiated from here: compileHTMLDietFile!("firstauth.dt", req, error)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("firstauth.dt", req, error)
source\app.d(222,11):        instantiated from here: render!("app", "app.RTPService.postFirstauth")
Compiling Diet HTML template polymer.dt...
Compiling Diet HTML template dashboard.dt...
dashboard.dt(27,20): Error: function app.TemplateFiles.getTemplate_dashboard.render!("dashboard.dt", _user).render!("app", "app.TemplateFiles.getTemplate_dashboard").render.filter!(req, _user).filter (const(char[]) input, string filter
, void delegate(const(char[])) nothrow @safe output) is not callable using argument types (string, string, void)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(84,7): Error: template instance app.TemplateFiles.getTemplate_dashboard.render!("dashboard.dt", _user).render!("app", "app.TemplateFiles.getTemplate_das
hboard").render.compileHTMLDietFile!("dashboard.dt", req, _user).exec!(StreamOutputRange) error instantiating
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,47):        instantiated from here: compileHTMLDietFile!(StreamOutputRange)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("dashboard.dt", req, _user)
source\app.d-mixin-927(927,84):        instantiated from here: render!("app", "app.TemplateFiles.getTemplate_dashboard")
Compiling Diet HTML template list.dt...
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\defs.d(34,3): Error: "list.dt(39): Expected node text separated by a space character or end of line, but got '<'."
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(935,12):        called from here: enforcep(strip(remainder).length == 0u, delegate string() => "Expected node text separated by a space character or e
nd of line, but got '" ~ remainder ~ "'.", loc)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(862,38):        called from here: parseTagLine(input, loc, has_nested)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(65,76):        called from here: parseDietRaw(f)
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(581,19):        called from here: __lambda2(front(this._input))
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(105,9):        called from here: __r7356.front()
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(65,81):        called from here: array(map(files))
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(61,84):        called from here: parseDiet([InputFile("list.dt", "MY DIET TEMPLATE")]))
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(62,46):        called from here: _diet_nodes()
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(62,34):        called from here: getHTMLMixin(_diet_nodes(), "_diet_output")
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,3): Error: template instance app.TemplateFiles.getTemplate_list.render!("list.dt", _user).render!("app", "app.TemplateFiles.getTemplate_list")
.render.compileHTMLDietFile!("list.dt", req, _user) error instantiating
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("list.dt", req, _user)
source\app.d-mixin-928(928,74):        instantiated from here: render!("app", "app.TemplateFiles.getTemplate_list")
Compiling Diet HTML template color-selector.dt...
color-selector.dt(15,20): Error: function app.TemplateFiles.getTemplate_colorSelector.render!("color-selector.dt", _user).render!("app", "app.TemplateFiles.getTemplate_colorSelector").render.filter!(req, _user).filter (const(char[]) in
put, string filter, void delegate(const(char[])) nothrow @safe output) is not callable using argument types (string, string, void)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(84,7): Error: template instance app.TemplateFiles.getTemplate_colorSelector.render!("color-selector.dt", _user).render!("app", "app.TemplateFiles.getTem
plate_colorSelector").render.compileHTMLDietFile!("color-selector.dt", req, _user).exec!(StreamOutputRange) error instantiating
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,47):        instantiated from here: compileHTMLDietFile!(StreamOutputRange)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("color-selector.dt", req, _user)
source\app.d-mixin-929(929,93):        instantiated from here: render!("app", "app.TemplateFiles.getTemplate_colorSelector")
Compiling Diet HTML template time-picker.dt...
time-picker.dt(11,20): Error: function app.TemplateFiles.getTemplate_timePicker.render!("time-picker.dt", _user).render!("app", "app.TemplateFiles.getTemplate_timePicker").render.filter!(req, _user).filter (const(char[]) input, string
filter, void delegate(const(char[])) nothrow @safe output) is not callable using argument types (string, string, void)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(84,7): Error: template instance app.TemplateFiles.getTemplate_timePicker.render!("time-picker.dt", _user).render!("app", "app.TemplateFiles.getTemplate_
timePicker").render.compileHTMLDietFile!("time-picker.dt", req, _user).exec!(StreamOutputRange) error instantiating

These scripts are breaking it:

:javascript
    Polymer({
        is: "module-name"
    });

but because there are so many of them and they are most of the time just 3-5 lines I don't want to put them into separate files. Also it seems that there is some internal error in diet-ng which is right at the top of the error log.

I don't think its fixed though because there is also an issue in this line:

a(href$="/list/[[listid]]/settings")><
    paper-fab-menu-item(label="List Settings", icon="settings")

Also the workaround doesn't work anymore, so diet-ng isnt an option right now:

| <a href="foo">
    button Bar
| </a>
Contributor

WebFreak001 commented Sep 1, 2016

I don't think its much better there. Now I get a lot of problems about my inline javascript code and the error messages have just gotten much worse to read. This is the error log now:

Compiling Diet HTML template register.dt...
Compiling Diet HTML template register-done.dt...
Compiling Diet HTML template register.dt...
Compiling Diet HTML template login.dt...
Compiling Diet HTML template login.dt...
Compiling Diet HTML template firstauth.dt...
Compiling Diet HTML template firstauth.dt...
Compiling Diet HTML template firstauth.dt...
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(558,9): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(570,20): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(576,9): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(581,20): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(593,24): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(618,37): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(642,33): Error: need 'this' for '_input' of type 'InputFile[]'
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(480,16): Error: template instance app.RTPService.postFirstauth.render!("firstauth.dt", error).render!("app", "app.RTPService.postFirstauth").render.parseDie
t!(translate).parseDiet.MapResult!(__lambda2, InputFile[]) error instantiating
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(65,33):        instantiated from here: map!(InputFile[])
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(61,84):        instantiated from here: parseDiet!(translate)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,3):        instantiated from here: compileHTMLDietFile!("firstauth.dt", req, error)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("firstauth.dt", req, error)
source\app.d(222,11):        instantiated from here: render!("app", "app.RTPService.postFirstauth")
Compiling Diet HTML template polymer.dt...
Compiling Diet HTML template dashboard.dt...
dashboard.dt(27,20): Error: function app.TemplateFiles.getTemplate_dashboard.render!("dashboard.dt", _user).render!("app", "app.TemplateFiles.getTemplate_dashboard").render.filter!(req, _user).filter (const(char[]) input, string filter
, void delegate(const(char[])) nothrow @safe output) is not callable using argument types (string, string, void)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(84,7): Error: template instance app.TemplateFiles.getTemplate_dashboard.render!("dashboard.dt", _user).render!("app", "app.TemplateFiles.getTemplate_das
hboard").render.compileHTMLDietFile!("dashboard.dt", req, _user).exec!(StreamOutputRange) error instantiating
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,47):        instantiated from here: compileHTMLDietFile!(StreamOutputRange)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("dashboard.dt", req, _user)
source\app.d-mixin-927(927,84):        instantiated from here: render!("app", "app.TemplateFiles.getTemplate_dashboard")
Compiling Diet HTML template list.dt...
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\defs.d(34,3): Error: "list.dt(39): Expected node text separated by a space character or end of line, but got '<'."
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(935,12):        called from here: enforcep(strip(remainder).length == 0u, delegate string() => "Expected node text separated by a space character or e
nd of line, but got '" ~ remainder ~ "'.", loc)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(862,38):        called from here: parseTagLine(input, loc, has_nested)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(65,76):        called from here: parseDietRaw(f)
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\iteration.d(581,19):        called from here: __lambda2(front(this._input))
C:\Program Files\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(105,9):        called from here: __r7356.front()
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\parser.d(65,81):        called from here: array(map(files))
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(61,84):        called from here: parseDiet([InputFile("list.dt", "MY DIET TEMPLATE")]))
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(62,46):        called from here: _diet_nodes()
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(62,34):        called from here: getHTMLMixin(_diet_nodes(), "_diet_output")
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,3): Error: template instance app.TemplateFiles.getTemplate_list.render!("list.dt", _user).render!("app", "app.TemplateFiles.getTemplate_list")
.render.compileHTMLDietFile!("list.dt", req, _user) error instantiating
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("list.dt", req, _user)
source\app.d-mixin-928(928,74):        instantiated from here: render!("app", "app.TemplateFiles.getTemplate_list")
Compiling Diet HTML template color-selector.dt...
color-selector.dt(15,20): Error: function app.TemplateFiles.getTemplate_colorSelector.render!("color-selector.dt", _user).render!("app", "app.TemplateFiles.getTemplate_colorSelector").render.filter!(req, _user).filter (const(char[]) in
put, string filter, void delegate(const(char[])) nothrow @safe output) is not callable using argument types (string, string, void)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(84,7): Error: template instance app.TemplateFiles.getTemplate_colorSelector.render!("color-selector.dt", _user).render!("app", "app.TemplateFiles.getTem
plate_colorSelector").render.compileHTMLDietFile!("color-selector.dt", req, _user).exec!(StreamOutputRange) error instantiating
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\http\server.d(213,47):        instantiated from here: compileHTMLDietFile!(StreamOutputRange)
..\..\AppData\Roaming\dub\packages\vibe-d-0.7.30-beta.1\vibe-d\source\vibe\web\web.d(325,53):        instantiated from here: render!("color-selector.dt", req, _user)
source\app.d-mixin-929(929,93):        instantiated from here: render!("app", "app.TemplateFiles.getTemplate_colorSelector")
Compiling Diet HTML template time-picker.dt...
time-picker.dt(11,20): Error: function app.TemplateFiles.getTemplate_timePicker.render!("time-picker.dt", _user).render!("app", "app.TemplateFiles.getTemplate_timePicker").render.filter!(req, _user).filter (const(char[]) input, string
filter, void delegate(const(char[])) nothrow @safe output) is not callable using argument types (string, string, void)
..\..\AppData\Roaming\dub\packages\diet-ng-1.0.0-beta.1\diet-ng\source\diet\html.d(84,7): Error: template instance app.TemplateFiles.getTemplate_timePicker.render!("time-picker.dt", _user).render!("app", "app.TemplateFiles.getTemplate_
timePicker").render.compileHTMLDietFile!("time-picker.dt", req, _user).exec!(StreamOutputRange) error instantiating

These scripts are breaking it:

:javascript
    Polymer({
        is: "module-name"
    });

but because there are so many of them and they are most of the time just 3-5 lines I don't want to put them into separate files. Also it seems that there is some internal error in diet-ng which is right at the top of the error log.

I don't think its fixed though because there is also an issue in this line:

a(href$="/list/[[listid]]/settings")><
    paper-fab-menu-item(label="List Settings", icon="settings")

Also the workaround doesn't work anymore, so diet-ng isnt an option right now:

| <a href="foo">
    button Bar
| </a>
@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Sep 1, 2016

Member

Okay, I'll have a look at those issues ASAP.

Member

s-ludwig commented Sep 1, 2016

Okay, I'll have a look at those issues ASAP.

s-ludwig added a commit to rejectedsoftware/diet-ng that referenced this issue Sep 1, 2016

s-ludwig added a commit to rejectedsoftware/diet-ng that referenced this issue Sep 1, 2016

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Sep 1, 2016

Member

the a()>< works now (only a()<> was accepted before. Default filters ("javascript", "css", "htmlencode", "markdown") are now also available for diet-ng. What still remains are those algorithm.iteration.map errors. I couldn't reproduce those up to now in a unit test.

Member

s-ludwig commented Sep 1, 2016

the a()>< works now (only a()<> was accepted before. Default filters ("javascript", "css", "htmlencode", "markdown") are now also available for diet-ng. What still remains are those algorithm.iteration.map errors. I couldn't reproduce those up to now in a unit test.

@WebFreak001

This comment has been minimized.

Show comment
Hide comment
@WebFreak001

WebFreak001 Sep 1, 2016

Contributor

Im going to try to create a reproducible case for that last error. Also >< makes more sense imo because then you can visualize it like these braces being the parts of tags generating ...element1><element2...

Contributor

WebFreak001 commented Sep 1, 2016

Im going to try to create a reproducible case for that last error. Also >< makes more sense imo because then you can visualize it like these braces being the parts of tags generating ...element1><element2...

@WebFreak001

This comment has been minimized.

Show comment
Hide comment
@WebFreak001

WebFreak001 Oct 21, 2016

Contributor

Yeah fixed in diet-ng now

Contributor

WebFreak001 commented Oct 21, 2016

Yeah fixed in diet-ng now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment