Commit Graph

297 Commits

Author SHA1 Message Date
Michael Bayne b823ed87c5 Remove use of String.intern().
Me, on the blackboard:

"I will not optimize code without using a profiler."
"I will not optimize code without using a profiler."
"I will not optimize code without using a profiler."
"I will not optimize code without using a profiler."
"I will not optimize code without using a profiler."
...
2018-04-30 08:58:01 -07:00
Michael Bayne 2c53104cf3 Extract Compiler.loadTemplate helper.
If a lambda wanted to load a template via its own template loader, this makes
it a lot easier to do so.
2018-03-05 09:27:18 -08:00
Michael Bayne 0100fb15cf Revert to source.level 1.7.
I was not thinking clearly when I bumped everything to 1.8. I don't want to
force a JVM 1.8 requirement on everyone. 1.7 should still be fine.
2018-02-02 10:31:25 -08:00
Michael Bayne bf288c8810 Better wording. 2017-12-17 15:20:13 -08:00
Michael Bayne 37e31cbeac Add mechism to visit template tags.
This is useful when you want to inspect the structure of the template without
executing it.
2017-12-17 15:16:09 -08:00
Michael Bayne 326f04cb1e Brace fiddling. 2017-12-17 14:46:42 -08:00
Michael Bayne af623f1335 Reference 1.14 release. 2017-12-04 09:17:13 -08:00
Michael Bayne 90d1220236 [maven-release-plugin] prepare for next development iteration 2017-12-04 09:14:37 -08:00
Michael Bayne 424851a082 [maven-release-plugin] prepare release jmustache-1.14 2017-12-04 09:14:28 -08:00
Michael Bayne 02f917e2f7 Add Fragment.executeTemplate().
Allows a lambda to execute a template in the lambda's own context. This enables
'late bound' template inclusion where the lambda can select a template based on
dynamic data in the context at the time it is executed.

Closes #92.
2017-12-03 18:29:15 -08:00
Michael Bayne 2a270dcdbe Update to GWT 2.8.2. 2017-12-03 18:29:15 -08:00
Michael Bayne 8cddc839e3 Oops can't use reflection in shared tests. 2017-09-20 09:51:53 -07:00
Michael Bayne 172f35fb64 When nesting for non-list contexts, inherit list info.
This ensures that if you enter a conditional block while inside a list
block, the list "state" from the outer list will still be visible. For
example (somewhat contrived, but gets the point across):

{{#list}}
{{#name}}{{-index}}. {{.}}{{/name}}
{{^name}}{{-index}}. No name!{{/name}}
{{/list}}

Yields something like:

1. Bob
2. Mary
3. No name!
4. Jim

Fixes #90.
2017-09-20 09:43:14 -07:00
Michael Bayne 49720df4ea Use shipped GWT 2.8.0 (yay).
Also made main source target 1.8 (from 1.6) and nixed some GWT test
cruft.
2016-11-20 11:34:25 -08:00
Michael Bayne 8da02a18e8 Merge pull request #85 from quentinburley/patch-1
Update README.md
2016-10-21 07:23:15 -07:00
quentinburley 02478eccdb Update README.md
fix typos: unbalanced parenthesis. 
before:
{{#names}}{{.}}{/names}}
after:
{{#names}}{{.}}{{/names}}
2016-10-16 18:18:33 +02:00
Michael Bayne b50919924b Doc updates. 2016-08-08 09:37:54 -07:00
Michael Bayne 88793cca0a [maven-release-plugin] prepare for next development iteration 2016-08-08 09:14:20 -07:00
Michael Bayne 76d4b38912 [maven-release-plugin] prepare release jmustache-1.13 2016-08-08 09:14:15 -07:00
Michael Bayne e6a9363fae Prep for 1.13 release. 2016-08-08 09:12:49 -07:00
Michael Bayne 96d9ba5e24 Some test fiddling to make things work in GWT. 2016-08-08 09:12:04 -07:00
Michael Bayne 9bb842ed20 Special case 'entrySet' on Map fetcher.
You can't normally reflectively access methods on Map because it has a
special fetcher, but being able to reflectively access 'entrySet' is
super useful when you want to iterate over the keys+values of a map, so
we're going to hack it in there. Ha!
2016-06-15 11:51:44 -07:00
Michael Bayne 1170d4500e Some toString impls to make debugging easier. 2016-06-15 11:51:44 -07:00
Michael Bayne 115f496947 Add means to obtain parent context(s) in Fragment.
Closes #77.
2016-05-15 11:07:22 -07:00
Michael Bayne 06347ba7eb Remind future me about submodules. 2016-04-29 10:04:34 -07:00
Michael Bayne 546f78318e Simple support for decompiling fragments.
There are limitations! See the javadoc for Template.Fragment.decompile.

Closes #75.
2016-04-14 08:32:07 -07:00
Michael Bayne 59c45a2da7 Demo/test custom collector that supports Optional. 2016-01-29 11:39:03 -08:00
Michael Bayne 5631d08338 Reference release 1.12 in the README. 2016-01-19 17:57:44 -08:00
Michael Bayne 49e59008fd [maven-release-plugin] prepare for next development iteration 2016-01-19 17:56:18 -08:00
Michael Bayne 855f1d33d2 [maven-release-plugin] prepare release jmustache-1.12 2016-01-19 17:56:14 -08:00
Michael Bayne 9eda17f85b Escape ` and = when escaping HTML.
They can be used for nefarious purposes on old IEs.

Refs wycats/handlebars.js@83b8e84
2015-12-24 13:48:07 -08:00
Michael Bayne ed15294419 OMG! GWT 2.8 is finally in beta. 2015-12-14 13:28:17 -08:00
Michael Bayne c1ddff1b6f Add further warning re defaultValue and nullValue.
This is not the first time someone has been confused by this.
2015-12-14 11:34:44 -08:00
Michael Bayne 51f5840363 Reinstate GWT 2.8.0 & tests. 2015-10-05 15:16:48 -07:00
Michael Bayne 6dc8e64702 Bump to 1.11. 2015-10-05 15:13:22 -07:00
Michael Bayne 667a1fecd2 [maven-release-plugin] prepare for next development iteration 2015-10-05 15:09:58 -07:00
Michael Bayne e520fed423 [maven-release-plugin] prepare release jmustache-1.11 2015-10-05 15:09:55 -07:00
Michael Bayne d217b41a67 Disable GWT tests so we can release.
We'll go back to GWT 2.8.0-SNAPSHOT after, so we can continue to test GWT, and
hopefully GWT 2.8.0 will ship sometime before 2020.
2015-10-05 15:08:57 -07:00
Michael Bayne a0a6b1fc99 A bunch of POM up-to-dating. 2015-10-05 15:02:03 -07:00
Michael Bayne f121c11e6f Added missing StringReader.close() method. 2015-09-21 16:13:27 -07:00
Michael Bayne ec7ea6a660 Revamped iterating over arrays to be GWT-compatible.
We no longer use reflection for any of that; we have a suite of primitive array
helpers that do what is needed.
2015-09-21 16:03:28 -07:00
Michael Bayne cbd80d1d08 Big test revamp to get tests running in GWT.
For some reason I sort of blocked from my mind the fact that none of the actual
tests were running in GWT. Really I was just testing that things compiled.

So now the tests actually run in GWT. This means I had to split the tests that
rely on method/field lookup via reflection into a separate file because that
stuff will never work with GWT. I also changed a bunch of the other tests not
to surreptitiously use reflection because they were ostensibly testing
something else, so no point in those tests being GWT-incompatible just for
kicks.

This also means we can't use JUnit 4 annotations (sigh, I wish GWT would step
out of the stone age, but that's a whole other fiasco that I don't even want to
think about). So some of the tests that were using @Test(expected=FooException)
had to be rewritten to manually catch the exception and fail if it was not
thrown.

Anyhow, now most of the tests are in fact running in GWT (when you do "mvn
integration-test") and the test that I expected should fail in GWT is in fact
failing. Yay!
2015-09-21 15:43:48 -07:00
Michael Bayne c49426db85 Redo primitive array support in GWT-compatible way.
There's unfortunately no sane way to do the same reflection-like array access
in GWT, so we just have to enumerate all of the primitive types.

I could have just left this only in the Java backend, but I would prefer to
avoid differences between behavior on the JVM and behavior in GWT whenever
possible.
2015-09-21 14:47:25 -07:00
Michael Bayne 4ee24a6b19 Add XML preamble. 2015-09-21 14:35:22 -07:00
Michael Bayne b9c48fa077 Reenable GWT unit testing, using 2.8.0-SNAPSHOT. 2015-09-21 14:34:57 -07:00
Masaki Mori 4b713862c8 Support index access on primitive arrays 2015-09-14 13:45:08 +09:00
Michael Bayne 2efcfb69ed Formatting tweak. 2015-09-09 14:40:00 -07:00
Michael Bayne 8a6c32d9db Merge pull request #68 from monae/patch-timezone
Fix broken test which depends on local timezone
2015-09-09 14:39:36 -07:00
Michael Bayne e33fdb1436 Merge pull request #69 from monae/patch-index
Catch exceptions caused by fetching with invalid indices
2015-09-09 14:37:48 -07:00
Masaki Mori b846605894 Catch exceptions caused by fetching with invalid indices 2015-09-09 11:17:19 +09:00