-
Improvement
-
Resolution: Unresolved
-
Low
-
None
(Background, linting mustache, for example in moodle-plugin-ci, is done using a custom Moodle script https://github.com/moodlehq/moodle-local_ci/blob/master/mustache_lint/mustache_lint.php.)
This script does not handle situations like a template which outputs a a <tr> and its content. You get validation errors like:
.../newresponse.mustache - WARNING: HTML Validation error, line 3:
|
Stray start tag “tr”. (d><body><tr class="generaterow" id="qtype-pmatch-new-response_1">
|
This is because the validator works by rendering the template, and inserting the content into <html><head></head><body> ... template HTML here ... </body></html>. https://github.com/moodlehq/moodle-local_ci/blob/master/mustache_lint/mustache_lint.php#L220.
In discussion with dobedobedoh in dev chat, we thought that what is needed (both for validation, and for other things like the template library) is an optional extension to the doc comment at the top of our templates. Specific suggestion:
{{!
|
@template core/example
|
|
This is am example.
|
|
Example context (json):
|
{
|
"hello": "world"
|
}
|
|
Test wrapper (html):
|
```
|
<table>
|
[[templatecontent]]
|
</table>
|
```
|
}}
|
- has a non-specific relationship to
-
MDL-56504 Mustache templates which are 'partials' should not show up in template library
-
- Closed
-