From d57d8ddfb24925a6331cd6c76613a0a4af3d07b9 Mon Sep 17 00:00:00 2001 From: mura Date: Thu, 13 Oct 2022 12:24:11 +0900 Subject: [PATCH] fixes each directive. --- pug.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pug.hpp b/pug.hpp index 3bf785c..7d1ee45 100644 --- a/pug.hpp +++ b/pug.hpp @@ -836,7 +836,14 @@ inline std::tuple parse_line(context_t const& context, st auto const begin = item.find_first_not_of(" \t"); if (begin == std::string::npos) throw ex::syntax_error(); auto const end = item.find_last_not_of(" \t,"); - items.emplace_back(item.substr(begin, end - begin)); + auto const i = item.substr(begin, end - begin + 1); + if (i.starts_with('"') || i.starts_with("'")) { + if (i.size() < 2) throw ex::syntax_error(); + if (i.front() != i.back()) throw ex::syntax_error(); + items.emplace_back(i.substr(1, i.size() - 2)); + } else { + items.emplace_back(i); + } } if (items.empty()) {