docs(templates): order alphabetically (#30674)

This commit is contained in:
Sebastian Poxhofer 2024-08-09 08:02:35 +02:00 committed by GitHub
parent ac8f516dcf
commit d4fd86265e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,6 +31,77 @@ Some are configuration options passed through, while others are generated as par
## Additional Handlebars helpers ## Additional Handlebars helpers
### and
Returns `true` only if all expressions are `true`.
`{{#if (and isMajor hasReleaseNotes)}}Backwards Incompatible release! Check out the Release notes.{{/if}}`
In the example above, it will only show a text if `isMajor=true` and `hasReleaseNotes=true`.
### containsString
Returns `true` if a given string is a substring.
`{{#if (containsString depName 'python')}}Python{{else}}Other{{/if}}`
### decodeURIComponent
If you want to decode a percent-encoded string, use the built-in function `decodeURIComponent` like this:
`{{{decodeURIComponent depName}}}`
In the example above `depName` is the string you want to decode.
Read the [MDN Web Docs, decodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) to learn more.
### encodeBase64
If you want to convert a string to Base64, use the built-in function `encodeBase64` like this:
`{{{encodeBase64 body}}}`
In the example above `body` is the string you want to transform into a Base64-encoded value.
### encodeURIComponent
If you want to convert a string to a valid URI, use the built-in function `encodeURIComponent` like this:
`{{{encodeURIComponent baseDir}}}`
In the example above `baseDir` is the string you want to transform into a valid URI.
Read the [MDN Web Docs, encodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) to learn more.
### equals
Returns `true` if two values equals (checks strict equality, i.e. `===`).
`{{#if (equals datasource 'git-refs')}}git-refs{{else}}Other{{/if}}`
### lowercase
The `lowercase` helper converts a given string to lower case.
`{{{ lowercase depName }}}`
### or
Returns `true` if at least one expression is `true`.
`{{#if (or isPatch isSingleVersion}}Small update, safer to merge and release.{{else}}Check out the changelog for all versions before merging!{{/if}}`
### replace
The `replace` helper replaces _all_ found strings matching the given regex with the replacement string.
If you want to replace some characters in a string, use the built-in function `replace` like this:
`{{{replace '[a-z]+\.github\.com' 'ghc' depName}}}`
In the example above all matches of the regex `[a-z]+\.github\.com` will be replaced by `ghc` in `depName`.
Read the [MDN Web Docs, String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) to learn more.
### stringToPrettyJSON ### stringToPrettyJSON
If you want to print pretty JSON with Handlebars you can use the built-in function `stringToPrettyJSON` like this: If you want to print pretty JSON with Handlebars you can use the built-in function `stringToPrettyJSON` like this:
@ -57,83 +128,6 @@ If you want to convert key-value pairs to an object, use `toObject`, e.g.,
`{{{ toJSON (toObject 'key1' 'value1' 'key2' 'value2') }}}` will render `{"key1":"value1","key2":"value2"}`. `{{{ toJSON (toObject 'key1' 'value1' 'key2' 'value2') }}}` will render `{"key1":"value1","key2":"value2"}`.
### encodeURIComponent
If you want to convert a string to a valid URI, use the built-in function `encodeURIComponent` like this:
`{{{encodeURIComponent baseDir}}}`
In the example above `baseDir` is the string you want to transform into a valid URI.
Read the [MDN Web Docs, encodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) to learn more.
### decodeURIComponent
If you want to decode a percent-encoded string, use the built-in function `decodeURIComponent` like this:
`{{{decodeURIComponent depName}}}`
In the example above `depName` is the string you want to decode.
Read the [MDN Web Docs, decodeURIComponent()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent) to learn more.
### encodeBase64
If you want to convert a string to Base64, use the built-in function `encodeBase64` like this:
`{{{encodeBase64 body}}}`
In the example above `body` is the string you want to transform into a Base64-encoded value.
### replace
The `replace` helper replaces _all_ found strings matching the given regex with the replacement string.
If you want to replace some characters in a string, use the built-in function `replace` like this:
`{{{replace '[a-z]+\.github\.com' 'ghc' depName}}}`
In the example above all matches of the regex `[a-z]+\.github\.com` will be replaced by `ghc` in `depName`.
Read the [MDN Web Docs, String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) to learn more.
### lowercase
The `lowercase` helper converts a given string to lower case.
`{{{ lowercase depName }}}`
### containsString
Returns `true` if a given string is a substring.
`{{#if (containsString depName 'python')}}Python{{else}}Other{{/if}}`
### equals
Returns `true` if two values equals (checks strict equality, i.e. `===`).
`{{#if (equals datasource 'git-refs')}}git-refs{{else}}Other{{/if}}`
### and
Returns `true` only if all expressions are `true`.
`{{#if (and isMajor hasReleaseNotes)}}Backwards Incompatible release! Check out the Release notes.{{/if}}`
In the example above, it will only show a text if `isMajor=true` and `hasReleaseNotes=true`.
### or
Returns `true` if at least one expression is `true`.
`{{#if (or isPatch isSingleVersion}}Small update, safer to merge and release.{{else}}Check out the changelog for all versions before merging!{{/if}}`
### includes
Returns `true` if the value is included on the list given.
`{{#if (includes labels 'dependencies')}}Production Dependencies{{else}}Not Production Dependencies{{/if}}`
## Environment variables ## Environment variables
By default, you can only access a handful of basic environment variables like `HOME` or `PATH`. By default, you can only access a handful of basic environment variables like `HOME` or `PATH`.