Skip to content
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

Hamlet chokes at '\r' inside interpolation on Windows. #192

Open
arrowd opened this issue Aug 11, 2016 · 4 comments
Open

Hamlet chokes at '\r' inside interpolation on Windows. #192

arrowd opened this issue Aug 11, 2016 · 4 comments

Comments

@arrowd
Copy link

arrowd commented Aug 11, 2016

The code

let a = [shamlet|#{f a
                            b c}|]

yields unexpected '\r', expecting " " or "}" on Windows. Changing source line endings doesn't help, because template code is still \r\n-ended.

@snoyberg
Copy link
Member

This happens on non-Windows too, newlines are not supported inside an interpolation.

@janvogt
Copy link

janvogt commented Feb 1, 2019

@snoyberg If newlines are not supported in interpolations, is there any other way to handle long interpolations? I have a function that should be supplied with multiple file paths. I want the designer to select CSS imports from within the template, without any changes to Haskell code. The functionality is already there so

<link href=#{includeCss [ "static/fonts/fonts.scss", "static/css/bootstrap-2.7.5.min.css", "static/font-awesom-1.2.3.css"]} rel="stylesheet" type="text/css">

works fine but is terrible on small screens. So what I want to do is sth. like this:

<link href=#{includeCss [ "static/fonts/fonts.scss"
                        , "static/css/bootstrap-2.7.5.min.css"
                        , "static/font-awesom-1.2.3.css"
                        ]} rel="stylesheet" type="text/css">

I did not open a new issue, because I think this is just another example for the OP's problem, but am happy to do so, if you disagree.

@snoyberg
Copy link
Member

snoyberg commented Feb 2, 2019

In theory you could use a with in the Hamlet code to define a variable, or define the variable names in the Haskell code.

@janvogt
Copy link

janvogt commented Feb 2, 2019

@snoyberg Ok, thank you very much. I didn't think of that option. This trades the line-width problem for a nesting one. So I'll keep this as an option in mind, despite living with the oversized lines in the current case. Maybe this could be seen as a rather low-priority feature request for multi-line variable interpolations. Nevertheless thanks to all contributors for creating this marvel of a templating engine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants