toggle menu
Tornado.js
Get Dust
Guides
Getting Started
Using Helpers
Writing Helpers
Extending Tornado
Partials
Blocks and Inline Partials
Documentation
Tornado Syntax
Tornado Runtime API
Helper API
Extension API
Tornado CLI
Contributing
Tornado Watch
{#weather}
Weather in {location.city}
Current
{@weatherIcon code=item.condition.code desc=item.condition.text}{item.condition.text}{/weatherIcon}
{item.condition.temp}
{#item.forecast}
{date}
{@weatherIcon code=code desc=text}{text}{/weatherIcon}
{high}
{low}
{/item.forecast}
{:pending} {#locations}
{@repeat count=5}
{/repeat}
{/locations} {/weather}
Weather data provided by
Yahoo!
Weather icons provided by
Meteocons
.
{ weather: function() { var url = this.baseURL + this.YQLQuery(); return fetch(url).then(function(res) { return res.json().then(function(d) { return d.query.results.channel; }); }); }, YQLQuery: function() { var locationsQuery = this.locations.map(function(location) { return 'text="' + location + '"'; }).join(' OR '); var str = 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where ' + locationsQuery + ')'; return str.replace(' ', '%20').replace('=', '%3D').replace('"', '%22'); }, baseURL: 'https://query.yahooapis.com/v1/public/yql?format=json&q=', locations: [ 'Salt Lake City, UT', 'Mountain View, CA' ] }
Render
Actual output
Stringified output
Compiled Template
Abstract Syntax Tree