Skip to content

Commit aabf0d8

Browse files
committed
learn: give meaningful titles to chapters
Signed-off-by: Luca Zeuch <[email protected]>
1 parent 1194b62 commit aabf0d8

File tree

9 files changed

+58
-55
lines changed

9 files changed

+58
-55
lines changed

content/docs/reference/templates/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2297,7 +2297,7 @@ Target: {{ .User }}
22972297
Please see our [in-depth guide] in the learning resources for a full breakdown of this function and how to make good use
22982298
of it.
22992299

2300-
[in-depth guide]: /learn/beginner/inputs-1
2300+
[in-depth guide]: /learn/beginner/command-arguments
23012301

23022302
#### sdict
23032303

content/learn/beginner/inputs-1.md renamed to content/learn/beginner/command-arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "Inputs 1"
2+
title = "Command Arguments"
33
weight = 240
44
+++
55

content/learn/beginner/control-flow-1.md renamed to content/learn/beginner/conditional-branching.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "Control Flow 1"
2+
title = "Conditional Branching"
33
weight = 230
44
+++
55

@@ -113,15 +113,17 @@ We provide the following comparison functions in custom commands:
113113
- `gt` (greater than `>`)
114114
- `ge` (greater than or equal to `>=`)
115115

116-
These functions can only compare basic data types as introduced in [Data Types 1](/learn/beginner/datatypes-1). Strings
116+
These functions can only compare basic data types as introduced in [Variables and Data Types][dtypes]. Strings
117117
are compared on a byte-by-byte basis. Please refer to the [functions documentation](/docs/reference/templates/functions)
118118
for the syntax of these functions.
119119

120+
[dtypes]: /learn/beginner/variables-and-data-types
121+
120122
## Blocks And Scope
121123

122-
In [Data Types 1](/learn/beginner/datatypes-1), we introduced the concept of variables. Variables are used to store
123-
values and give them a name. In programming, variables have a _scope_, which defines where in the code the variable can
124-
be accessed. Think of each scope as a "container" for things inside it.
124+
In the previous chapter, we introduced the concept of variables. Variables are used to store values and give them a name.
125+
In programming, variables have a _scope_, which defines where in the code the variable can be accessed. Think of each
126+
scope as a "container" for things inside it.
125127

126128
Often, you will want to have a variable available across multiple scopes. In custom commands, the variable is accessible
127129
in the scope in which it was defined, as well as all nested scopes within. Let us assume that we want to assign a
@@ -166,6 +168,39 @@ block of code.
166168

167169
{{< /callout >}}
168170

171+
## With Blocks
172+
173+
Just like the `if` action, `with` runs a block of code if the given expression is truthy. The only difference is that
174+
`with` overwrites the dot `.` with the expression if it is truthy.
175+
176+
For instance, the following program
177+
178+
```yag
179+
{{ $msg := "I <3 the YAGPDB documentation!" }}
180+
{{ with reFind `\d+` $msg }}
181+
pattern found in text; the dot {{ printf "%q" . }} contains the match
182+
{{ else }}
183+
pattern did not match
184+
{{ end }}
185+
```
186+
187+
outputs
188+
189+
```text
190+
pattern found in text; the dot "3" contains the match
191+
```
192+
193+
Note that the dot `.` has been set to `"3"`—the result of `reFind`. See if you can change the text stored in `$msg` so
194+
that the program hits the `else` branch instead.
195+
196+
{{< callout context="caution" title="Warning" icon="outline/alert-triangle" >}}
197+
198+
Be careful not to overuse `with` blocks, as they can make your code difficult to follow. In general, prefer using
199+
a normal `if` conditional and only use `with` if it improves readability; do not use it just to shorten code.
200+
201+
{{< /callout >}}
202+
203+
169204
## Exercises
170205

171206
1. Write a Custom Command to determine if the number stored in a variable `$a` is even or odd and print `Number is Even`

content/learn/beginner/outputs-1.md renamed to content/learn/beginner/simple-responses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "Outputs 1"
2+
title = "Simple Responses"
33
weight = 210
44
+++
55

content/learn/beginner/datatypes-1.md renamed to content/learn/beginner/variables-and-data-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = "Data Types 1"
2+
title = "Variables and Data Types"
33
weight = 220
44
+++
55

content/learn/intermediate/outputs-2.md renamed to content/learn/intermediate/embeds-and-messages.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
+++
2-
title = "Outputs 2"
2+
title = "Embeds and Messages"
33
weight = 310
44
+++
55

6-
Until now, we have just used the [default response behavior](/learn/beginner/outputs-1) to make our custom commands
7-
respond with some text. This makes sense for quick mockups or relatively simple commands. However, this may be
6+
Until now, we have just used the [default response behavior](/learn/beginner/simple-responses) to make our custom
7+
commands respond with some text. This makes sense for quick mockups or relatively simple commands. However, this may be
88
inconvenient or Not What You Want in some cases. In this chapter, we will explore how to send messages to different
99
channels, edit existing messages, and send messages with embeds, vastly expanding your toolbox for creating complex
1010
custom command systems.
@@ -93,7 +93,7 @@ will return a structured object that can be sent as a message, as demonstrated i
9393

9494
The `"title"` and `"description"` fields are self-explanatory---we can use Discord Markdown in the latter. The `"color"`
9595
field takes an integer color value, for which we can conveniently use hexadecimal formatting as mentioned in
96-
[Data Types 1](/learn/beginner/datatypes-1#integers), but it can also take a
96+
[Variables and Data Types](/learn/beginner/variables-and-data-types#integers), but it can also take a
9797
[decimal value](https://www.binaryhexconverter.com/hex-to-decimal-converter).
9898

9999
The `"fields"` field is a list (more precisely a _slice_) of dictionaries, where each dictionary represents a field in

content/learn/intermediate/control-flow-2.md renamed to content/learn/intermediate/loops.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
+++
2-
title = "Control Flow 2"
2+
title = "Loops"
33
weight = 330
44
+++
55

6-
In a previous chapter, we learned about [basic control flow](/learn/beginner/control-flow-1). In this chapter, we will
7-
discuss more advanced control flow actions: namely, `range`, `while`, and `with` actions.
6+
In a previous chapter, we learned about [conditional branching](/learn/beginner/conditional-branching).
7+
In this chapter, we will discuss more advanced control flow actions: namely, `range`, `while`, and `with` actions.
88

99
## Loop
1010

@@ -262,35 +262,3 @@ In custom commands, we provide two actions to control the flow of loops: `{{ bre
262262
exits the loop prematurely, whereas `continue` skips the remainder of the current iteration and jumps to the next one.
263263
These can prove very useful to optimize your code for size and readability, with similar benefits to guard clauses with
264264
`{{ return }}` introduced in earlier chapters.
265-
266-
## With Blocks
267-
268-
Just like the `if` action, `with` runs a block of code if the given expression is truthy. The only difference is that
269-
`with` overwrites the dot `.` with the expression if it is truthy.
270-
271-
For instance, the following program
272-
273-
```yag
274-
{{ $msg := "I <3 the YAGPDB documentation!" }}
275-
{{ with reFind `\d+` $msg }}
276-
pattern found in text; the dot {{ printf "%q" . }} contains the match
277-
{{ else }}
278-
pattern did not match
279-
{{ end }}
280-
```
281-
282-
outputs
283-
284-
```text
285-
pattern found in text; the dot "3" contains the match
286-
```
287-
288-
Note that the dot `.` has been set to `"3"`—the result of `reFind`. See if you can change the text stored in `$msg` so
289-
that the program hits the `else` branch instead.
290-
291-
{{< callout context="caution" title="Warning" icon="outline/alert-triangle" >}}
292-
293-
Be careful not to overuse `with` blocks, as they can make your code difficult to follow. In general, prefer using
294-
a normal `if` conditional and only use `with` if it improves readability; do not use it just to shorten code.
295-
296-
{{< /callout >}}

content/learn/intermediate/data-types-2.md renamed to content/learn/intermediate/maps-and-slices.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
+++
2-
title = "Data Types 2"
2+
title = "Maps and Slices"
33
weight = 320
44
+++
55

6-
When you first started this course, you learned about [primitive data types](/learn/beginner/datatypes-1). In the
7-
previous chapter we name-dropped two more types: "slice", and "sdict" ("map"), both without much elaboration.
6+
When you first started this course, you learned about [primitive data types](/learn/beginner/variables-and-data-types).
7+
In the previous chapter we name-dropped two more types: "slice", and "sdict" ("map"), both without much elaboration.
88
In this chapter, we will explore these data types in more detail.
99

1010
## Slices

layouts/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h2 id="quick-links" class="text-center">Quick Links</h2>
4747

4848
<div class="card-nav d-flex flex-column flex-sm-row">
4949
{{ $opts := dict
50-
"title" "Tools & Utilities"
50+
"title" "Tools :& Utilities"
5151
"icon" "outline/tools"
5252
"content" `
5353
- [Self-assignable roles](/docs/tools-and-utilities/self-assignable-roles/)
@@ -60,9 +60,9 @@ <h2 id="quick-links" class="text-center">Quick Links</h2>
6060
"title" "Learning Resources"
6161
"icon" "outline/book"
6262
"content" `
63-
- [Custom Commands: Outputs 1](/learn/beginner/outputs-1)
64-
- [Custom Commands: Control Flow 1](/learn/beginner/control-flow-1)
65-
- [Custom Commands: Inputs 1](/learn/beginner/inputs-1)
63+
- [Custom Commands: Simple Responses(/learn/beginner/simple-responses)
64+
- [Custom Commands: Conditional Branching](/learn/beginner/conditional-branching)
65+
- [Custom Commands: Command Arguments](/learn/beginner/command-arguments)
6666
` }}
6767
{{ partial "inline/home-card.html" $opts }}
6868
</div>

0 commit comments

Comments
 (0)