Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syntax.md #2024

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cm-sentinel
Copy link

fix: wording was incorrect.

Details: Original text stated
... newlines that come before the action) can be suppressed by placing a minus sign in front of the first set of delimiters (`{{`)...

This appears to have been a typo. Following those directions would lead to (-{{). This would not behave as expected. What was originally intended was ({{-)

fix: wording was incorrect.

Details: Original text stated
```... newlines that come before the action) can be suppressed by placing a minus sign in front of the first set of delimiters (`{{`)...```

This appears to have been a typo. Following those directions would lead to (`-{{`). This would not behave as expected. What was originally intended was (`{{-`)
@@ -51,7 +51,7 @@ Hello, baz!

This might not be desirable.

You can use [Golang template syntax](https://golang.org/pkg/text/template/#hdr-Text_and_spaces) to fix this. Leading newlines (i.e. newlines that come before the action) can be suppressed by placing a minus sign in front of the first set of delimiters (`{{`). Putting the minus sign behind the trailing set of delimiters (`}}`) will suppress the newline _after_ the action. You can do both to suppress newlines entirely on that line.
You can use [Golang template syntax](https://golang.org/pkg/text/template/#hdr-Text_and_spaces) to fix this. Leading newlines (i.e. newlines that come before the action) can be suppressed by placing a minus sign behind the first set of delimiters (`{{`). Putting the minus sign in front of the trailing set of delimiters (`}}`) will suppress the newline _after_ the action. You can do both to suppress newlines entirely on that line.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it depends what you mean by "in front of" or "behind"... The original text was presuming "front" to be "to the right", and "behind" to be "to the left".

IMO neither of these are that clear.

The Go docs that describe this behaviour use better wording:

[...] if an action's left delimiter (by default "{{") is followed immediately by a minus sign and white space, all trailing white space is trimmed from the immediately preceding text. Similarly, if the right delimiter ("}}") is preceded by white space and a minus sign [...]

So, how about:

Suggested change
You can use [Golang template syntax](https://golang.org/pkg/text/template/#hdr-Text_and_spaces) to fix this. Leading newlines (i.e. newlines that come before the action) can be suppressed by placing a minus sign behind the first set of delimiters (`{{`). Putting the minus sign in front of the trailing set of delimiters (`}}`) will suppress the newline _after_ the action. You can do both to suppress newlines entirely on that line.
You can use [Golang template syntax](https://golang.org/pkg/text/template/#hdr-Text_and_spaces) to fix this. Leading newlines (i.e. newlines that come before the action) can be suppressed by placing a minus sign and white space following the left delimiter (`{{`). Putting white space and a minus sign preceding the right delimiter (`}}`) will suppress the newline _after_ the action. You can do both to suppress newlines entirely on that line.

I'm still not super happy with how that reads though - perhaps we could simply copy the Go doc's text and insert it here in a way that makes sense.

Copy link

This pull request is stale because it has been open for 60 days with
no activity. If it is no longer relevant or necessary, please close
it. Given no action, it will be closed in 14 days.

If it's still relevant, one of the following will remove the stale
marking:

  • A maintainer can add this pull request to a milestone to indicate
    that it's been accepted and will be worked on
  • A maintainer can remove the stale label
  • Anyone can post an update or other comment
  • Anyone with write access can push a commit to the pull request
    branch

@github-actions github-actions bot added the Stale label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants