mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Merge pull request #9134 from fricklerhandwerk/syntax-admonitions
This commit is contained in:
commit
301623f3a3
3 changed files with 22 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
> **Syntax**
|
> **Syntax**
|
||||||
>
|
>
|
||||||
> *lookup-path* = `<` *identifier* [ `/` *identifier* `]`... `>`
|
> *lookup-path* = `<` *identifier* [ `/` *identifier* ]... `>`
|
||||||
|
|
||||||
A lookup path is an identifier with an optional path suffix that resolves to a [path value](@docroot@/language/values.md#type-path) if the identifier matches a search path entry.
|
A lookup path is an identifier with an optional path suffix that resolves to a [path value](@docroot@/language/values.md#type-path) if the identifier matches a search path entry.
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
|
|
||||||
## Attribute selection
|
## Attribute selection
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *attrset* `.` *attrpath* \[ `or` *expr* \]
|
> *attrset* `.` *attrpath* \[ `or` *expr* \]
|
||||||
|
|
||||||
Select the attribute denoted by attribute path *attrpath* from [attribute set] *attrset*.
|
Select the attribute denoted by attribute path *attrpath* from [attribute set] *attrset*.
|
||||||
|
@ -42,12 +44,16 @@ If the attribute doesn’t exist, return the *expr* after `or` if provided, othe
|
||||||
|
|
||||||
An attribute path is a dot-separated list of [attribute names](./values.md#attribute-set).
|
An attribute path is a dot-separated list of [attribute names](./values.md#attribute-set).
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *attrpath* = *name* [ `.` *name* ]...
|
> *attrpath* = *name* [ `.` *name* ]...
|
||||||
|
|
||||||
[Attribute selection]: #attribute-selection
|
[Attribute selection]: #attribute-selection
|
||||||
|
|
||||||
## Has attribute
|
## Has attribute
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *attrset* `?` *attrpath*
|
> *attrset* `?` *attrpath*
|
||||||
|
|
||||||
Test whether [attribute set] *attrset* contains the attribute denoted by *attrpath*.
|
Test whether [attribute set] *attrset* contains the attribute denoted by *attrpath*.
|
||||||
|
@ -70,6 +76,8 @@ The `+` operator is overloaded to also work on strings and paths.
|
||||||
|
|
||||||
## String concatenation
|
## String concatenation
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *string* `+` *string*
|
> *string* `+` *string*
|
||||||
|
|
||||||
Concatenate two [string]s and merge their string contexts.
|
Concatenate two [string]s and merge their string contexts.
|
||||||
|
@ -78,6 +86,8 @@ Concatenate two [string]s and merge their string contexts.
|
||||||
|
|
||||||
## Path concatenation
|
## Path concatenation
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *path* `+` *path*
|
> *path* `+` *path*
|
||||||
|
|
||||||
Concatenate two [path]s.
|
Concatenate two [path]s.
|
||||||
|
@ -87,6 +97,8 @@ The result is a path.
|
||||||
|
|
||||||
## Path and string concatenation
|
## Path and string concatenation
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *path* + *string*
|
> *path* + *string*
|
||||||
|
|
||||||
Concatenate *[path]* with *[string]*.
|
Concatenate *[path]* with *[string]*.
|
||||||
|
@ -100,6 +112,8 @@ The result is a path.
|
||||||
|
|
||||||
## String and path concatenation
|
## String and path concatenation
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *string* + *path*
|
> *string* + *path*
|
||||||
|
|
||||||
Concatenate *[string]* with *[path]*.
|
Concatenate *[string]* with *[path]*.
|
||||||
|
@ -117,6 +131,8 @@ The result is a string.
|
||||||
|
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *attrset1* // *attrset2*
|
> *attrset1* // *attrset2*
|
||||||
|
|
||||||
Update [attribute set] *attrset1* with names and values from *attrset2*.
|
Update [attribute set] *attrset1* with names and values from *attrset2*.
|
||||||
|
|
|
@ -162,13 +162,17 @@ An attribute set is a collection of name-value-pairs (called *attributes*) enclo
|
||||||
An attribute name can be an identifier or a [string](#string).
|
An attribute name can be an identifier or a [string](#string).
|
||||||
An identifier must start with a letter (`a-z`, `A-Z`) or underscore (`_`), and can otherwise contain letters (`a-z`, `A-Z`), numbers (`0-9`), underscores (`_`), apostrophes (`'`), or dashes (`-`).
|
An identifier must start with a letter (`a-z`, `A-Z`) or underscore (`_`), and can otherwise contain letters (`a-z`, `A-Z`), numbers (`0-9`), underscores (`_`), apostrophes (`'`), or dashes (`-`).
|
||||||
|
|
||||||
|
> **Syntax**
|
||||||
|
>
|
||||||
> *name* = *identifier* | *string* \
|
> *name* = *identifier* | *string* \
|
||||||
> *identifier* ~ `[a-zA-Z_][a-zA-Z0-9_'-]*`
|
> *identifier* ~ `[a-zA-Z_][a-zA-Z0-9_'-]*`
|
||||||
|
|
||||||
Names and values are separated by an equal sign (`=`).
|
Names and values are separated by an equal sign (`=`).
|
||||||
Each value is an arbitrary expression terminated by a semicolon (`;`).
|
Each value is an arbitrary expression terminated by a semicolon (`;`).
|
||||||
|
|
||||||
> *attrset* = `{` [ *name* `=` *expr* `;` `]`... `}`
|
> **Syntax**
|
||||||
|
>
|
||||||
|
> *attrset* = `{` [ *name* `=` *expr* `;` ]... `}`
|
||||||
|
|
||||||
Attributes can appear in any order.
|
Attributes can appear in any order.
|
||||||
An attribute name may only occur once.
|
An attribute name may only occur once.
|
||||||
|
|
Loading…
Reference in a new issue