Skip to content

Commit

Permalink
Re-enable Guava stringify for HTML if its available on classpath
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlauer committed Nov 4, 2023
1 parent a765ae0 commit c586326
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
public interface RockerStringify {

static public final RockerStringify RAW = new RawStringify();
//static public final RockerStringify HTML = RockerRuntime.createDefaultHtmlStringify();
static public final RockerStringify HTML = new DefaultHtmlStringify();
// delegate creating the default HTML stringify so that if guava is on classpath, rocker will leverage guava's
// fast "escape" of HTML vs. the one built-in with rocker
static public final RockerStringify HTML = RockerRuntime.createDefaultHtmlStringify();
// static public final RockerStringify HTML = new DefaultHtmlStringify();

String s(String str);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public GuavaHtmlStringify() {

@Override
public String s(String str) {
// guava escape does not like nulls
if (str == null) {
return null;
}
return this.escaper.escape(str);
}

Expand Down
2 changes: 1 addition & 1 deletion rocker-test-template/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</dependency>

<!-- test -->
<!---->

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down

0 comments on commit c586326

Please sign in to comment.