Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
225 commits
Select commit Hold shift + click to select a range
65a318a
Packaging
xxgreg Apr 3, 2013
3f17ddc
Fixes
xxgreg Apr 3, 2013
1a0883c
Add README
xxgreg Apr 3, 2013
a21cdfc
Preserve source location in tokens
xxgreg Apr 4, 2013
7b3c588
Preserve source location in nodes
xxgreg Apr 4, 2013
3d338ed
Add source location to error messages
xxgreg Apr 4, 2013
61bb26f
Render should return a String
xxgreg Apr 4, 2013
62be8ca
Update test
xxgreg Apr 4, 2013
8d06196
Add html escaping
xxgreg Apr 5, 2013
dce306f
Make sure all tests are passing
xxgreg Apr 5, 2013
e21cc68
Make template variables private
xxgreg Apr 5, 2013
ee97da0
Update readme and docs
xxgreg Apr 5, 2013
c32100a
Add nested sections test
xxgreg Apr 5, 2013
5a232b7
Add strict/lenient mode
xxgreg Apr 5, 2013
6d824b8
Mark escape tags as unimplemented
xxgreg Apr 5, 2013
811f7fc
Update docs, fix comments
xxgreg Apr 5, 2013
7515284
update readme
xxgreg Apr 5, 2013
08c2bde
README.md
xxgreg Apr 5, 2013
a8cba79
Update template to use StringSink interface
xxgreg Apr 5, 2013
284937e
Add drone.io badge
xxgreg Apr 5, 2013
c19df8b
Bump version
xxgreg Apr 5, 2013
5bb626d
Add parameter to disable html escaping
xxgreg Apr 5, 2013
9ea0c32
Hookup escape tags
xxgreg Apr 5, 2013
fd713a0
Update readme
xxgreg Apr 5, 2013
ec66136
Bump version
xxgreg Apr 5, 2013
2d20576
Add mustache spec tests
xxgreg Apr 6, 2013
894fdef
Fix no interpolation failure
xxgreg Apr 6, 2013
963f6cd
Trim whitespace from tag names
xxgreg Apr 6, 2013
f13c7e7
Handled nested sections where value is not a map
xxgreg Apr 6, 2013
f930156
Fix inverse section context misses
xxgreg Apr 6, 2013
450291f
Update spec test
xxgreg Apr 6, 2013
124498f
Update README.md
xxgreg Apr 6, 2013
b1a40fd
Resolve names from outer sections in a nested section
xxgreg Apr 6, 2013
4e1919e
Bump version
xxgreg Apr 6, 2013
107acbe
Update readme
xxgreg Apr 6, 2013
612a4be
Comment out test which is a known failure
xxgreg Apr 6, 2013
db24b73
Bump version
xxgreg Apr 6, 2013
5d0928d
Implemented standalone lines (Basic without whitespace handling)
xxgreg Apr 7, 2013
8af6cd0
Standalone lines
xxgreg Apr 7, 2013
a9b3c91
Handle comments in standalone lines
xxgreg Apr 7, 2013
12cfa23
Implemented dotted names
xxgreg Apr 7, 2013
c75e54d
Handle windows line endings
xxgreg Apr 7, 2013
da7d524
Add standalone line test
xxgreg Apr 7, 2013
0417366
Added support for implicit iterators
xxgreg Apr 7, 2013
e678ba5
Update readme
xxgreg Apr 7, 2013
6b8cd62
Update to Dart M4 release
xxgreg Apr 16, 2013
f8b752e
Bump version
xxgreg Apr 16, 2013
a05e26e
Support {{#.}} and Iterable values
michaelhixson Jun 12, 2013
7fd5849
Support arbitrary getters in templates via reflection
michaelhixson Jun 12, 2013
c956a44
Attempt #2 at reflection
michaelhixson Jun 12, 2013
1b8e245
Add import for dart:mirror
xxgreg Jun 13, 2013
a7cee54
Fix test - was overly strict
xxgreg Oct 26, 2013
27839ce
Update options handling, and json usage to latest sdk style
xxgreg Nov 8, 2013
74b9d93
Update dependency and sdk versions, bump version
xxgreg Nov 8, 2013
4b2bbcb
Allow iterable items to be targeted by index
timkendrick Jan 9, 2014
5c099bc
Merge pull request #5 from timkendrick/master
xxgreg Jan 12, 2014
4a0e5a3
Add test for array indexing
xxgreg Jan 12, 2014
19b977f
Bump version
xxgreg Jan 13, 2014
11fbe03
Fix outdated reference to 'members'
yjbanov Jan 29, 2014
7b9c8f1
Merge pull request #6 from yjbanov/mirrors-fix
xxgreg Jan 29, 2014
302b493
Bump version
xxgreg Jan 29, 2014
0deecaf
Update README.md
sethladd Jan 29, 2015
dfc8d37
Merge pull request #8 from sethladd/patch-1
xxgreg Jan 30, 2015
a374fe6
Initial hack at partials support.
xxgreg Feb 1, 2015
e0196af
Cleaned up partials support a little
xxgreg Feb 1, 2015
0f73f5a
Rename MustacheContext to TemplateRenderer
xxgreg Feb 2, 2015
001be5f
Fix warning - FormatException was updated at some point, remove depen…
xxgreg Feb 2, 2015
e46fdde
Fix partial test
xxgreg Feb 2, 2015
948a9cf
Fix tests FormatException => MustacheFormatException
xxgreg Feb 2, 2015
d209b45
Pass template name in error messages
xxgreg Feb 2, 2015
594773e
Fix lenient handling of partials resolution
xxgreg Feb 2, 2015
b9dfb0a
Add more partials tests
xxgreg Feb 2, 2015
7be9160
Add basic lambda support
xxgreg Feb 2, 2015
c455223
Add test for Seth's use case
xxgreg Feb 2, 2015
49c4120
Refactor
xxgreg Feb 2, 2015
862d4d0
Add mirrors lambda test
xxgreg Feb 2, 2015
7faee5e
Add mirrors support back
xxgreg Feb 2, 2015
93b89c2
Update pubspec sdk constraint
xxgreg Feb 2, 2015
92f1c8a
Add mirrors used tag to dart library
xxgreg Feb 2, 2015
906596c
Bump version
xxgreg Feb 3, 2015
26aa3ff
Expose name getter on template
xxgreg Feb 3, 2015
fb20966
Add whitespace tests issue #10
xxgreg Feb 3, 2015
c14c6f4
Investigate other implementations behaviour
xxgreg Feb 3, 2015
823a657
Update gitignore
xxgreg Feb 3, 2015
e91b119
Match whitespace handing with python and node mustache implementations
xxgreg Feb 3, 2015
48414cf
Update readme
xxgreg Feb 3, 2015
1dabe42
Update readme
xxgreg Feb 3, 2015
f017cb2
Add mirrors note.
xxgreg Feb 3, 2015
5a13693
Update README.md
xxgreg Feb 3, 2015
49ba211
Better error message if null is passed to Template ctor
Feb 5, 2015
177cffc
Fix spec test
Feb 5, 2015
3862a40
Plug partial whitespace indentation string through to renderPartial
Feb 5, 2015
6d0d95e
Initial attempt at indenting partial content correctly - no dice
xxgreg Feb 5, 2015
6bf0ff6
Fix partials handling of whitespace
xxgreg Feb 5, 2015
5c59f88
Initial implementation of the lambda context
xxgreg Feb 5, 2015
12e3831
Fix exception
xxgreg Feb 5, 2015
43bc651
Fix nested partials indenting
xxgreg Feb 5, 2015
5e83cda
Complete lambda context implementation
xxgreg Feb 5, 2015
1160180
Initial delimiters implementation
xxgreg Feb 10, 2015
9cdac99
Improve delimiter implementation
xxgreg Feb 10, 2015
889a10a
Fix handling of delimiters in lambda sections - all spec tests pass woot
xxgreg Feb 10, 2015
5f31bf1
Move classes into separate files
xxgreg Feb 10, 2015
0f5e093
Move standalone whitespace removal into parse, merge text nodes durin…
xxgreg Feb 10, 2015
b8afb55
Remove delimiter class
xxgreg Feb 10, 2015
01bd6ab
Change parse to use switch
xxgreg Feb 10, 2015
6481f49
Don't call lambdas for inverted sections - matches mustache.js behaviour
xxgreg Feb 10, 2015
a1f3d0a
Change TemplateException
xxgreg Feb 10, 2015
605b499
Start updating scanner
xxgreg Feb 11, 2015
4495d79
Fix indentation of partials
xxgreg Feb 11, 2015
a6c2a6d
Clean up some error messages
xxgreg Feb 11, 2015
80176f5
Fix a failing test
xxgreg Feb 11, 2015
c6c105d
Cleanups
xxgreg Feb 11, 2015
0e46f1e
Remove char reader class, merge code into scanner
xxgreg Feb 11, 2015
2b0067a
Update README.md
xxgreg Feb 11, 2015
d49a0a6
Update README.md
xxgreg Feb 11, 2015
c77154a
Update README.md
xxgreg Feb 11, 2015
ae6d992
Update README.md
xxgreg Feb 11, 2015
91cfc79
Update README.md
xxgreg Feb 11, 2015
4eaa81b
Add change log
xxgreg Feb 12, 2015
366e04e
Update readme, create changelog, and add some tests
xxgreg Feb 12, 2015
7b12b34
Update README.md
xxgreg Feb 12, 2015
4df408e
Fix travis build
xxgreg Feb 12, 2015
b2e3b92
Merge branch 'master' of https://github.com/xxgreg/mustache
xxgreg Feb 12, 2015
7e9aaca
Update README.md
xxgreg Feb 12, 2015
e5cae3c
Update dependencies
xxgreg Feb 12, 2015
2b9c1f1
Clean up analyzer hints - not sure why only on command line analyzer
xxgreg Feb 12, 2015
92b20d7
Update changelog
xxgreg Feb 12, 2015
1b01983
Bump version
xxgreg Feb 12, 2015
8c44290
Added examples copied from README, fixed README
damondouglas Feb 15, 2015
ad9471f
Update README.md
xxgreg Feb 15, 2015
567417f
Refactor node into seperate classes move render methods into nodes fr…
xxgreg Feb 24, 2015
13ff1af
Clean up handling of delimiters and indenting
xxgreg Feb 24, 2015
6d8b26e
Refactor renderering
xxgreg Feb 24, 2015
eee5510
Improved error handling for unclosed tags
xxgreg Feb 24, 2015
76b8a11
Added more methods to LambdaContext
xxgreg Feb 24, 2015
1cf3221
Create mustache.impl library
xxgreg Feb 27, 2015
22cb9e9
Banish the underscores
xxgreg Feb 27, 2015
2a80cac
Fix dartdoc
xxgreg Feb 27, 2015
dfc2205
Banish more underscores
xxgreg Feb 27, 2015
96a39d0
Initial scanner impl
xxgreg Feb 28, 2015
08acb17
Clean up scanner
xxgreg Feb 28, 2015
c7b361d
Banish even more underscores
xxgreg Feb 28, 2015
a35e8e5
Add initial parser re-implementation
xxgreg Feb 28, 2015
d65221f
Refactor merge whitespace - do it during parse
xxgreg Feb 28, 2015
035437a
Improve parser
xxgreg Mar 1, 2015
c9e979b
Fix standalone whitespace handling
xxgreg Mar 1, 2015
470e496
Set contentStart/End on SectionNode
xxgreg Mar 1, 2015
e646577
Handle consecutive standalone lines
xxgreg Mar 1, 2015
9eb8da7
Fix bug with triple mustache tags
xxgreg Mar 1, 2015
3c854b9
Fix usage of sigil constants, use an enum instead
xxgreg Mar 1, 2015
2a2c71f
Fix scanning of change delimiter tags
xxgreg Mar 1, 2015
6c41a3a
Fix incorrect test
xxgreg Mar 1, 2015
bf7ab01
Fix handling of comments
xxgreg Mar 1, 2015
cdeb981
_readTag() change comments
xxgreg Mar 1, 2015
11fd360
Handle standalone lines for comments and change delimiter tags - most…
xxgreg Mar 1, 2015
7ce6c1f
Add more error messages, and change imports
xxgreg Mar 1, 2015
4c2ee45
Fix corner case with triple mustache tags
xxgreg Mar 1, 2015
c60dd1a
Improve parser._readTag()
xxgreg Mar 3, 2015
c01f53b
More parser improvements
xxgreg Mar 3, 2015
1c3a521
More parser tweaks
xxgreg Mar 3, 2015
80fb727
More parser tweaks II
xxgreg Mar 3, 2015
7603a6d
More parser and scanner tweaks III
xxgreg Mar 3, 2015
b40a2e9
Fix failing test
xxgreg Mar 3, 2015
baa6e93
Fix test
xxgreg Mar 3, 2015
321056b
Refactor rendering code out of nodes
xxgreg Mar 6, 2015
d618273
Combine RenderContext and Renderer
xxgreg Mar 6, 2015
57a41f0
Handle EOFs while parsing change delimiter tag
xxgreg Mar 6, 2015
79824ff
Update change log
xxgreg Mar 6, 2015
3319982
Bump version
xxgreg Mar 6, 2015
4172d5d
Move equals check from node and token into test
xxgreg Mar 6, 2015
74458ca
Add lame toString test, because I'm a coverage whore
xxgreg Mar 6, 2015
019208a
Inline delimiter code
xxgreg Mar 6, 2015
c5b47db
moar coverage
xxgreg Mar 6, 2015
465caef
Add lambda context tests
xxgreg Mar 6, 2015
1b62d8a
Test long exception lines
xxgreg Mar 6, 2015
5188b38
Add mirror method test
xxgreg Mar 6, 2015
e4baf49
Remove dead code
xxgreg Mar 6, 2015
eb7164f
Fix mirrors used meta target to use annotation type rather than the i…
Apr 21, 2015
546ba47
Bump version, update change log
Apr 22, 2015
b8a2541
Allow arbitrary objects for truthiness checks in lenient mode, run da…
mkustermann May 6, 2015
3cfce2c
Merge pull request #21 from mkustermann/lenient-section-objects
xxgreg May 7, 2015
4eeb850
Bump version, update change log
xxgreg May 7, 2015
c21fc4d
Fix #23: tags containing "=" fail
greg-montoux Oct 28, 2015
3a9f4be
adding delimiters in the constructor of the template class
jorishermans Nov 2, 2015
b96632d
adding tests for this new change
jorishermans Nov 3, 2015
036ea9e
Add delimiters parameter to Template interface, and fix test
greg-montoux Nov 6, 2015
ce4f525
Fix analyser hints
greg-montoux Nov 6, 2015
72528ec
Dartfmt all the things
greg-montoux Nov 6, 2015
8373940
Remove MustacheFormatException
greg-montoux Nov 6, 2015
d10dbd8
Bump version, update changelog
greg-montoux Nov 6, 2015
3de3bca
Fix #24: renderString shrinks multiple newlines to just one
greg-montoux Nov 6, 2015
a9b3683
Update travis build badge
greg-montoux Sep 25, 2016
575ffcb
Bump version (hotfix)
greg-montoux Sep 25, 2016
7d6eef5
Fixing strong mode errors
srawlins Dec 6, 2016
35da328
Merge pull request #29 from srawlins/fix-strong-errors
xxgreg Nov 20, 2017
0557f49
Bump version
greg-montoux Nov 20, 2017
1a17688
Move tests to using package test
keertip Jul 14, 2017
3797e70
Changes for landing https://github.com/dart-lang/sdk/issues/32161
MichaelRFairhurst Feb 19, 2018
0d1c1f0
Avoid invocation of Object.
stereotype441 Feb 13, 2018
3a23224
Enable strong mode
xxgreg Jun 3, 2018
3421e42
Dart 2: fix failing spec test
xxgreg Jun 3, 2018
7114aba
1.0.1
xxgreg Jun 3, 2018
574d06d
Set the max SDK constraint to <3.0.0
nshahan Jul 25, 2018
5529e74
Merge pull request #40 from nshahan/bump-sdk
xxgreg Aug 2, 2018
580a507
Add support for class members in sections
jcollins-g Jan 7, 2019
22220a5
Merge pull request #41 from jcollins-g/nested-class-resolution
xxgreg Jan 9, 2019
4fd8117
Bump version to 1.1.0
xxgreg Jan 9, 2019
5d46180
Fixes #42
Rodsevich Jan 29, 2019
6382d72
Merge pull request #43 from Rodsevich/master
xxgreg Feb 3, 2019
1601e94
Bumped version to 1.1.1
xxgreg Feb 3, 2019
9b850d4
remove mirrors
Sep 8, 2019
ee883fa
update for Dart 2
Feb 26, 2020
4f687b8
remove deprecated parse function
Feb 26, 2020
bcf938a
update configuration
Feb 26, 2020
729331c
fix pubspec
Feb 26, 2020
87b3b7c
fix pubspec.yaml
Feb 26, 2020
a5c55ba
update pubspec.yaml
Feb 26, 2020
ad4bb5d
add export library
Feb 26, 2020
6067dd7
fixes to make all existing tests work
Feb 26, 2020
6f99021
more updates to changelog
Feb 27, 2020
4d440ab
migrate to null safe dart
jonahwilliams Nov 1, 2020
cbae271
update sdk constraint
jonahwilliams Mar 5, 2021
2d9ab9c
Initial import of mustache_template
stuartmorgan-g Sep 2, 2025
c8c7f59
[mustache_template] Import: Autoformat
stuartmorgan-g Sep 2, 2025
cfe8bcd
[mustache_template] Import: Update for reo conventions
stuartmorgan-g Aug 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ third_party/packages/cupertino_icons/** @MitchellGoodwin
third_party/packages/cupertino_icons/test/goldens/** @LongCatIsLooong
third_party/packages/flutter_svg/** @domesticmouse
third_party/packages/flutter_svg_test/** @domesticmouse
third_party/packages/mustache_template/** @bkonyi @parlough
third_party/packages/path_parsing/** @domesticmouse

# Plugin platform implementation rules. These should stay last, since the last
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ These are the packages hosted in this repository:
| [plugin\_platform\_interface](./packages/plugin_platform_interface/) | [![pub package](https://img.shields.io/pub/v/plugin_platform_interface.svg)](https://pub.dev/packages/plugin_platform_interface) | [![pub points](https://img.shields.io/pub/points/plugin_platform_interface)](https://pub.dev/packages/plugin_platform_interface/score) | [![downloads](https://img.shields.io/pub/dm/plugin_platform_interface)](https://pub.dev/packages/plugin_platform_interface/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20plugin_platform_interface?label=)](https://github.com/flutter/flutter/labels/p%3A%20plugin_platform_interface) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20plugin_platform_interface?label=)](https://github.com/flutter/packages/labels/p%3A%20plugin_platform_interface) |
| [quick\_actions](./packages/quick_actions/) | [![pub package](https://img.shields.io/pub/v/quick_actions.svg)](https://pub.dev/packages/quick_actions) | [![pub points](https://img.shields.io/pub/points/quick_actions)](https://pub.dev/packages/quick_actions/score) | [![downloads](https://img.shields.io/pub/dm/quick_actions)](https://pub.dev/packages/quick_actions/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20quick_actions?label=)](https://github.com/flutter/flutter/labels/p%3A%20quick_actions) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20quick_actions?label=)](https://github.com/flutter/packages/labels/p%3A%20quick_actions) |
| [google\_identity\_services\_web](./packages/google_identity_services_web/) | [![pub package](https://img.shields.io/pub/v/google_identity_services_web.svg)](https://pub.dev/packages/google_identity_services_web) | [![pub points](https://img.shields.io/pub/points/google_identity_services_web)](https://pub.dev/packages/google_identity_services_web/score) | [![downloads](https://img.shields.io/pub/dm/google_identity_services_web)](https://pub.dev/packages/google_identity_services_web/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20google_identity_services_web?label=)](https://github.com/flutter/flutter/labels/p%3A%20google_identity_services_web) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20google_identity_services_web?label=)](https://github.com/flutter/packages/labels/p%3A%20google_identity_services_web) |
| [mustache\_template](./third_party/packages/mustache_template/) | [![pub package](https://img.shields.io/pub/v/mustache_template.svg)](https://pub.dev/packages/mustache_template) | [![pub points](https://img.shields.io/pub/points/mustache_template)](https://pub.dev/packages/mustache_template/score) | [![downloads](https://img.shields.io/pub/dm/mustache_template)](https://pub.dev/packages/mustache_template/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20mustache_template?label=)](https://github.com/flutter/flutter/labels/p%3A%20mustache_template) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20mustache_template?label=)](https://github.com/flutter/packages/labels/p%3A%20mustache_template) |
| [rfw](./packages/rfw/) | [![pub package](https://img.shields.io/pub/v/rfw.svg)](https://pub.dev/packages/rfw) | [![pub points](https://img.shields.io/pub/points/rfw)](https://pub.dev/packages/rfw/score) | [![downloads](https://img.shields.io/pub/dm/rfw)](https://pub.dev/packages/rfw/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20rfw?label=)](https://github.com/flutter/flutter/labels/p%3A%20rfw) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20rfw?label=)](https://github.com/flutter/packages/labels/p%3A%20rfw) |
| [shared\_preferences](./packages/shared_preferences/) | [![pub package](https://img.shields.io/pub/v/shared_preferences.svg)](https://pub.dev/packages/shared_preferences) | [![pub points](https://img.shields.io/pub/points/shared_preferences)](https://pub.dev/packages/shared_preferences/score) | [![downloads](https://img.shields.io/pub/dm/shared_preferences)](https://pub.dev/packages/shared_preferences/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20shared_preferences?label=)](https://github.com/flutter/flutter/labels/p%3A%20shared_preferences) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20shared_preferences?label=)](https://github.com/flutter/packages/labels/p%3A%20shared_preferences) |
| [standard\_message\_codec](./packages/standard_message_codec/) | [![pub package](https://img.shields.io/pub/v/standard_message_codec.svg)](https://pub.dev/packages/standard_message_codec) | [![pub points](https://img.shields.io/pub/points/standard_message_codec)](https://pub.dev/packages/standard_message_codec/score) | [![downloads](https://img.shields.io/pub/dm/standard_message_codec)](https://pub.dev/packages/standard_message_codec/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20standard_message_codec?label=)](https://github.com/flutter/flutter/labels/p%3A%20standard_message_codec) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20standard_message_codec?label=)](https://github.com/flutter/packages/labels/p%3A%20standard_message_codec) |
Expand Down
1 change: 1 addition & 0 deletions script/configs/temp_exclude_excerpt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
# https://github.com/flutter/flutter/issues/102679
- espresso
- in_app_purchase/in_app_purchase
- mustache_template
- pointer_interceptor
- quick_actions/quick_actions
8 changes: 8 additions & 0 deletions script/tool/lib/src/license_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const Set<String> _ignorePathPartList = <String>{
// the package-level LICENSE file. Each entry must be a directory relative to
// third_party/packages, as that is the only directory where this is allowed.
const Set<String> _unannotatedFileThirdPartyDirectories = <String>{
'mustache_template',
'path_parsing',
'flutter_svg',
'flutter_svg_test',
Expand Down Expand Up @@ -85,6 +86,13 @@ final List<RegExp> _thirdPartyLicenseBlockRegexes = <RegExp>[
r'// Use of this source code is governed by a BSD-style license that can be\n'
r'// found in the LICENSE file\.\n',
),
// packages/third_party/mustache_template.
RegExp(
r'Copyright \(c\) 2013, Greg Lowe\n'
r'All rights reserved.\n\n'
r'Redistribution and use in source and binary forms, with or without '
r'modification, are permitted provided that the following conditions are met:\n',
),
// packages/third_party/path_parsing.
RegExp(
r'Copyright \(c\) 2018 Dan Field\n\n'
Expand Down
71 changes: 71 additions & 0 deletions third_party/packages/mustache_template/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## 2.0.1

* Transfers the package source from https://github.com/jonahwilliams/mustache
to https://github.com/flutter/packages.
* Updates minimum supported SDK version to Dart 3.7.
* Updates code for new analysis options.

## 2.0.0

* Support for null safe dart added.

## 1.0.0+1

* Fixed regression where lookups from list did not work. Removed failing tests
that depend on reflection.

## 1.0.0

* Forked from original repo. Support for mirrors removed.

## Fork

## 1.1.1

* Fixed error "boolean expression must not be null". Thanks Nico.

## 1.1.0

* Better support for class members in sections. Thanks to Janice Collins.
* Set the SDK constraint to Dart 2+.

## 1.0.2
Set the max SDK constraint to <3.0.0.

## 0.2.5

* Remove MustacheFormatException
* Allow templates to specify default delimiters. Thanks to Joris Hermans.
* Fix #24: renderString shrinks multiple newlines to just one (Thanks to John Ryan for the repro).

## 0.2.4

* Fix #23 failure if tag or comment contains "="

## 0.2.3

* Change handling of lenient sections to match python mustache implementation.

## 0.2.2

* Fix MirrorsUsed tag for using mirrors on dart2js.
* Clean up dead code.

## 0.2.1

* Added new methods to LambdaContext.

## 0.2

* Deprecated parse() function - please update your code to use new Template(source).
* Deprecated MustacheFormatException - please update your code to use TemplateException.
* Breaking change: Template.render and Template.renderString methods no longer
take the optional lenient and htmlEscapeValues. These should now be passed to
the Template constructor.
* Fully passing all mustache spec tests.
* Added support for MirrorsUsed.
* Implemented partials. #11
* Implemented lambdas. #4
* Implemented change delimiter tag.
* Add template name parameter, and show this in error messages.
* Allow whitespace at begining of tags. #10
8 changes: 8 additions & 0 deletions third_party/packages/mustache_template/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Copyright (c) 2013, Greg Lowe
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 changes: 15 additions & 0 deletions third_party/packages/mustache_template/METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "mustache_template"
description:
"Mustache template Dart library"

third_party {
identifier {
type: "Git"
value: "https://github.com/jonahwilliams/mustache"
primary_source: true
version: "c4344e0dd45f6605758eb11aa4837859e2c055f0"
}
version: "c4344e0dd45f6605758eb11aa4837859e2c055f0"
last_upgrade_date { year: 2025 month: 9 day: 3 }
license_type: NOTICE
}
117 changes: 117 additions & 0 deletions third_party/packages/mustache_template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Mustache templates

A Dart library to parse and render [mustache templates](https://mustache.github.io/).

See the [mustache manual](http://mustache.github.com/mustache.5.html) for detailed usage information.

This library passes all [mustache specification](https://github.com/mustache/spec/tree/master/specs) tests.

## Example usage
```dart
import 'package:mustache_template/mustache_template.dart';

main() {
var source = '''
{{# names }}
<div>{{ lastname }}, {{ firstname }}</div>
{{/ names }}
{{^ names }}
<div>No names.</div>
{{/ names }}
{{! I am a comment. }}
''';

var template = Template(source, name: 'template-filename.html');

var output = template.renderString({'names': [
{'firstname': 'Greg', 'lastname': 'Lowe'},
{'firstname': 'Bob', 'lastname': 'Johnson'}
]});

print(output);
}
```

A template is parsed when it is created, after parsing it can be rendered any number of times with different values. A TemplateException is thrown if there is a problem parsing or rendering the template.

The Template contstructor allows passing a name, this name will be used in error messages. When working with a number of templates, it is important to pass a name so that the error messages specify which template caused the error.

By default all output from `{{variable}}` tags is html escaped, this behaviour can be changed by passing htmlEscapeValues : false to the Template constructor. You can also use a `{{{triple mustache}}}` tag, or a unescaped variable tag `{{&unescaped}}`, the output from these tags is not escaped.

## Differences between strict mode and lenient mode.

### Strict mode (default)

* Tag names may only contain the characters a-z, A-Z, 0-9, underscore, period and minus. Other characters in tags will cause a TemplateException to be thrown during parsing.

* During rendering, if no map key or object member which matches the tag name is found, then a TemplateException will be thrown.

### Lenient mode

* Tag names may use any characters.
* During rendering, if no map key or object member which matches the tag name is found, then silently ignore and output nothing.

## Nested paths

```dart
var t = Template('{{ author.name }}');
var output = template.renderString({'author': {'name': 'Greg Lowe'}});
```

## Partials - example usage

```dart

var partial = Template('{{ foo }}', name: 'partial');

var resolver = (String name) {
if (name == 'partial-name') { // Name of partial tag.
return partial;
}
};

var t = Template('{{> partial-name }}', partialResolver: resolver);

var output = t.renderString({'foo': 'bar'}); // bar

```

## Lambdas - example usage

```dart
var t = Template('{{# foo }}');
var lambda = (_) => 'bar';
t.renderString({'foo': lambda}); // bar
```

```dart
var t = Template('{{# foo }}hidden{{/ foo }}');
var lambda = (_) => 'shown';
t.renderString('foo': lambda); // shown
```

```dart
var t = Template('{{# foo }}oi{{/ foo }}');
var lambda = (LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>';
t.renderString({'foo': lambda}); // <b>OI</b>
```

```dart
var t = Template('{{# foo }}{{bar}}{{/ foo }}');
var lambda = (LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>';
t.renderString({'foo': lambda, 'bar': 'pub'}); // <b>PUB</b>
```

```dart
var t = Template('{{# foo }}{{bar}}{{/ foo }}');
var lambda = (LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>';
t.renderString({'foo': lambda, 'bar': 'pub'}); // <b>PUB</b>
```

In the following example `LambdaContext.renderSource(source)` re-parses the source string in the current context, this is the default behaviour in many mustache implementations. Since re-parsing the content is slow, and often not required, this library makes this step optional.

```dart
var t = Template('{{# foo }}{{bar}}{{/ foo }}');
var lambda = (LambdaContext ctx) => ctx.renderSource(ctx.source + ' {{cmd}}');
t.renderString({'foo': lambda, 'bar': 'pub', 'cmd': 'build'}); // pub build
```
6 changes: 6 additions & 0 deletions third_party/packages/mustache_template/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/dart-lang/test/blob/master/pkgs/test/doc/configuration.md#arguments
override_platforms:
chrome:
settings:
executable: chrome
arguments: --no-sandbox
98 changes: 98 additions & 0 deletions third_party/packages/mustache_template/lib/mustache.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import 'src/template.dart' as t;

/// A Template can be efficiently rendered multiple times with different
/// values.
abstract class Template {
/// The constructor parses the template source and throws [TemplateException]
/// if the syntax of the source is invalid.
/// Tag names may only contain characters a-z, A-Z, 0-9, underscore, and minus,
/// unless lenient mode is specified.
factory Template(
String source, {
bool lenient,
bool htmlEscapeValues,
String name,
PartialResolver? partialResolver,
String delimiters,
}) = t.Template.fromSource;
Comment on lines +10 to +17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The named parameters in this factory constructor are non-nullable and don't have default values or a required keyword, which will cause analysis errors in Dart 3. They should be updated to match the implementation in Template.fromSource, using default values and nullable types where appropriate.

Suggested change
factory Template(
String source, {
bool lenient,
bool htmlEscapeValues,
String name,
PartialResolver? partialResolver,
String delimiters,
}) = t.Template.fromSource;
factory Template(
String source, {
bool lenient = false,
bool htmlEscapeValues = true,
String? name,
PartialResolver? partialResolver,
String delimiters = '{{ }}',
}) = t.Template.fromSource;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird, and looks like a mistake in the initial conversion to NNBD, but I'm not going to change it here.


/// An optional name used to identify the template in error logging.
String? get name;

/// The template that should be filled when calling [render] or
/// [renderString].
String get source;

/// [values] can be a combination of Map, List, String. Any non-String object
/// will be converted using toString(). Null values will cause a
/// [TemplateException], unless lenient module is enabled.
String renderString(Object? values);

/// [values] can be a combination of Map, List, String. Any non-String object
/// will be converted using toString(). Null values will cause a
/// [TemplateException], unless lenient module is enabled.
void render(Object? values, StringSink sink);
}

// TODO(stuartmorgan): Remove this. See https://github.com/flutter/flutter/issues/174722.
// ignore: public_member_api_docs
typedef PartialResolver = Template? Function(String);

// TODO(stuartmorgan): Remove this. See https://github.com/flutter/flutter/issues/174722.
// ignore: public_member_api_docs
typedef LambdaFunction = Object Function(LambdaContext context);

/// Passed as an argument to a mustache lambda function. The methods on
/// this object may only be called before the lambda function returns. If a
/// method is called after it has returned an exception will be thrown.
abstract class LambdaContext {
/// Render the current section tag in the current context and return the
/// result as a string. If provided, value will be added to the top of the
/// context's stack.
String renderString({Object? value});

/// Render and directly output the current section tag. If provided, value
/// will be added to the top of the context's stack.
void render({Object value});

/// Output a string. The output will not be html escaped, and will be written
/// before the output returned from the lambda.
void write(Object object);

/// Get the unevaluated template source for the current section tag.
String get source;

/// Evaluate the string as a mustache template using the current context. If
/// provided, value will be added to the top of the context's stack.
String renderSource(String source, {Object? value});

/// Lookup the value of a variable in the current context.
Object? lookup(String variableName);
}

/// [TemplateException] is used to obtain the line and column numbers
/// of the token which caused parse or render to fail.
abstract class TemplateException implements Exception {
/// A message describing the problem parsing or rendering the template.
String get message;

/// The name used to identify the template, as passed to the Template
/// constructor.
String? get templateName;

/// The 1-based line number of the token where formatting error was found.
int get line;

/// The 1-based column number of the token where formatting error was found.
int get column;

/// The character offset within the template source.
int? get offset;

/// The template source.
String? get source;

/// A short source substring of the source at the point the problem occurred
/// with parsing or rendering.
String get context;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'mustache.dart';
Loading