Comments (5)
What should the behaviour of this be? -
#set($i = 1)
#foreach ($i in [1,2,3])#end
$i
from airspeed.
If I know that, I can figure out how best to fix it. I don't have an official Velocity lying around to test it with. :-)
from airspeed.
Hey, thanks for the quick answer.
I just ran a quick test with the official engine: In this case the variable outside the foreach block stays untouched and is rendered with the same value as above the foreach block. Like in this test case (which currently succeeds): flofuchs@a4b763c
def test_no_assignment_to_outer_var_if_same_varname_in_block(self):
template = airspeed.Template(
"#set($i = 1)$i,"
"#foreach ($i in [2, 3, 4])$i,#set($i = $i)#end"
"$i")
self.assertEquals("1,2,3,4,1", template.merge({}))
from airspeed.
Done, and released in 0.5.2. Let me know if you experience any issues.
from airspeed.
Awesome, thanks a ton!
from airspeed.
Related Issues (20)
- order of operations non-standard HOT 1
- Add feature to check VTL syntax HOT 2
- Csv Reader not treated as Iterable?
- Upgrade the version of the dependent library - "cache-tools"
- Remove dev suffix from release versions HOT 2
- Why doesn't airspeed support evaluate? HOT 3
- Prefer dict items over built-in methods HOT 2
- Support for Map.put and Array.add HOT 3
- Untagged release on GitHub. HOT 2
- Support Strict Reference mode HOT 3
- Variables - Alternate value HOT 2
- Deprecation warning due to invalid escape sequences. HOT 3
- Macro referenced before used issue HOT 2
- Missing support for keySet() and toString()? HOT 3
- GitHub repository is behind PyPI HOT 1
- Airspeed treats single number sign (hash) as the beginning of a single line comment
- Support #define directive block HOT 6
- Missing support for trim method. HOT 1
- replace nose testing framework HOT 7
- Support for identifiers using hyphens
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airspeed.