diff --git a/include/minja/minja.hpp b/include/minja/minja.hpp index f4aee88..f0ee7a4 100644 --- a/include/minja/minja.hpp +++ b/include/minja/minja.hpp @@ -2419,7 +2419,7 @@ class Parser { public: static std::shared_ptr parse(const std::string& template_str, const Options & options) { - Parser parser(std::make_shared(template_str), options); + Parser parser(std::make_shared(normalize_newlines(template_str)), options); auto tokens = parser.tokenize(); TemplateTokenIterator begin = tokens.begin(); auto it = begin; diff --git a/tests/test-chat-template.cpp b/tests/test-chat-template.cpp index 87a3930..b0bb9d4 100644 --- a/tests/test-chat-template.cpp +++ b/tests/test-chat-template.cpp @@ -41,7 +41,7 @@ static std::string read_file(const std::string &path) { std::string out; out.resize(static_cast(size)); fs.read(&out[0], static_cast(size)); - return minja::normalize_newlines(out); + return out; } int main(int argc, char *argv[]) { @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) { std::string expected; try { - expected = read_file(golden_file); + expected = minja::normalize_newlines(read_file(golden_file)); } catch (const std::exception &e) { std::cerr << "Failed to read golden file: " << golden_file << std::endl; std::cerr << e.what() << std::endl;