Menu

#26 Block templates and updating a nested element

Indefinite
closed
block (7)
5
2018-05-07
2018-05-01
No

Hi Zoltan,

I was struggling with block templates and updating a nested element.

Please see below example.

At first, I thought I could address a block with the dot notation, but this fails.

I found out that I need to nest the update statement as well, and then I succeed. But then the automatic formatting does not work properly. Additionally, when I format ([Ctrl]+[A], [Tab], [Tab], [Tab], [Tab]) the example below multiple times, the bottom second line is growing spaces for each tab.

My requests:

  • Could you introduce support for dot notation for all template statements (e.g. add, update, drop, replace, move) where appropriate ?
  • Could you fix the automatic formatting for the case described?

*By the way, how are you? You've not been active lately? *

Kind regards,
Martijn

template col tmp {
  box one {
    box two;
  }
}

# Try to address a block with dot notation
copy tmp as a {
  update one.two [fill.color=green];
}

# This succeeds, but does not auto-format correctly
copy tmp as a {
  update one  {
  update two [fill.color=green];
}

}

Discussion

  • Zoltán Turányi

    • labels: --> block
    • status: open --> accepted
     
  • Zoltán Turányi

    Hi Martin,
    Thanks for spotting this.
    The second form was the intended one, but I agree the first form is natural and much better. I add this to my todo list.
    We have a newborn baby and I struggle to find time. It will get better, but I do not know when.
    Zoltan

     
  • Martijn Schiedon

    Hi Zoltan, congratulations with your newborn to you and your family! I know from experience that these are life-altering events :)

     
  • Zoltán Turányi

    • status: accepted --> closed
     
  • Zoltán Turányi

    Both suggestions will hopefully work in 6.3.4, to be released today.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.