Skip to content

Commit aba8813

Browse files
committed
metadata mapping: more test case setup
see #78820
1 parent 5015a4b commit aba8813

5 files changed

Lines changed: 30 additions & 15 deletions

File tree

fas_config/cookbook_metadata_example.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ recipes:
55
class: _metadata
66
metadata:
77
- file: "example_metadata.json"
8+
params:
9+
custom:
10+
type: string
811
execs:
912
- service: node
1013
commands:
1114
- prog: node
1215
args:
1316
- "-e"
1417
# read custom_metadata.json (arg 1) and write to example_metadata.json (arg 2)
15-
- "console.error('Current working directory:', process.cwd()); require('fs').createReadStream(process.argv[1]).pipe(require('fs').createWriteStream(process.argv[2]));"
18+
- "console.error('Current working directory:', process.cwd()); const fs = require('fs'); fs.writeFileSync(process.argv[2], fs.readFileSync(process.argv[1], 'utf8').replaceAll('_custom_', '%custom%'));"
1619
- "%_exec.pluginDir%/fas_config/custom_metadata.json"
1720
- type: file_out
1821
file:
@@ -34,7 +37,7 @@ recipes:
3437
args:
3538
- "-e"
3639
# read request_only_metadata.json (arg 1) and write to example_metadata.json (arg 2)
37-
- "console.error('Current working directory:', process.cwd()); const fs = require('fs'); fs.writeFileSync(process.argv[2], fs.readFileSync(process.argv[1], 'utf8').replaceAll('_custom_de_', '%custom_de%').replaceAll('_custom_en_', '%custom_en%'));"
40+
- "console.error('Current working directory:', process.cwd()); const fs = require('fs'); fs.writeFileSync(process.argv[2], fs.readFileSync(process.argv[1], 'utf8').replaceAll('_custom_de_', '%custom_de%').replaceAll('_custom_en_', '%custom_en%').replaceAll('_extra_', '%extra%'));"
3841
- "%_exec.pluginDir%/fas_config/request_only_metadata.json"
3942
- type: file_out
4043
file:

fas_config/custom_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"_technical_metadata": {
99
"huhu": {
10-
"gut": "sieht torsten"
10+
"gut": "sieht torsten custom:_custom_"
1111
}
1212
}
1313
}

fas_config/custom_produce.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1+
# custommetadata defined automatically run metadata recipes per version
12
custommetadata:
23
- recipename: fylr_example:pdf2text_metadata:pdf2text
34
extensions:
45
- pdf
6+
# if set, the metadata recipe is run for all renditions
57
includeversions: true
6-
- recipename: fylr_example:example_metadata:example
7-
includeversions: true
8-
extensions:
9-
- png
10-
- jpg
11-
- recipename: fylr_example:example_metadata:example-request-only
12-
includeversions: false
13-
metadata_request_only: true
14-
extensions:
15-
- png
16-
- jpg
8+
# test/api/eas/plugin_metadata adds this via base config produce config
9+
# - recipename: fylr_example:example_metadata:example
10+
# includeversions: true
11+
# extensions:
12+
# - png
13+
# - jpg
14+
# test/api/eas/plugin_metadata adds this via base config produce config
15+
# - recipename: fylr_example:example_metadata:example-request-only
16+
# includeversions: false
17+
# metadata_request_only: true
18+
# extensions:
19+
# - png
20+
# - jpg
1721
- recipename: fylr_example:example_metadata:example-request-only-with-error
1822
includeversions: false
23+
# if set, this recipe is only run if a metadata mapping needs it
1924
metadata_request_only: true
2025
extensions:
2126
- png
@@ -33,3 +38,5 @@ classes:
3338
zoomable: true
3439
custommetadata:
3540
- recipename: fylr_example:example_metadata:example
41+
params:
42+
custom: "henk im beispiel"

fas_config/recipe_dynamic_request_only.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"type": "string",
1010
"description": "custom text to include in metadata description (en-EN)",
1111
"usereditable": false
12+
},
13+
"extra": {
14+
"type": "string",
15+
"description": "custom text to include in metadata description (en-EN)",
16+
"usereditable": false
1217
}
1318
},
1419
"mapping": {

fas_config/request_only_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"filename": "trabant.jpg",
66
"description": {
77
"de-DE": "_custom_de_: Das Bild zeigt ein Gemälde eines weißen Trabant-Autos, das durch eine Wand bricht. Die Illusion von zerbrochenem Putz und Ziegeln verstärkt den Eindruck einer Durchbrechung. Auf dem Nummernschild steht 'NOV 9-89', ein Hinweis auf den Tag des Mauerfalls in Berlin. Das Kunstwerk ist von Birgit Kinder signiert.",
8-
"en-US": "_custom_en_: The image shows a painting of a white Trabant car breaking through a wall. The illusion of broken plaster and bricks enhances the impression of the car crashing through. The license plate reads 'NOV 9-89', referencing the date of the Berlin Wall's fall. The artwork is signed by Birgit Kinder."
8+
"en-US": "_custom_en_: The image (_extra_) shows a painting of a white Trabant car breaking through a wall. The illusion of broken plaster and bricks enhances the impression of the car crashing through. The license plate reads 'NOV 9-89', referencing the date of the Berlin Wall's fall. The artwork is signed by Birgit Kinder."
99
},
1010
"keywords": [
1111
{

0 commit comments

Comments
 (0)