Remove LLM errors in the new templating syntax documentation#45095
Conversation
|
It seems that this PR is targeted against an incorrect branch. Documentation updates which apply to our current stable release should target the |
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
frenck
left a comment
There was a problem hiding this comment.
Thanks, for the pull request @etiennec78 👍
However, this is existing documentation; meaning this PR need to target and be based on the current branch.
../Frenck
Blogging my personal ramblings at frenck.dev
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
There was a problem hiding this comment.
Pull request overview
Updates the “new templating syntax” documentation to remove misleading operator-precedence examples and keep a single, correct illustration of how filters bind tighter than math operators.
Changes:
- Replaced the non-demonstrating
10 / 10 | round(2)example with10 / 3 | round(2)to actually show the precedence pitfall. - Removed the additional
20 - 5 | round(0)example that did not demonstrate the gotcha.
| {% endexample %} | ||
|
|
||
| You might read that as "ten divided by ten, rounded to two decimals", which should be `1.0`. But because filters take priority, it actually runs as "ten divided by (ten rounded to two decimals)", which is `10 / 10.0 = 1.0`... Wait, that's also `1.0`. Let me try a clearer example: | ||
| You might read that as "ten divided by three, rounded to two decimals", which should be `3.33`. But because filters take priority, it actually runs as "ten divided by (three rounded to two decimals)", which is `10 / 3.0 = 3.3333333333333335` |
The LLM gave an example about `10 / 10 | round` vs `(10 / 10) | round` but both are equal to 1. Then it also tried with `20 - 5 | round`, with the same issue. I removed these examples and only kept the one with 10 / 3, which is correct.
eb64971 to
3b8bac5
Compare
Suggested by Copilot
|
Yup, sorry about that, my "current" branch was out of sync and I couldn't find the right file 🤦 |
Proposed change
The LLM gave an example about
10 / 10 | roundvs(10 / 10) | roundbut both are equal to 1.Then it also tried with
20 - 5 | round, with the same issue.I removed these examples and only kept the one with 10 / 3, which is correct.
Type of change
currentbranch).currentbranch).nextbranch).nextbranch).Additional information
Checklist
currentbranch.nextbranch.