If length can not be parsed, try again as property from the context.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 21 Jun 2011 10:18:20 +0000 (12:18 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 21 Jun 2011 10:18:20 +0000 (12:18 +0200)
src/main/java/net/pterodactylus/sone/template/ParserFilter.java

index 2a4d5b4..1bacb8e 100644 (file)
@@ -93,6 +93,13 @@ public class ParserFilter implements Filter {
                } catch (NumberFormatException nfe1) {
                        /* ignore. */
                }
+               if (length == -1) {
+                       try {
+                               length = Integer.parseInt(String.valueOf(templateContext.get(parameters.get("length"))));
+                       } catch (NumberFormatException nfe1) {
+                               /* ignore. */
+                       }
+               }
                String soneKey = parameters.get("sone");
                if (soneKey == null) {
                        soneKey = "sone";