Skip to content

Commit 3de9db0

Browse files
committed
Adjust syntax highlighting for codeblock
1 parent c1619fe commit 3de9db0

7 files changed

+51
-44
lines changed

02_Introduction_into_Metafacture-Flux.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Let's start with a link: https://openlibrary.org/books/OL2838758M.json
104104

105105
You will see data that look like this:
106106

107-
```JSON
107+
```json
108108
{"publishers": ["Belknap Press of Harvard University Press"], "identifiers": {"librarything": ["321843"], "goodreads": ["2439014"]}, "covers": [413726], "local_id": ["urn:trent:0116301499939", "urn:sfpl:31223009984353", "urn:sfpl:31223011345064", "urn:cst:10017055762"], "lc_classifications": ["JA79 .S44 1984", "HM216 .S44", "JA79.S44 1984"], "key": "/books/OL2838758M", "authors": [{"key": "/authors/OL381196A"}], "ocaid": "ordinaryvices0000shkl", "publish_places": ["Cambridge, Mass"], "subjects": ["Political ethics.", "Liberalism.", "Vices."], "pagination": "268 p. ;", "source_records": ["marc:OpenLibraries-Trent-MARCs/tier5.mrc:4020092:744", "marc:marc_openlibraries_sanfranciscopubliclibrary/sfpl_chq_2018_12_24_run01.mrc:195791766:1651", "ia:ordinaryvices0000shkl", "marc:marc_claremont_school_theology/CSTMARC1_barcode.mrc:137174387:3955", "bwb:9780674641754", "marc:marc_loc_2016/BooksAll.2016.part15.utf8:115755952:680", "marc:marc_claremont_school_theology/CSTMARC1_multibarcode.mrc:137367696:3955", "ia:ordinaryvices0000shkl_a5g0", "marc:marc_columbia/Columbia-extract-20221130-001.mrc:328870555:1311", "marc:harvard_bibliographic_metadata/ab.bib.01.20150123.full.mrc:156768969:815"], "title": "Ordinary vices", "dewey_decimal_class": ["172"], "notes": {"type": "/type/text", "value": "Bibliography: p. 251-260.\nIncludes index."}, "number_of_pages": 268, "languages": [{"key": "/languages/eng"}], "lccn": ["84000531"], "isbn_10": ["0674641752"], "publish_date": "1984", "publish_country": "mau", "by_statement": "Judith N. Shklar.", "works": [{"key": "/works/OL2617047W"}], "type": {"key": "/type/edition"}, "oclc_numbers": ["10348450"], "latest_revision": 16, "revision": 16, "created": {"type": "/type/datetime", "value": "2008-04-01T03:28:50.625462"}, "last_modified": {"type": "/type/datetime", "value": "2024-12-27T16:46:50.181109"}}
109109
```
110110

@@ -139,7 +139,7 @@ inputFile
139139

140140
[When you process the data](https://metafacture.org/playground/?flux=inputFile%0A%7C+open-file%0A%7C+as-lines%0A%7C+decode-json%0A%7C+encode-yaml%0A%7C+print%0A%3B&data=%7B%22publishers%22%3A+%5B%22Belknap+Press+of+Harvard+University+Press%22%5D%2C+%22identifiers%22%3A+%7B%22librarything%22%3A+%5B%22321843%22%5D%2C+%22goodreads%22%3A+%5B%222439014%22%5D%7D%2C+%22covers%22%3A+%5B413726%5D%2C+%22local_id%22%3A+%5B%22urn%3Atrent%3A0116301499939%22%2C+%22urn%3Asfpl%3A31223009984353%22%2C+%22urn%3Asfpl%3A31223011345064%22%2C+%22urn%3Acst%3A10017055762%22%5D%2C+%22lc_classifications%22%3A+%5B%22JA79+.S44+1984%22%2C+%22HM216+.S44%22%2C+%22JA79.S44+1984%22%5D%2C+%22key%22%3A+%22/books/OL2838758M%22%2C+%22authors%22%3A+%5B%7B%22key%22%3A+%22/authors/OL381196A%22%7D%5D%2C+%22ocaid%22%3A+%22ordinaryvices0000shkl%22%2C+%22publish_places%22%3A+%5B%22Cambridge%2C+Mass%22%5D%2C+%22subjects%22%3A+%5B%22Political+ethics.%22%2C+%22Liberalism.%22%2C+%22Vices.%22%5D%2C+%22pagination%22%3A+%22268+p.+%3B%22%2C+%22source_records%22%3A+%5B%22marc%3AOpenLibraries-Trent-MARCs/tier5.mrc%3A4020092%3A744%22%2C+%22marc%3Amarc_openlibraries_sanfranciscopubliclibrary/sfpl_chq_2018_12_24_run01.mrc%3A195791766%3A1651%22%2C+%22ia%3Aordinaryvices0000shkl%22%2C+%22marc%3Amarc_claremont_school_theology/CSTMARC1_barcode.mrc%3A137174387%3A3955%22%2C+%22bwb%3A9780674641754%22%2C+%22marc%3Amarc_loc_2016/BooksAll.2016.part15.utf8%3A115755952%3A680%22%2C+%22marc%3Amarc_claremont_school_theology/CSTMARC1_multibarcode.mrc%3A137367696%3A3955%22%2C+%22ia%3Aordinaryvices0000shkl_a5g0%22%2C+%22marc%3Amarc_columbia/Columbia-extract-20221130-001.mrc%3A328870555%3A1311%22%2C+%22marc%3Aharvard_bibliographic_metadata/ab.bib.01.20150123.full.mrc%3A156768969%3A815%22%5D%2C+%22title%22%3A+%22Ordinary+vices%22%2C+%22dewey_decimal_class%22%3A+%5B%22172%22%5D%2C+%22notes%22%3A+%7B%22type%22%3A+%22/type/text%22%2C+%22value%22%3A+%22Bibliography%3A+p.+251-260.\nIncludes+index.%22%7D%2C+%22number_of_pages%22%3A+268%2C+%22languages%22%3A+%5B%7B%22key%22%3A+%22/languages/eng%22%7D%5D%2C+%22lccn%22%3A+%5B%2284000531%22%5D%2C+%22isbn_10%22%3A+%5B%220674641752%22%5D%2C+%22publish_date%22%3A+%221984%22%2C+%22publish_country%22%3A+%22mau%22%2C+%22by_statement%22%3A+%22Judith+N.+Shklar.%22%2C+%22works%22%3A+%5B%7B%22key%22%3A+%22/works/OL2617047W%22%7D%5D%2C+%22type%22%3A+%7B%22key%22%3A+%22/type/edition%22%7D%2C+%22oclc_numbers%22%3A+%5B%2210348450%22%5D%2C+%22latest_revision%22%3A+16%2C+%22revision%22%3A+16%2C+%22created%22%3A+%7B%22type%22%3A+%22/type/datetime%22%2C+%22value%22%3A+%222008-04-01T03%3A28%3A50.625462%22%7D%2C+%22last_modified%22%3A+%7B%22type%22%3A+%22/type/datetime%22%2C+%22value%22%3A+%222024-12-27T16%3A46%3A50.181109%22%7D%7D) our book record should now look like this:
141141

142-
```YAML
142+
```yaml
143143
---
144144
publishers:
145145
- "Belknap Press of Harvard University Press"
@@ -258,7 +258,6 @@ Now take some time and play around a little bit more and use some other modules.
258258
<details>
259259

260260
<summary>Click to see the new workflow</summary>
261-
262261
```default
263262
"https://openlibrary.org/books/OL2838758M.json"
264263
| open-http

03_Introduction_into_Metafacture-Fix.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Clear it if needed and paste the following Flux in the Flux-File area.
3535

3636
You should end up with something like:
3737

38-
```YAML
38+
```yaml
3939
---
4040
title: "Ordinary vices"
4141
```
@@ -60,7 +60,7 @@ Now let us additionally keep the info that is given in the element `"publish_dat
6060

6161
You should now see something like this:
6262

63-
```YAML
63+
```yaml
6464
---
6565
title: "Ordinary vices"
6666
publish_date: "1984"
@@ -80,7 +80,7 @@ Like this.
8080

8181
Fix:
8282

83-
```PERL
83+
```perl
8484
retain("title", "publish_date", "notes.value", "type.key")
8585
```
8686

@@ -102,7 +102,7 @@ retain("title", "publish_date", "notes.value", "pub_type")
102102
103103
The output should be something like this:
104104
105-
```YAML
105+
```yaml
106106
---
107107
title: "Ordinary vices"
108108
publish_date: "1984"
@@ -120,7 +120,7 @@ replace_all("pub_type","/type/","")
120120

121121
If you execute your last workflow with the "Process" button again, you should now see as ouput:
122122

123-
```YAML
123+
```yaml
124124
---
125125
title: "Ordinary vices"
126126
publish_date: "1984"
@@ -145,7 +145,7 @@ Comments in Fix start with a hash mark `#`, while in Flux they start with `//`.
145145

146146
Example:
147147

148-
```PERL
148+
```perl
149149
# Make type.key a top level element.
150150
move_field("type.key","pub_type")
151151

04_Fix-Path.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ The printed output in YAML format contains a collection of key:value pairs.
2020

2121
There are top level fields like: `title` or `publish_date` which contain only text values or numbers:
2222

23-
```YAML
23+
```yaml
2424
---
2525
title: "Bullshit Jobs"
2626
```
2727
2828
There are also fields like `created` that contain a nested structure where the value is again a key:value pair:
2929

30-
```YAML
30+
```yaml
3131
---
3232
created:
3333
type: "/type/datetime"
@@ -37,7 +37,7 @@ created:
3737
And fields like `source_records[]` do have a list as value:
3838

3939

40-
```YAML
40+
```yaml
4141
---
4242
source_records:
4343
- "amazon:1501143336"
@@ -63,7 +63,7 @@ For nested objects with deeper structure you add a dot `.` to point to the subfi
6363

6464
If you would have a deeply nested structure like this object:
6565

66-
```YAML
66+
```yaml
6767
x:
6868
y:
6969
z:
@@ -98,7 +98,7 @@ For YAML and JSON-arrays specifically you also need to use an **array marker** t
9898

9999
In a data set an element sometimes can have multiple instances:
100100

101-
```YAML
101+
```yaml
102102
creator: Justus
103103
creator: Peter
104104
creator: Bob
@@ -108,10 +108,18 @@ To point to one of the `creator` elements you need to use an index. The first in
108108

109109
If you want to refer to all creators then you can use the `*` sign as a wildcard: `creator.*` refers to all creator elements. The first instance can be selected by the `$first` wildcard and the last by `$last`. This is espacially handy if you do not know how often an element is repeated. When adding an additional repeated element you can use the `$append` or `$prepend` wildcards.
110110

111-
[Append the correct last name to the three investigators: Justus Jonas, Peter Shaw and Bob Andrews. Also prepend "Investigator" to all of them.](https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-records%0A%7Cdecode-yaml%0A%7Cfix%28transformationFile%29%0A%7Cencode-json%28prettyPrinting%3D%22true%22%29%0A%7Cprint%0A%3B&transformation=&data=---%0Acreator%3A+Justus%0Acreator%3A+Peter%0Acreator%3A+Bob%0A)
111+
[`append` the correct last name to the three investigators: Justus Jonas, Peter Shaw and Bob Andrews. Also `prepend` "Investigator" to all of them.](https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-records%0A%7Cdecode-yaml%0A%7Cfix%28transformationFile%29%0A%7Cencode-json%28prettyPrinting%3D%22true%22%29%0A%7Cprint%0A%3B&transformation=&data=---%0Acreator%3A+Justus%0Acreator%3A+Peter%0Acreator%3A+Bob%0A)
112112

113113
<details>
114114
<summary>Answer</summary>
115+
FIX:
116+
```perl
117+
append("creator.1"," Jonas")
118+
append("creator.2"," Shaw")
119+
append("creator.3"," Andrews")
120+
prepend("creator.*","Investigator ")
121+
```
122+
115123
[See here](https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-records%0A%7Cdecode-yaml%0A%7Cfix%28transformationFile%29%0A%7Cencode-json%28prettyPrinting%3D%22true%22%29%0A%7Cprint%0A%3B&transformation=append%28%22creator.1%22%2C%22+Jonas%22%29%0Aappend%28%22creator.2%22%2C%22+Shaw%22%29%0Aappend%28%22creator.3%22%2C%22+Andrews%22%29%0Aprepend%28%22creator.%2A%22%2C%22Investigator+%22%29&data=---%0Acreator%3A+Justus%0Acreator%3A+Peter%0Acreator%3A+Bob%0A)
116124
</details>
117125

@@ -134,7 +142,7 @@ source_records:
134142

135143
Our example from above would look like this if creator was a list instead of a repeated field:
136144

137-
```YAML
145+
```yaml
138146
creator:
139147
- Justus
140148
- Peter
@@ -143,7 +151,7 @@ creator:
143151

144152
Lists can be deeply nested if the values are not just strings (list of strings) but objects (list of objects):
145153

146-
```YAML
154+
```yaml
147155
characters:
148156
- name: Justus
149157
role: Investigator
@@ -155,7 +163,7 @@ characters:
155163

156164
Here is another example:
157165

158-
```YAML
166+
```yaml
159167
my:
160168
colors:
161169
- black
@@ -209,7 +217,7 @@ XMLs are not just simple elements with key-pair values or objects with subfields
209217

210218
The path for the different attributs and elements are the following:
211219

212-
```YAML
220+
```yaml
213221
title.value
214222
title.type
215223
title.lang

0 commit comments

Comments
 (0)