From: David ‘Bombe’ Roden Date: Tue, 21 Jun 2011 10:18:20 +0000 (+0200) Subject: If length can not be parsed, try again as property from the context. X-Git-Tag: 0.6.6^2~60 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bf3df7e526809b40a44e5cf7214dad53e03bc710;p=Sone.git If length can not be parsed, try again as property from the context. --- 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";