Skip to content

Instantly share code, notes, and snippets.

@scmorrison
Last active August 20, 2017 15:45
Show Gist options
  • Save scmorrison/a771af17acf432331f6e0adba9bff945 to your computer and use it in GitHub Desktop.
Save scmorrison/a771af17acf432331f6e0adba9bff945 to your computer and use it in GitHub Desktop.
Perl 6 - Template::Mustache nested hash rendered ordering incorrect
#!/usr/bin/env perl6
use v6;
use Template::Mustache;
my %h = categories => [
category_pages => [{
title => "Perl 6",
url => "https://www.perl6.org"}, {
title => "Perl 6 Modules",
url => "https://modules.perl6.org"}],
title => "General tasks"];
my $html = q:to/EOF/;
{{#categories}}
{{ title }} <!-- should be first item -->
{{#category_pages}}
{{ title }} : {{ url }}</br>
{{/category_pages}}
{{/categories}}
EOF
say Template::Mustache.render: $html, %h;
# Output
#
# <!-- should be first item -->
# Perl 6 : https://www.perl6.org</br>
# Perl 6 Modules : https://modules.perl6.org</br>
# General tasks <!-- should be first item -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment