stencilproject/Stencil

Windows newlines breaks the template engine?

Sweeper777 opened this issue · 0 comments

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?