Skip to content

Windows newlines breaks the template engine? #296

Open
@Sweeper777

Description

@Sweeper777

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions