galen icon indicating copy to clipboard operation
galen copied to clipboard

can't use index and prev or next simultanously in the @forEch rule

Open mbehzad opened this issue 7 years ago • 1 comments

e.g. something like:

  @forEach [btnContainer.buttons-#] as btn, index as i, prev as previousButton
    @if ${i == 1}
      ${btn}:
        visible
        width 100% of parent/width
        left-of previousButton 10px

throws WrappedException: Wrapped com.galenframework.parser.SyntaxException: Cannot process: , prev as previousButton in error. removing either index as i or prev as previousButton will fix the issue. are multiple as statements not allowed or i am missing something in my example (couldn't find any similar issues). The ForLoop / parseExtraMapping method seem to expect maximum two as statements. "galenframework": "2.3.6"

mbehzad avatar Mar 26 '18 16:03 mbehzad

if you want to use index you can use in this way.

 @forEach [btnContainer.buttons-#] as btn, index as i
    @if ${i == 1}
      ${btn}:
        visible
        width 100% of parent/width
        left-of btnContainer.buttons-${i-1} 10px

PS : you can use prev/next without putting condition. Prev/next handes first and last elements automatically.

cyildirim avatar May 21 '18 23:05 cyildirim