jehugaleahsa / mustache-sharp

An extension of the mustache text template engine for .NET.
The Unlicense
306 stars 78 forks source link

A template file with windows line-feeds produces a result with no line feeds #51

Closed larswilke closed 9 years ago

larswilke commented 9 years ago

I am reading a template like so:

    private string getFileContent( DataDto saveData )
    {
        string fileContent = string.Empty;
        string templateFilePath = string.Format( "{0}\\Template.txt", CONFIGURATION_FOLDER );
        using ( StreamReader sr = new StreamReader( templateFilePath ) )
        {
            string template = sr.ReadToEnd();
            FormatCompiler compiler = new FormatCompiler();
            Generator generator = compiler.Compile( template );
            fileContent = generator.Render( saveData );
        }
        return fileContent;
    }

If the file Template.txt has windows linefeed, then fileContent has none. Changing the linefeeds to unix solves the problem.

What gives?

jehugaleahsa commented 9 years ago

Read the README then read this issue: https://github.com/jehugaleahsa/mustache-sharp/issues/18