Open GEOEGII555 opened 2 months ago
Could you attach the template file to make it reproducible?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/style.css">
<title>А</title>
{{$head}}{{/head}}
</head>
<body>
{{$navbar}}
<nav>
<h1>А</h1>
<ul>
<li><a href="/">Главная</a></li>
</ul>
</nav>
{{/navbar}}
{{#flashes}}
<div class="message">
{{.}}
</div>
{{/flashes}}
{{$body}}
{{/body}}
</body>
</html>
It's trying to get the last element of blockPositions
in mustache::template_t::parse
, but the list is empty. actions_
only has a single element.
A block begins with a dollar and ends with a slash. That is, {{$title}} begins a "title" block and {{/title}} ends it. {{$block}}
doesn't add anything to blockPositions
(there's no case '$'
, it falls into the default case): line 617 in crow/mustache.h
The error message about an unmatched pair only mentions the {{#
-{{/
pair, which suggests at the fact that mustache {{$block}}
s weren't taken into account at all while writing the closing tag code.
Digging into the spec, the {{$
tags specify inheritance, which is an optional component of mustache that unfortunately Crow doesn't support. Which explains why they're not being taken into account.
The bug here is that Crow doesn't mention this information when an inheritance tag is used.
The code that loads the template: