Skip to content

Commit 535a3ff

Browse files
committed
content: Improve descriptions and signatures for collections functions
Closes gohugoio#3384
1 parent 81befba commit 535a3ff

27 files changed

+88
-103
lines changed

content/en/functions/collections/After.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: collections.After
3-
description: Slices an array to the items after the Nth item.
3+
description: Returns a slice containing the elements after the first N elements of the given slice.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [after]
9-
returnType: any
10-
signatures: [collections.After INDEX COLLECTION]
9+
returnType: '[]any'
10+
signatures: [collections.After N SLICE]
1111
aliases: [/functions/after]
1212
---
1313

content/en/functions/collections/Append.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: collections.Append
3-
description: Appends one or more elements to a slice and returns the resulting slice.
3+
description: Returns a slice by adding one or more elements, or an entire second slice, to the end of the given slice.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [append]
9-
returnType: any
10-
signatures:
11-
- collections.Append ELEMENT [ELEMENT...] COLLECTION
12-
- collections.Append COLLECTION1 COLLECTION2
9+
returnType: '[]any'
10+
signatures:
11+
- collections.Append ELEMENT [ELEMENT...] SLICE
12+
- collections.Append SLICE1 SLICE2
1313
aliases: [/functions/append]
1414
---
1515

content/en/functions/collections/Apply.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: collections.Apply
3-
description: Returns a new collection with each element transformed by the given function.
3+
description: Returns a slice by transforming each element of the given slice using a specific function and parameters.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [apply]
99
returnType: '[]any'
10-
signatures: [collections.Apply COLLECTION FUNCTION PARAM...]
10+
signatures: [collections.Apply SLICE FUNCTION PARAM...]
1111
aliases: [/functions/apply]
1212
---
1313

content/en/functions/collections/Complement.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: collections.Complement
3-
description: Returns the elements of the last collection that are not in any of the others.
3+
description: Returns a slice by identifying elements in the last given slice that do not appear in any of the preceding slices.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [complement]
9-
returnType: any
10-
signatures: ['collections.Complement COLLECTION [COLLECTION...]']
9+
returnType: '[]any'
10+
signatures: ['collections.Complement SLICE [SLICE...]']
1111
aliases: [/functions/complement]
1212
---
1313

content/en/functions/collections/D.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: collections.D
3-
description: Returns a sorted slice of unique random integers.
3+
description: Returns a sorted slice of unique random integers based on a given seed, count, and maximum value.
44
categories: []
55
keywords: [random]
66
params:

content/en/functions/collections/Delimit.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: collections.Delimit
3-
description: Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
3+
description: Returns a string by joining the values of the given slice or map with a delimiter.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [delimit]
99
returnType: string
10-
signatures: ['collections.Delimit COLLECTION DELIMITER [LAST]']
10+
signatures: ['collections.Delimit SLICE|MAP DELIMITER [LAST]']
1111
aliases: [/functions/delimit]
1212
---
1313

content/en/functions/collections/Dictionary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: collections.Dictionary
3-
description: Returns a map composed of the given key-value pairs.
3+
description: Returns a map created from the given key-value pairs.
44
categories: []
55
keywords: []
66
params:

content/en/functions/collections/First.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: collections.First
3-
description: Returns the given collection, limited to the first N elements.
3+
description: Returns the first N elements of the given slice or string.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [first]
9-
returnType: any
10-
signatures: [collections.First N COLLECTION]
9+
returnType: '[]any'
10+
signatures: [collections.First N SLICE|STRING]
1111
aliases: [/functions/first]
1212
---
1313

content/en/functions/collections/Group.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: collections.Group
3-
description: Groups the given page collection by the given key.
3+
description: Returns a map by grouping the given page collection (slice) by a specific key.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [group]
9-
returnType: any
9+
returnType: page.PageGroup
1010
signatures: [collections.Group KEY PAGES]
1111
aliases: [/functions/group]
1212
---

content/en/functions/collections/In.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
---
22
title: collections.In
3-
description: Reports whether the given value is a member of the given set.
3+
description: Reports whether a value exists within the given slice or string.
44
categories: []
55
keywords: []
66
params:
77
functions_and_methods:
88
aliases: [in]
99
returnType: bool
10-
signatures: [collections.In SET VALUE]
10+
signatures: [collections.In SLICE|STRING VALUE]
1111
aliases: [/functions/in]
1212
---
1313

14-
The `SET` can be an [array](g), [slice](g), or [string](g).
15-
1614
```go-html-template
1715
{{ $s := slice "a" "b" "c" }}
1816
{{ in $s "b" }} → true
1917
```
2018

21-
```go-html-template
22-
{{ $s := slice 1 2 3 }}
23-
{{ in $s 2 }} → true
24-
```
25-
26-
```go-html-template
27-
{{ $s := slice 1.11 2.22 3.33 }}
28-
{{ in $s 2.22 }} → true
29-
```
30-
3119
```go-html-template
3220
{{ $s := "abc" }}
3321
{{ in $s "b" }} → true

0 commit comments

Comments
 (0)