From bf3df7e526809b40a44e5cf7214dad53e03bc710 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 21 Jun 2011 12:18:20 +0200 Subject: [PATCH] If length can not be parsed, try again as property from the context. --- src/main/java/net/pterodactylus/sone/template/ParserFilter.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/template/ParserFilter.java b/src/main/java/net/pterodactylus/sone/template/ParserFilter.java index 2a4d5b4..1bacb8e 100644 --- a/src/main/java/net/pterodactylus/sone/template/ParserFilter.java +++ b/src/main/java/net/pterodactylus/sone/template/ParserFilter.java @@ -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"; -- 2.7.4