From a75dbed2e560de24577a9d4974830ec8c7ac1f74 Mon Sep 17 00:00:00 2001 From: Sam Pullara Date: Mon, 12 Jan 2015 11:07:57 -0800 Subject: [PATCH 1/6] remove the relativePath from poms for sbt --- compiler/pom.xml | 1 - handlebar/pom.xml | 1 - indy/pom.xml | 1 - scala-extensions/pom.xml | 1 - 4 files changed, 4 deletions(-) diff --git a/compiler/pom.xml b/compiler/pom.xml index 2355c375f..484103337 100644 --- a/compiler/pom.xml +++ b/compiler/pom.xml @@ -4,7 +4,6 @@ mustache.java com.github.spullara.mustache.java 0.8.18-SNAPSHOT - ../pom.xml 4.0.0 compiler diff --git a/handlebar/pom.xml b/handlebar/pom.xml index b2aa78ca2..d5da7f874 100644 --- a/handlebar/pom.xml +++ b/handlebar/pom.xml @@ -3,7 +3,6 @@ com.github.spullara.mustache.java mustache.java 0.8.18-SNAPSHOT - ../pom.xml 4.0.0 diff --git a/indy/pom.xml b/indy/pom.xml index 76b61e5f3..236ab9ab2 100644 --- a/indy/pom.xml +++ b/indy/pom.xml @@ -4,7 +4,6 @@ mustache.java com.github.spullara.mustache.java 0.8.18-SNAPSHOT - ../pom.xml 4.0.0 com.github.spullara.mustache.java diff --git a/scala-extensions/pom.xml b/scala-extensions/pom.xml index 8a58bdf91..03b76fad2 100644 --- a/scala-extensions/pom.xml +++ b/scala-extensions/pom.xml @@ -6,7 +6,6 @@ com.github.spullara.mustache.java mustache.java 0.8.18-SNAPSHOT - ../pom.xml scala-extensions From 9b359a1f9e6c0bd8a8f4b199d17b51ec74253524 Mon Sep 17 00:00:00 2001 From: txominpelu Date: Tue, 3 Mar 2015 18:41:25 +0100 Subject: [PATCH 2/6] Added scala 2.11 support to mustache.java-0.8.x --- scala-extensions/pom.xml | 2 +- .../scala-extensions-2.11/build.sbt | 11 ++ .../scala-extensions-2.11/pom.xml | 112 ++++++++++++++++++ .../java/com/twitter/mustache/Javadoc.java | 7 ++ .../twitter/mustache/ScalaObjectHandler.scala | 69 +++++++++++ .../twitter/mustache/ObjectHandlerTest.scala | 101 ++++++++++++++++ 6 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 scala-extensions/scala-extensions-2.11/build.sbt create mode 100644 scala-extensions/scala-extensions-2.11/pom.xml create mode 100644 scala-extensions/scala-extensions-2.11/src/main/java/com/twitter/mustache/Javadoc.java create mode 100644 scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/ScalaObjectHandler.scala create mode 100644 scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala diff --git a/scala-extensions/pom.xml b/scala-extensions/pom.xml index 03b76fad2..ee519a2a4 100644 --- a/scala-extensions/pom.xml +++ b/scala-extensions/pom.xml @@ -15,7 +15,7 @@ scala-extensions-2.8 scala-extensions-2.9 scala-extensions-2.10 - + scala-extensions-2.11 pom diff --git a/scala-extensions/scala-extensions-2.11/build.sbt b/scala-extensions/scala-extensions-2.11/build.sbt new file mode 100644 index 000000000..2754387c7 --- /dev/null +++ b/scala-extensions/scala-extensions-2.11/build.sbt @@ -0,0 +1,11 @@ +lazy val `scala-extensions-2-10` = project + .in(file(".")) + .settings( + resolvers += Resolver.mavenLocal, + scalaVersion := "2.11.4", + libraryDependencies ++= Seq( + "com.github.spullara.mustache.java" % "compiler" % "0.8.17-SNAPSHOT", + "junit" % "junit" % "4.8.2" % "test", + "com.twitter" % "util-core" % "6.23.0" + ) + ) diff --git a/scala-extensions/scala-extensions-2.11/pom.xml b/scala-extensions/scala-extensions-2.11/pom.xml new file mode 100644 index 000000000..7bdde696a --- /dev/null +++ b/scala-extensions/scala-extensions-2.11/pom.xml @@ -0,0 +1,112 @@ + + + + scala-extensions + com.github.spullara.mustache.java + 0.8.18-SNAPSHOT + ../pom.xml + + 4.0.0 + scala-extensions-2.11 + jar + + scala-extensions-2.11 + Scala extensions for mustache.java + http://github.com/spullara/mustache.java + + + + Apache License 2.0 + http://www.apache.org/licenses/LICENSE-2.0 + repo + + + + + + Sam Pullara + sam@sampullara.com + http://www.javarants.com + + + + + + Twitter + http://maven.twttr.com/ + + + + + UTF-8 + + + + + com.github.spullara.mustache.java + compiler + 0.8.18-SNAPSHOT + + + junit + junit + 4.8.2 + test + + + + org.scala-lang + scala-library + 2.11.4 + provided + + + com.twitter + util-core_2.11 + 6.23.0 + provided + + + + + + + + org.scala-tools + maven-scala-plugin + 2.14.1 + + + org.scala-tools + maven-scala-plugin + 2.14.1 + + + + + + + + org.scala-tools + maven-scala-plugin + + + scala-compile-first + process-resources + + add-source + compile + + + + scala-test-compile + process-test-resources + + testCompile + + + + + + + diff --git a/scala-extensions/scala-extensions-2.11/src/main/java/com/twitter/mustache/Javadoc.java b/scala-extensions/scala-extensions-2.11/src/main/java/com/twitter/mustache/Javadoc.java new file mode 100644 index 000000000..5229234aa --- /dev/null +++ b/scala-extensions/scala-extensions-2.11/src/main/java/com/twitter/mustache/Javadoc.java @@ -0,0 +1,7 @@ +package com.twitter.mustache; + +/** + * Created by sam on 10/8/14. + */ +public class Javadoc { +} diff --git a/scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/ScalaObjectHandler.scala b/scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/ScalaObjectHandler.scala new file mode 100644 index 000000000..87f88f5b6 --- /dev/null +++ b/scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/ScalaObjectHandler.scala @@ -0,0 +1,69 @@ +package com.twitter.mustache + +import collection.JavaConversions._ +import com.github.mustachejava.Iteration +import com.github.mustachejava.reflect.ReflectionObjectHandler +import java.io.Writer +import java.lang.reflect.{Field, Method} +import runtime.BoxedUnit +import scala.reflect.ClassTag + +/** + * Plain old scala handler that doesn't depend on Twitter libraries. + */ +class ScalaObjectHandler extends ReflectionObjectHandler { + + // Allow any method or field + override def checkMethod(member: Method) {} + + override def checkField(member: Field) {} + + override def coerce(value: AnyRef) = { + value match { + case m: collection.Map[_, _] => mapAsJavaMap(m) + case u: BoxedUnit => null + case Some(some: AnyRef) => coerce(some) + case None => null + case _ => value + } + } + + override def iterate(iteration: Iteration, writer: Writer, value: AnyRef, scopes: Array[AnyRef]) = { + value match { + case TraversableAnyRef(t) => { + var newWriter = writer + t foreach { + next => + newWriter = iteration.next(newWriter, coerce(next), scopes) + } + newWriter + } + case n: Number => if (n.intValue() == 0) writer else iteration.next(writer, coerce(value), scopes) + case _ => super.iterate(iteration, writer, value, scopes) + } + } + + override def falsey(iteration: Iteration, writer: Writer, value: AnyRef, scopes: Array[AnyRef]) = { + value match { + case TraversableAnyRef(t) => { + if (t.isEmpty) { + iteration.next(writer, value, scopes) + } else { + writer + } + } + case n: Number => if (n.intValue() == 0) iteration.next(writer, coerce(value), scopes) else writer + case _ => super.falsey(iteration, writer, value, scopes) + } + } + + val TraversableAnyRef = new Def[Traversable[AnyRef]] + class Def[C: ClassTag] { + def unapply[X: ClassTag](x: X): Option[C] = { + x match { + case c: C => Some(c) + case _ => None + } + } + } +} diff --git a/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala b/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala new file mode 100644 index 000000000..e18bc1d9e --- /dev/null +++ b/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala @@ -0,0 +1,101 @@ +package com.twitter.mustache + +import com.github.mustachejava.DefaultMustacheFactory +import com.twitter.util.{Future, FuturePool} +import java.io.{StringWriter, StringReader} +import java.util.concurrent.{Callable, Executors} +import org.junit.{Assert, Test} + +class ObjectHandlerTest { + + @Test + def testMap() { + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new ScalaObjectHandler) + val m = mf.compile( + new StringReader("{{#map}}{{test}}{{test2}}{{/map}}"), + "helloworld" + ) + val sw = new StringWriter + val w = m.execute(sw, Map( "map" -> Map( "test" -> "fred" ) ) ).close() + Assert.assertEquals("fred", sw.toString()) + } + + @Test + def testScalaHandler() { + val pool = Executors.newCachedThreadPool() + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new ScalaObjectHandler) + mf.setExecutorService(pool) + val m = mf.compile( + new StringReader("{{#list}}{{optionalHello}}, {{futureWorld}}!" + + "{{#test}}?{{/test}}{{^test}}!{{/test}}{{#num}}?{{/num}}{{^num}}!{{/num}}" + + "{{#map}}{{value}}{{/map}}\n{{/list}}"), + "helloworld" + ) + val sw = new StringWriter + val writer = m.execute(sw, new { + val list = Seq(new { + lazy val optionalHello = Some("Hello") + val futureWorld = new Callable[String] { + def call(): String = "world" + } + val test = true + val num = 0 + }, new { + val optionalHello = Some("Goodbye") + val futureWorld = new Callable[String] { + def call(): String = "thanks for all the fish" + } + lazy val test = false + val map = Map(("value", "test")) + val num = 1 + }) + }) + // You must use close if you use concurrent latched writers + writer.close() + Assert.assertEquals("Hello, world!?!\nGoodbye, thanks for all the fish!!?test\n", sw.toString) + } + + @Test + def testScalaStream() { + val pool = Executors.newCachedThreadPool() + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new ScalaObjectHandler) + mf.setExecutorService(pool) + val m = mf.compile(new StringReader("{{#stream}}{{value}}{{/stream}}"), "helloworld") + val sw = new StringWriter + val writer = m.execute(sw, new { + val stream = Stream( + new { val value = "hello" }, + new { val value = "world" }) + }) + writer.close() + Assert.assertEquals("helloworld", sw.toString) + } + + @Test + def testUnit() { + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new ScalaObjectHandler) + val m = mf.compile(new StringReader("{{test}}"), "unit") + val sw = new StringWriter + m.execute(sw, new { + val test = if (false) "test" + }).close() + Assert.assertEquals("", sw.toString) + } + + @Test + def testOptions() { + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new ScalaObjectHandler) + val m = mf.compile(new StringReader("{{foo}}{{bar}}"), "unit") + val sw = new StringWriter + m.execute(sw, new { + val foo = Some("Hello") + val bar = None + }).close() + Assert.assertEquals("Hello", sw.toString) + } +} From 96d4d6779edb49159b3767d788d15f46a6ae8a98 Mon Sep 17 00:00:00 2001 From: Matt Landis Date: Wed, 5 Aug 2015 21:54:19 -0700 Subject: [PATCH 3/6] 0.8.x: add TwitterObjectHandler to scala-extensions-2.10 and -2.11 --- .../scala-extensions-2.10/build.sbt | 2 +- .../scala-extensions-2.10/pom.xml | 4 +- .../mustache/TwitterObjectHandler.scala | 21 +++++++++++ .../twitter/mustache/ObjectHandlerTest.scala | 37 +++++++++++++++++++ .../mustache/TwitterObjectHandler.scala | 21 +++++++++++ .../twitter/mustache/ObjectHandlerTest.scala | 37 +++++++++++++++++++ 6 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 scala-extensions/scala-extensions-2.10/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala create mode 100644 scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala diff --git a/scala-extensions/scala-extensions-2.10/build.sbt b/scala-extensions/scala-extensions-2.10/build.sbt index f84f37afd..8f92e1d41 100644 --- a/scala-extensions/scala-extensions-2.10/build.sbt +++ b/scala-extensions/scala-extensions-2.10/build.sbt @@ -6,6 +6,6 @@ lazy val `scala-extensions-2-10` = project libraryDependencies ++= Seq( "com.github.spullara.mustache.java" % "compiler" % "0.8.17-SNAPSHOT", "junit" % "junit" % "4.8.2" % "test", - "com.twitter" % "util-core" % "6.12.1" + "com.twitter" % "util-core" % "6.23.0" ) ) \ No newline at end of file diff --git a/scala-extensions/scala-extensions-2.10/pom.xml b/scala-extensions/scala-extensions-2.10/pom.xml index 95a984bcf..67fd36704 100644 --- a/scala-extensions/scala-extensions-2.10/pom.xml +++ b/scala-extensions/scala-extensions-2.10/pom.xml @@ -62,8 +62,8 @@ com.twitter - util-core - 6.12.1 + util-core_2.10 + 6.23.0 provided diff --git a/scala-extensions/scala-extensions-2.10/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala b/scala-extensions/scala-extensions-2.10/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala new file mode 100644 index 000000000..52897566b --- /dev/null +++ b/scala-extensions/scala-extensions-2.10/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala @@ -0,0 +1,21 @@ +package com.twitter.mustache + +import com.twitter.util.Future +import java.util.concurrent.Callable + +class TwitterObjectHandler extends ScalaObjectHandler { + + override def coerce(value: Object) = { + value match { + case f: Future[_] => { + new Callable[Any]() { + def call() = { + val value = f.get().asInstanceOf[Object] + coerce(value) + } + } + } + case _ => super.coerce(value) + } + } +} diff --git a/scala-extensions/scala-extensions-2.10/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala b/scala-extensions/scala-extensions-2.10/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala index e18bc1d9e..a556d7272 100644 --- a/scala-extensions/scala-extensions-2.10/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala +++ b/scala-extensions/scala-extensions-2.10/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala @@ -21,6 +21,43 @@ class ObjectHandlerTest { Assert.assertEquals("fred", sw.toString()) } + @Test + def testTwitterHandler() { + val pool = Executors.newCachedThreadPool() + val futurePool = FuturePool(pool) + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new TwitterObjectHandler) + mf.setExecutorService(pool) + val m = mf.compile( + new StringReader("{{#list}}{{optionalHello}}, {{futureWorld}}!" + + "{{#test}}?{{/test}}{{^test}}!{{/test}}{{#num}}?{{/num}}{{^num}}!{{/num}}" + + "{{#map}}{{value}}{{/map}}\n{{/list}}"), + "helloworld" + ) + val sw = new StringWriter + val writer = m.execute(sw, new { + val list = Seq(new { + lazy val optionalHello = Some("Hello") + val futureWorld = futurePool { + "world" + } + val test = true + val num = 0 + }, new { + val optionalHello = Some("Goodbye") + val futureWorld = futurePool { + "thanks for all the fish" + } + lazy val test = Future { false } + val map = Map(("value", "test")) + val num = 1 + }) + }) + // You must use close if you use concurrent latched writers + writer.close() + Assert.assertEquals("Hello, world!?!\nGoodbye, thanks for all the fish!!?test\n", sw.toString) + } + @Test def testScalaHandler() { val pool = Executors.newCachedThreadPool() diff --git a/scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala b/scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala new file mode 100644 index 000000000..52897566b --- /dev/null +++ b/scala-extensions/scala-extensions-2.11/src/main/scala/com/twitter/mustache/TwitterObjectHandler.scala @@ -0,0 +1,21 @@ +package com.twitter.mustache + +import com.twitter.util.Future +import java.util.concurrent.Callable + +class TwitterObjectHandler extends ScalaObjectHandler { + + override def coerce(value: Object) = { + value match { + case f: Future[_] => { + new Callable[Any]() { + def call() = { + val value = f.get().asInstanceOf[Object] + coerce(value) + } + } + } + case _ => super.coerce(value) + } + } +} diff --git a/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala b/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala index e18bc1d9e..a556d7272 100644 --- a/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala +++ b/scala-extensions/scala-extensions-2.11/src/test/scala/com/twitter/mustache/ObjectHandlerTest.scala @@ -21,6 +21,43 @@ class ObjectHandlerTest { Assert.assertEquals("fred", sw.toString()) } + @Test + def testTwitterHandler() { + val pool = Executors.newCachedThreadPool() + val futurePool = FuturePool(pool) + val mf = new DefaultMustacheFactory() + mf.setObjectHandler(new TwitterObjectHandler) + mf.setExecutorService(pool) + val m = mf.compile( + new StringReader("{{#list}}{{optionalHello}}, {{futureWorld}}!" + + "{{#test}}?{{/test}}{{^test}}!{{/test}}{{#num}}?{{/num}}{{^num}}!{{/num}}" + + "{{#map}}{{value}}{{/map}}\n{{/list}}"), + "helloworld" + ) + val sw = new StringWriter + val writer = m.execute(sw, new { + val list = Seq(new { + lazy val optionalHello = Some("Hello") + val futureWorld = futurePool { + "world" + } + val test = true + val num = 0 + }, new { + val optionalHello = Some("Goodbye") + val futureWorld = futurePool { + "thanks for all the fish" + } + lazy val test = Future { false } + val map = Map(("value", "test")) + val num = 1 + }) + }) + // You must use close if you use concurrent latched writers + writer.close() + Assert.assertEquals("Hello, world!?!\nGoodbye, thanks for all the fish!!?test\n", sw.toString) + } + @Test def testScalaHandler() { val pool = Executors.newCachedThreadPool() From 807b77137d75759b628deaae4afd8720d6d61fde Mon Sep 17 00:00:00 2001 From: Sam Pullara Date: Mon, 24 Aug 2015 11:18:02 -0700 Subject: [PATCH 4/6] [maven-release-plugin] prepare release mustache.java-0.8.18 --- codegen/pom.xml | 6 +++--- compiler/pom.xml | 4 ++-- handlebar/pom.xml | 4 ++-- indy/pom.xml | 8 ++++---- mustache-maven-plugin/pom.xml | 6 +++--- pom.xml | 4 ++-- scala-extensions/pom.xml | 2 +- scala-extensions/scala-extensions-2.10/pom.xml | 4 ++-- scala-extensions/scala-extensions-2.11/pom.xml | 4 ++-- scala-extensions/scala-extensions-2.8/pom.xml | 4 ++-- scala-extensions/scala-extensions-2.9/pom.xml | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/codegen/pom.xml b/codegen/pom.xml index 268a87150..3c93b59cf 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -3,7 +3,7 @@ mustache.java com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 4.0.0 @@ -16,7 +16,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 @@ -35,7 +35,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 tests test diff --git a/compiler/pom.xml b/compiler/pom.xml index 484103337..cf1ce2fd8 100644 --- a/compiler/pom.xml +++ b/compiler/pom.xml @@ -3,7 +3,7 @@ mustache.java com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 4.0.0 compiler @@ -24,7 +24,7 @@ scm:git:git://github.com/spullara/mustache.java.git http://github.com/spullara/mustache.java - HEAD + mustache.java-0.8.18 diff --git a/handlebar/pom.xml b/handlebar/pom.xml index d5da7f874..0ec38872c 100644 --- a/handlebar/pom.xml +++ b/handlebar/pom.xml @@ -2,7 +2,7 @@ com.github.spullara.mustache.java mustache.java - 0.8.18-SNAPSHOT + 0.8.18 4.0.0 @@ -27,7 +27,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 org.codehaus.jackson diff --git a/indy/pom.xml b/indy/pom.xml index 236ab9ab2..94f98ed9c 100644 --- a/indy/pom.xml +++ b/indy/pom.xml @@ -3,12 +3,12 @@ mustache.java com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 4.0.0 com.github.spullara.mustache.java indy - 0.8.18-SNAPSHOT + 0.8.18 bundle indy @@ -19,7 +19,7 @@ com.github.spullara.mustache.java codegen - 0.8.18-SNAPSHOT + 0.8.18 @@ -46,7 +46,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 tests test diff --git a/mustache-maven-plugin/pom.xml b/mustache-maven-plugin/pom.xml index 68c930d76..9a3bc6140 100644 --- a/mustache-maven-plugin/pom.xml +++ b/mustache-maven-plugin/pom.xml @@ -4,10 +4,10 @@ com.github.spullara.mustache.java mustache.java - 0.8.18-SNAPSHOT + 0.8.18 mustache-maven-plugin - 0.8.18-SNAPSHOT + 0.8.18 maven-plugin mustache-maven-plugin Maven Mojo http://maven.apache.org @@ -59,7 +59,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 diff --git a/pom.xml b/pom.xml index 851c96155..41c3be3f7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.spullara.mustache.java mustache.java - 0.8.18-SNAPSHOT + 0.8.18 Implementation of the Mustache language in Java. @@ -48,7 +48,7 @@ scm:git:git@github.com:spullara/mustache.java.git scm:git:git@github.com:spullara/mustache.java.git scm:git:git@github.com:spullara/mustache.java.git - HEAD + mustache.java-0.8.18 diff --git a/scala-extensions/pom.xml b/scala-extensions/pom.xml index ee519a2a4..864d81606 100644 --- a/scala-extensions/pom.xml +++ b/scala-extensions/pom.xml @@ -5,7 +5,7 @@ com.github.spullara.mustache.java mustache.java - 0.8.18-SNAPSHOT + 0.8.18 scala-extensions diff --git a/scala-extensions/scala-extensions-2.10/pom.xml b/scala-extensions/scala-extensions-2.10/pom.xml index 67fd36704..47dcefd9d 100644 --- a/scala-extensions/scala-extensions-2.10/pom.xml +++ b/scala-extensions/scala-extensions-2.10/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 junit diff --git a/scala-extensions/scala-extensions-2.11/pom.xml b/scala-extensions/scala-extensions-2.11/pom.xml index 7bdde696a..7cc82a653 100644 --- a/scala-extensions/scala-extensions-2.11/pom.xml +++ b/scala-extensions/scala-extensions-2.11/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 junit diff --git a/scala-extensions/scala-extensions-2.8/pom.xml b/scala-extensions/scala-extensions-2.8/pom.xml index c754c54e5..0066a8d2e 100644 --- a/scala-extensions/scala-extensions-2.8/pom.xml +++ b/scala-extensions/scala-extensions-2.8/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 junit diff --git a/scala-extensions/scala-extensions-2.9/pom.xml b/scala-extensions/scala-extensions-2.9/pom.xml index 7ae236bde..cb33f7842 100644 --- a/scala-extensions/scala-extensions-2.9/pom.xml +++ b/scala-extensions/scala-extensions-2.9/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18-SNAPSHOT + 0.8.18 ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18-SNAPSHOT + 0.8.18 junit From 27d3b4e7f3505d76361d93880d12e5ffba1d3492 Mon Sep 17 00:00:00 2001 From: Sam Pullara Date: Mon, 24 Aug 2015 11:18:07 -0700 Subject: [PATCH 5/6] [maven-release-plugin] prepare for next development iteration --- codegen/pom.xml | 6 +++--- compiler/pom.xml | 4 ++-- handlebar/pom.xml | 4 ++-- indy/pom.xml | 8 ++++---- mustache-maven-plugin/pom.xml | 6 +++--- pom.xml | 4 ++-- scala-extensions/pom.xml | 2 +- scala-extensions/scala-extensions-2.10/pom.xml | 4 ++-- scala-extensions/scala-extensions-2.11/pom.xml | 4 ++-- scala-extensions/scala-extensions-2.8/pom.xml | 4 ++-- scala-extensions/scala-extensions-2.9/pom.xml | 4 ++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/codegen/pom.xml b/codegen/pom.xml index 3c93b59cf..9a0d11de2 100644 --- a/codegen/pom.xml +++ b/codegen/pom.xml @@ -3,7 +3,7 @@ mustache.java com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT 4.0.0 @@ -16,7 +16,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT @@ -35,7 +35,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT tests test diff --git a/compiler/pom.xml b/compiler/pom.xml index cf1ce2fd8..5c810f354 100644 --- a/compiler/pom.xml +++ b/compiler/pom.xml @@ -3,7 +3,7 @@ mustache.java com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT 4.0.0 compiler @@ -24,7 +24,7 @@ scm:git:git://github.com/spullara/mustache.java.git http://github.com/spullara/mustache.java - mustache.java-0.8.18 + HEAD diff --git a/handlebar/pom.xml b/handlebar/pom.xml index 0ec38872c..d452ec9ec 100644 --- a/handlebar/pom.xml +++ b/handlebar/pom.xml @@ -2,7 +2,7 @@ com.github.spullara.mustache.java mustache.java - 0.8.18 + 0.8.19-SNAPSHOT 4.0.0 @@ -27,7 +27,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT org.codehaus.jackson diff --git a/indy/pom.xml b/indy/pom.xml index 94f98ed9c..3644a8dbf 100644 --- a/indy/pom.xml +++ b/indy/pom.xml @@ -3,12 +3,12 @@ mustache.java com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT 4.0.0 com.github.spullara.mustache.java indy - 0.8.18 + 0.8.19-SNAPSHOT bundle indy @@ -19,7 +19,7 @@ com.github.spullara.mustache.java codegen - 0.8.18 + 0.8.19-SNAPSHOT @@ -46,7 +46,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT tests test diff --git a/mustache-maven-plugin/pom.xml b/mustache-maven-plugin/pom.xml index 9a3bc6140..a496f18f4 100644 --- a/mustache-maven-plugin/pom.xml +++ b/mustache-maven-plugin/pom.xml @@ -4,10 +4,10 @@ com.github.spullara.mustache.java mustache.java - 0.8.18 + 0.8.19-SNAPSHOT mustache-maven-plugin - 0.8.18 + 0.8.19-SNAPSHOT maven-plugin mustache-maven-plugin Maven Mojo http://maven.apache.org @@ -59,7 +59,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT diff --git a/pom.xml b/pom.xml index 41c3be3f7..152b427cb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.github.spullara.mustache.java mustache.java - 0.8.18 + 0.8.19-SNAPSHOT Implementation of the Mustache language in Java. @@ -48,7 +48,7 @@ scm:git:git@github.com:spullara/mustache.java.git scm:git:git@github.com:spullara/mustache.java.git scm:git:git@github.com:spullara/mustache.java.git - mustache.java-0.8.18 + HEAD diff --git a/scala-extensions/pom.xml b/scala-extensions/pom.xml index 864d81606..147bdd58f 100644 --- a/scala-extensions/pom.xml +++ b/scala-extensions/pom.xml @@ -5,7 +5,7 @@ com.github.spullara.mustache.java mustache.java - 0.8.18 + 0.8.19-SNAPSHOT scala-extensions diff --git a/scala-extensions/scala-extensions-2.10/pom.xml b/scala-extensions/scala-extensions-2.10/pom.xml index 47dcefd9d..4d14d221d 100644 --- a/scala-extensions/scala-extensions-2.10/pom.xml +++ b/scala-extensions/scala-extensions-2.10/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT junit diff --git a/scala-extensions/scala-extensions-2.11/pom.xml b/scala-extensions/scala-extensions-2.11/pom.xml index 7cc82a653..9ccf67568 100644 --- a/scala-extensions/scala-extensions-2.11/pom.xml +++ b/scala-extensions/scala-extensions-2.11/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT junit diff --git a/scala-extensions/scala-extensions-2.8/pom.xml b/scala-extensions/scala-extensions-2.8/pom.xml index 0066a8d2e..bba43b087 100644 --- a/scala-extensions/scala-extensions-2.8/pom.xml +++ b/scala-extensions/scala-extensions-2.8/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT junit diff --git a/scala-extensions/scala-extensions-2.9/pom.xml b/scala-extensions/scala-extensions-2.9/pom.xml index cb33f7842..3a2301fb9 100644 --- a/scala-extensions/scala-extensions-2.9/pom.xml +++ b/scala-extensions/scala-extensions-2.9/pom.xml @@ -3,7 +3,7 @@ scala-extensions com.github.spullara.mustache.java - 0.8.18 + 0.8.19-SNAPSHOT ../pom.xml 4.0.0 @@ -45,7 +45,7 @@ com.github.spullara.mustache.java compiler - 0.8.18 + 0.8.19-SNAPSHOT junit From 06d95d4352b35518fd5b855811cd8e2572610abb Mon Sep 17 00:00:00 2001 From: Sam Pullara Date: Tue, 22 Dec 2015 09:23:22 -0800 Subject: [PATCH 6/6] backport: Add additional escape characters for non-standard quotes or no quotes for attributes --- .../main/java/com/github/mustachejava/util/HtmlEscaper.java | 6 ++++++ .../java/com/github/mustachejava/util/HtmlEscaperTest.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/compiler/src/main/java/com/github/mustachejava/util/HtmlEscaper.java b/compiler/src/main/java/com/github/mustachejava/util/HtmlEscaper.java index bd4ee8429..a60fce6bb 100644 --- a/compiler/src/main/java/com/github/mustachejava/util/HtmlEscaper.java +++ b/compiler/src/main/java/com/github/mustachejava/util/HtmlEscaper.java @@ -47,6 +47,12 @@ public static void escape(String value, Writer writer, boolean escapeEscaped) { case '\'': position = append(value, writer, position, i, "'"); break; + case '=': + position = append(value, writer, position, i, "="); + break; + case '`': + position = append(value, writer, position, i, "`"); + break; } } } diff --git a/compiler/src/test/java/com/github/mustachejava/util/HtmlEscaperTest.java b/compiler/src/test/java/com/github/mustachejava/util/HtmlEscaperTest.java index b605a8aa8..46c20936b 100644 --- a/compiler/src/test/java/com/github/mustachejava/util/HtmlEscaperTest.java +++ b/compiler/src/test/java/com/github/mustachejava/util/HtmlEscaperTest.java @@ -78,5 +78,10 @@ public void testEscape() throws Exception { escape("\"Hello\" &&#zz 'world'!\n&sam&#", sw, true); assertEquals(""Hello" &amp&#zz 'world'! &sam&#", sw.toString()); } + { + StringWriter sw = new StringWriter(); + escape("\"Hello\" =` 'world'!", sw, true); + assertEquals(""Hello" =` 'world'!", sw.toString()); + } } }