> Here's the page on how to write plugins
> http://code.google.com/closure/templates/docs/plugins.html#functions
> I haven't done it
> Good luck,
> --Juan
> On Thu, Feb 23, 2012 at 1:15 PM, Ben Short <b...@benshort.co.uk> wrote:
>> Hi Juan,
>> I assumed that it was just better documentation for closure-templates
>> so I don't have the jive plugins.
>> Can I write a plugin? Do I just need to defined a function called
>> formatDate and it will be called?
>> Ben
>> On 23 February 2012 21:06, Juan Mendes <mendesj...@gmail.com> wrote:
>> > It looks like Jive adds some custom functions, I've never seen
>> > formatDat.
>> > Are you sure you're including the Jive plugins?
>> > --Juan
>> > On Thu, Feb 23, 2012 at 12:34 PM, Ben Short <b...@benshort.co.uk> wrote:
>> >> Hi,
>> >> I'm trying to format a unix epoc into a human readable date as shown
>> >> here https://community.jivesoftware.com/docs/DOC-42113#Formatting_Dates
>> >> but I get an error when I try to compile it.
>> >> My soy file:
>> >> {namespace nalps.map.mockup}
>> >> /**
>> >> * @param speedLimit
>> >> * @param name
>> >> * @param carCount
>> >> * @param peakSpeed
>> >> * @param averageSpeed
>> >> * @param temperature
>> >> * @param windSpeed
>> >> * @param windDirection
>> >> * @param lastUpdated
>> >> */
>> >> {template .speedSign}
>> >> <table class="speed-sign-table">
>> >> <tr>
>> >> <td class="speed-sign-icon-cell">
>> >> <img class="speed-sign-icon" src="images/
>> >> {$speedLimit}.png" />
>> >> </td>
>> >> <td>{$name}</td>
>> >> </tr>
>> >> <tr>
>> >> <td colspan="2">Count: {$carCount}cpm</td>
>> >> </tr>
>> >> <tr>
>> >> <td colspan="2">Peak: {$peakSpeed}mph</td>
>> >> </tr>
>> >> <tr>
>> >> <td colspan="2">Average: {$averageSpeed}mph</td>
>> >> </tr>
>> >> {if $temperature}
>> >> <tr>
>> >> <td colspan="2">Temperature: {$temperature}°C</td>
>> >> </tr>
>> >> {/if}
>> >> {if $windSpeed}
>> >> <tr>
>> >> <td colspan="2">Wind speed: {$windSpeed}mph</td>
>> >> </tr>
>> >> {/if}
>> >> {if $windDirection}
>> >> <tr>
>> >> <td colspan="2">Wind direction: {$windDirection}mph</td>
>> >> </tr>
>> >> {/if}
>> >> <tr>
>> >> <td colspan="2">Last updated:
>> >> {formatDate($lastUpdated,'long','date')}</td>
>> >> </tr>
>> >> <tr>
>> >> <td> </td>
>> >> <td align="right"><a href="">Refresh</a></td>
>> >> </tr>
>> >> </table>
>> >> {/template}
>> >> Compile output:
>> >> Exception in thread "main"
>> >> com.google.template.soy.base.SoySyntaxException: In file templates.soy:
>> >> 46: Unrecognized function 'formatDate' (function call
>> >> "formatDate($lastUpdated, 'long', 'date')").
>> >> at com.google.template.soy.parsepasses.CheckFunctionCallsVisitor
>> >> $CheckFunctionCallsExprVisitor.visitFunctionNode(CheckFunctionCallsVisitor. java:
>> >> 173)
>> >> at
>> >> com.google.template.soy.exprtree.AbstractExprNodeVisitor.visit(AbstractExpr NodeVisitor.java:
>> >> 114)
>> >> at
>> >> com.google.template.soy.exprtree.AbstractExprNodeVisitor.visit(AbstractExpr NodeVisitor.java:
>> >> 69)
>> >> at
>> >> com.google.template.soy.basetree.AbstractNodeVisitor.visitChildren(Abstract NodeVisitor.java:
>> >> 58)
>> >> at
>> >> com.google.template.soy.exprtree.AbstractExprNodeVisitor.visitChildren(Abst ractExprNodeVisitor.java:
>> >> 127)
>> >> at com.google.template.soy.parsepasses.CheckFunctionCallsVisitor
>> >> $CheckFunctionCallsExprVisitor.visitExprNode(CheckFunctionCallsVisitor.java :
>> >> 125)
>> >> at
>> >> com.google.template.soy.exprtree.AbstractExprNodeVisitor.visitExprRootNode( AbstractExprNodeVisitor.java:
>> >> 150)
>> >> at
>> >> com.google.template.soy.exprtree.AbstractExprNodeVisitor.visit(AbstractExpr NodeVisitor.java:
>> >> 76)
>> >> at
>> >> com.google.template.soy.exprtree.AbstractExprNodeVisitor.visit(AbstractExpr NodeVisitor.java:
>> >> 69)
>> >> at
>> >> com.google.template.soy.basetree.AbstractNodeVisitor.exec(AbstractNodeVisit or.java:
>> >> 39)
>> >> at
>> >> com.google.template.soy.parsepasses.CheckFunctionCallsVisitor.visitSoyNode( CheckFunctionCallsVisitor.java:
>> >> 89)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitPrintNode(Abstr actSoyNodeVisitor.java:
>> >> 216)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 83)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 54)
>> >> at
>> >> com.google.template.soy.basetree.AbstractNodeVisitor.visitChildren(Abstract NodeVisitor.java:
>> >> 58)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitChildren(Abstra ctSoyNodeVisitor.java:
>> >> 121)
>> >> at
>> >> com.google.template.soy.parsepasses.CheckFunctionCallsVisitor.visitSoyNode( CheckFunctionCallsVisitor.java:
>> >> 102)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitTemplateNode(Ab stractSoyNodeVisitor.java:
>> >> 160)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitTemplateBasicNo de(AbstractSoyNodeVisitor.java:
>> >> 152)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 64)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 54)
>> >> at
>> >> com.google.template.soy.basetree.AbstractNodeVisitor.visitChildren(Abstract NodeVisitor.java:
>> >> 58)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitChildren(Abstra ctSoyNodeVisitor.java:
>> >> 121)
>> >> at
>> >> com.google.template.soy.parsepasses.CheckFunctionCallsVisitor.visitSoyNode( CheckFunctionCallsVisitor.java:
>> >> 102)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitSoyFileNode(Abs tractSoyNodeVisitor.java:
>> >> 148)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 62)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 54)
>> >> at
>> >> com.google.template.soy.basetree.AbstractNodeVisitor.visitChildren(Abstract NodeVisitor.java:
>> >> 58)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitChildren(Abstra ctSoyNodeVisitor.java:
>> >> 121)
>> >> at
>> >> com.google.template.soy.parsepasses.CheckFunctionCallsVisitor.visitSoyNode( CheckFunctionCallsVisitor.java:
>> >> 102)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visitSoyFileSetNode( AbstractSoyNodeVisitor.java:
>> >> 144)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 61)
>> >> at
>> >> com.google.template.soy.soytree.AbstractSoyNodeVisitor.visit(AbstractSoyNod eVisitor.java:
>> >> 54)
>> >> at
>> >> com.google.template.soy.basetree.AbstractNodeVisitor.exec(AbstractNodeVisit or.java:
>> >> 39)
>> >> at
>> >> com.google.template.soy.SoyFileSet.runMiddleendPasses(SoyFileSet.java:
>> >> 792)
>> >> at
>> >> com.google.template.soy.SoyFileSet.compileToJsSrcFiles(SoyFileSet.java:
>> >> 733)
>> >> at
>> >> com.google.template.soy.SoyToJsSrcCompiler.execMain(SoyToJsSrcCompiler.java :
>> >> 255)
>> >> at
>> >> com.google.template.soy.SoyToJsSrcCompiler.main(SoyToJsSrcCompiler.java:
>> >> 205)
>> >> Am I missing an external lib or something?
>> >> Regards
>> >> Ben
>> > --
>> > Juan Mendes
> --
> Juan Mendes