Skip to content

Commit 806faa9

Browse files
authored
Merge pull request #243 from carpentries/frog-glosario-docs-1
Update docs with glosario usage
2 parents e87d0f8 + 4830557 commit 806faa9

3 files changed

Lines changed: 100 additions & 3 deletions

File tree

episodes/episodes.Rmd

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exercises: 2
1414
- What syntax do you use to write links?
1515
- How do you include images?
1616
- How do you include math?
17+
- How do you include Glosario terms?
1718

1819
::::::::::::::::::::::::::::::::::::::::::::::::
1920

@@ -1073,13 +1074,110 @@ pie(
10731074

10741075
## Math
10751076

1076-
One of our episodes contains $\LaTeX$ equations when describing how to create
1077-
dynamic reports with {knitr}, so we now use mathjax to describe this:
1077+
One of our episodes contains $\LaTeX$ equations when describing how to create dynamic reports with {knitr}, so we now use mathjax to describe this:
10781078

10791079
`$\alpha = \dfrac{1}{(1 - \beta)^2}$` becomes: $\alpha = \dfrac{1}{(1 - \beta)^2}$
10801080

10811081
Cool, right?
10821082

1083+
1084+
## Glosario Terms
1085+
1086+
[Glosario](https://glosario.carpentries.org) is the Carpentries data science glossary that is developed by the international community, providing terms, definitions and translations to make lessons more accessible.
1087+
1088+
{sandpaper} can automatically generate glossary links in lessons from links to Glosario terms in lesson content markdown.
1089+
1090+
### Configuration
1091+
1092+
Firstly, to enable this behaviour, the `glosario` key needs to be added to a lesson's `config.yaml`.
1093+
1094+
For automatic retrieval of the latest `glossary.yml` from Glosario's GitHub repository, set:
1095+
1096+
```yaml
1097+
glosario: true
1098+
```
1099+
1100+
For manual retrieval from a local (e.g. working on your lesson offline) or remote location (e.g. providing a specific Glosario version), supply a string relative/absolute path or URL to the config:
1101+
1102+
```yaml
1103+
# load a glossary from a local file using an absolute path
1104+
glosario: "/path/to/your/glossary.yml"
1105+
1106+
# load a glossary from a local file using path relative to the lesson
1107+
glosario: "../glossary.yml"
1108+
1109+
# load a glossary from a remote location
1110+
glosario: "https://foo.com/glossary.yml"
1111+
```
1112+
1113+
### Lesson content
1114+
1115+
A lesson maintainer/contributor can add placeholders into the main content of lessons that sandpaper will subsequently process.
1116+
1117+
Sandpaper understands links to Glosario terms in two ways, either a template-style term, or a hard link to the term page, i.e.:
1118+
1119+
- `{{ glosario.<term> }}`
1120+
- `[<term>](https://glosario.carpentries.org/en/#<term>)`
1121+
1122+
:::::::::::::: callout
1123+
1124+
## Automatic language selection
1125+
1126+
When using the template-style term, sandpaper will automatically generate the URL link using the language specified in the `config.yaml` `lang` setting.
1127+
1128+
When using the markdown link style, sandpaper will automatically replace the `en/` in the link with the language specified in the `config.yaml` `lang` setting.
1129+
1130+
For example, if the `config.yaml` language is set to `lang: de`:
1131+
1132+
`[data_structure](https://glosario.carpentries.org/en/#data_structure)`
1133+
1134+
will be replaced with:
1135+
1136+
`[data_structure](https://glosario.carpentries.org/de/#data_structure)`
1137+
1138+
If the term is not available in that language, a warning will be printed when the lesson builds, and it will default back to English.
1139+
1140+
::::::::::::::::::::::
1141+
1142+
### Example output
1143+
1144+
To look at a specific example, the [datacarpentry/spreadsheet-ecology-lesson](https://github.com/datacarpentry/spreadsheet-ecology-lesson/blob/main/episodes/01-format-data.md) can be edited to include Glosario links.
1145+
1146+
To add a glosario link to the term `data structure` at the URL `https://glosario.carpentries.org/en/#data_structure`, the markdown becomes:
1147+
1148+
```
1149+
The most common mistake made is treating spreadsheet programs like lab notebooks, that is, relying on context,
1150+
notes in the margin, spatial layout of data and fields to convey information. As humans, we can (usually) interpret
1151+
these things, but computers don't view information the same way, and unless we explain to the computer what
1152+
every single thing means (and that can be hard!), it will not be able to see how our data fits together. This is called
1153+
the data structure {{ glosario.data_structure }}.
1154+
```
1155+
1156+
Similarly, to add a link using the inline markdown link syntax, the markdown becomes:
1157+
1158+
```
1159+
Using the power of computers, we can manage and analyze data in much more effective and faster ways, but to
1160+
use that power, we have to set up our data for the computer to be able to understand it
1161+
(and computers are very [literal](https://glosario.carpentries.org/en/#literal)).
1162+
```
1163+
1164+
Once the lesson is built, this will produce the following output:
1165+
1166+
![Example of superscript and inline Glosario link generation](fig/glosario-link-example.png){alt='Screenshot of a lesson with a Glosario link as a superscript and an inline link.'}
1167+
1168+
In the first example, `{{ glosario.data_structure }}` adds a `data_structure` link as a superscript inline.
1169+
1170+
In the second example, a typical markdown link will be inserted.
1171+
1172+
In either case, sandpaper will find these links and add them to the global `reference.md` page in your lesson, built as `reference.html`, and linked in the top lesson menu as `Glossary`:
1173+
1174+
![Example of automatic inclusion of Glosario links in the Glossary page](fig/glosario-glossary-page.png){alt='Screenshot of a lesson with Glosario links in the Glossary reference page.'}
1175+
1176+
### Unavailable terms
1177+
1178+
Users will receive a warning when using terms that are not in the currently selected config.yaml language for the lesson:
1179+
1180+
10831181
:::::::::::::::: keypoints :::::::::::::::::::::
10841182
10851183
- Use `.Rmd` files for lessons even if you don't need to generate any code
@@ -1095,4 +1193,3 @@ Cool, right?
10951193
current working proposal is to call these "chapters".
10961194
[^worry]: Do not worry if you aren't comfortable yet, that's what we will show
10971195
you in this episode!
1098-
62.6 KB
Loading
54 KB
Loading

0 commit comments

Comments
 (0)