Problem with mustache validation in moodle-plugin-ci

Problem with mustache validation in moodle-plugin-ci

by Mike Churchward -
Number of replies: 3
Picture of Core developers Picture of Plugin developers Picture of Testers
Hi all -

I am getting a failure with my mustache file validation that I cannot figure out. Specifically, the code:


    Example context (json):
{
"respondentscolumn0": [
"HTML of respondent link1",
"HTML of respondent link2"
],
"respondentscolumn1": [
"HTML of respondent link3",
"HTML of respondent link4"
],
"respondentscolumn2": [
"HTML of respondent link5",
"HTML of respondent link6"
]
}
}}
<div class="box generalbox">
{{#respondentscolumn0}}
<div id="respondentscolumn0" class="respondentscolumn">
{{#respondentlink}}
{{{.}}}<br />
{{/respondentlink}}
</div>
{{/respondentscolumn0}}
{{#respondentscolumn1}}
<div id="respondentscolumn1" class="respondentscolumn">
{{#respondentlink}}
{{{.}}}<br />
{{/respondentlink}}
</div>
{{/respondentscolumn1}}
{{#respondentscolumn2}}
<div id="respondentscolumn2" class="respondentscolumn">
{{#respondentlink}}
{{{.}}}<br />
{{/respondentlink}}
</div>
{{/respondentscolumn2}}
<div style="clear: both;"></div>
</div>

Is getting the error:
/home/travis/build/moodle/mod/questionnaire/templates/responselist.mustache - WARNING: HTML Validation error, line 5: Duplicate ID “respondentscolumn0”. (/div> 
<) /home/travis/build/moodle/mod/questionnaire/templates/responselist.mustache - WARNING: HTML Validation info, line 3: The first occurrence of ID “respondentscolumn0” was here. (box">
<) /home/travis/build/moodle/mod/questionnaire/templates/responselist.mustache - WARNING: HTML Validation error, line 9: Duplicate ID “respondentscolumn1”. (/div>
<) /home/travis/build/moodle/mod/questionnaire/templates/responselist.mustache - WARNING: HTML Validation info, line 7: The first occurrence of ID “respondentscolumn1” was here. (/div>
<) /home/travis/build/moodle/mod/questionnaire/templates/responselist.mustache - WARNING: HTML Validation error, line 13: Duplicate ID “respondentscolumn2”. (/div>
<) /home/travis/build/moodle/mod/questionnaire/templates/responselist.mustache - WARNING: HTML Validation info, line 11: The first occurrence of ID “respondentscolumn2” was here. (/div>
<)

There is only one occurrence of each of the ID's is says are duplicated. Any ideas?

mike


Average of ratings: -
In reply to Mike Churchward

Re: Problem with mustache validation in moodle-plugin-ci

by Damyon Wiese -

The failure is correct in this case. The example context for the template contains 2 links for each column. so when it is rendered it will write each column twice. 


Average of ratings: Useful (1)
In reply to Damyon Wiese

Re: Problem with mustache validation in moodle-plugin-ci

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Aha! Thanks Damyon.

Glad an extra set of eyes looked at that. I have stared at that for hours without seeing that obvious error.

mike

In reply to Mike Churchward

Re: Problem with mustache validation in moodle-plugin-ci

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

FYI... If anyone wants to know what the correct example content should have looked like, this is it:

    Example context (json):
    {
        "respondentscolumn0": {
            "respondentlink": [
                "HTML of respondent link1",
                "HTML of respondent link2"
            ]
        },
        "respondentscolumn1": {
            "respondentlink": [
                "HTML of respondent link3",
                "HTML of respondent link4"
            ]
        },
        "respondentscolumn2": {
            "respondentlink": [
                "HTML of respondent link5",
                "HTML of respondent link6"
            ]
        }
    }
    }}