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

Windows newlines breaks the template engine? #296

Open
Sweeper777 opened this issue Jul 29, 2020 · 0 comments
Open

Windows newlines breaks the template engine? #296

Sweeper777 opened this issue Jul 29, 2020 · 0 comments

Comments

@Sweeper777
Copy link

I have this code (note the windows new lines \r\n in index):

let base = """
Hello World
{% block content %}
This is base
{% endblock %}
"""
let index = "{% extends \"base.stencil\" %}\r\n{% block content %}\r\nThis is Index\r\n{% endblock %}"
let env = Environment(loader: DictionaryLoader(templates: ["base.stencil": base, "index.stencil": index]))
do {
    print(try env.renderTemplate(name: "index.stencil"))
} catch {
    print(error)
}

This prints:

Hello World

This is base

As if everything after the first line of index got ignored. I know it's weird to have windows new lines on macOS, but I don't think the behaviour of the template engine should depend on what kind of newlines I use, right?

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

1 participant