metanorma-plugin-glossarist 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +5 -1
- data/README.adoc +836 -0
- data/Rakefile +1 -1
- data/lib/metanorma/plugin/glossarist/dataset_preprocessor.rb +148 -78
- data/lib/metanorma/plugin/glossarist/document.rb +21 -2
- data/lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb +155 -0
- data/lib/metanorma/plugin/glossarist/liquid/custom_filters/filters.rb +43 -0
- data/lib/metanorma/plugin/glossarist/version.rb +1 -1
- data/metanorma-plugin-glossarist.gemspec +5 -2
- metadata +12 -13
- data/README.md +0 -495
- data/lib/liquid/custom_blocks/with_glossarist_context.rb +0 -52
- data/lib/liquid/custom_filters/filters.rb +0 -35
- data/lib/liquid/drops/concepts_drop.rb +0 -129
data/README.adoc
ADDED
@@ -0,0 +1,836 @@
|
|
1
|
+
= Metanorma Glossarist plugin (metanorma-plugin-glossarist)
|
2
|
+
|
3
|
+
image:https://github.com/metanorma/metanorma-plugin-glossarist/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-plugin-glossarist/actions?workflow=rake"]
|
4
|
+
|
5
|
+
== Purpose
|
6
|
+
|
7
|
+
Glossarist is the https://github.com/glossarist/concept-model[concept model]
|
8
|
+
created and published by the https://www.glossarist.org[Glossarist Project].
|
9
|
+
|
10
|
+
|
11
|
+
== Glossarist concept model
|
12
|
+
|
13
|
+
The Glossarist model is a structured way to represent concepts and terms
|
14
|
+
in a consistent and standardized manner. It is designed to be used in
|
15
|
+
various contexts, including standards, technical documentation, and
|
16
|
+
knowledge management systems.
|
17
|
+
|
18
|
+
The model was originally developed to handle the terminology database of
|
19
|
+
the https://www.electropedia.org/[IEC 60050 International Electrotechnical Vocabulary (IEV)]
|
20
|
+
and is a superset of the https://www.iso.org/standard/40362.html[ISO 10241-1]
|
21
|
+
concept model used in the ISO Directives.
|
22
|
+
|
23
|
+
The Glossarist model is used by the
|
24
|
+
https://isotc211.geolexica.org/[ISO/TC 211 Multilingual Glossary of Terms],
|
25
|
+
https://isotc204.geolexica.org[ISO/TC 204 Geolexica for Intelligent transport systems (ISO 14812)]
|
26
|
+
and the https://osgeo.geolexica.org[OSGeo Glossary].
|
27
|
+
|
28
|
+
This plugin allows you to access the Glossarist dataset inside a Metanorma
|
29
|
+
document, render concepts, and generate bibliographies for terms defined in the
|
30
|
+
dataset.
|
31
|
+
|
32
|
+
The https://www.iso.org/standard/81196.html[ISO 10303-2:2024] and
|
33
|
+
https://www.iso.org/standard/77019.html[ISO 34000:2023] standards were published
|
34
|
+
using this plugin.
|
35
|
+
|
36
|
+
The full concept model (a concept can have multiple localized concepts) is
|
37
|
+
available via the https://github.com/glossarist/glossarist-ruby[Glossarist] gem.
|
38
|
+
|
39
|
+
Language codes used in Glossarist are ISO 639-* 3-character codes, as described
|
40
|
+
in the https://github.com/glossarist/concept-model[Glossarist Concept model].
|
41
|
+
|
42
|
+
== Installation
|
43
|
+
|
44
|
+
This plugin is included in the default Metanorma distribution.
|
45
|
+
|
46
|
+
== Usage
|
47
|
+
|
48
|
+
=== General
|
49
|
+
|
50
|
+
This plugin is used to load a Glossarist dataset, render concepts from it,
|
51
|
+
and generate bibliographies for terms defined in the dataset.
|
52
|
+
|
53
|
+
A Glossarist dataset typically consists of one or more YAML files, where a
|
54
|
+
single file usually contains a single concept (potentially multilingual) and all
|
55
|
+
its associated data, such as definitions, examples, notes, sources, and
|
56
|
+
bibliographic references.
|
57
|
+
|
58
|
+
The general workflow for using this plugin is as follows:
|
59
|
+
|
60
|
+
. Load a Glossarist dataset globally or for a block
|
61
|
+
. Render terms from the loaded dataset
|
62
|
+
. Generate bibliographies for terms in the dataset
|
63
|
+
|
64
|
+
Steps 2 and 3 are separate steps as a Metanorma document typically contains
|
65
|
+
separate terms sections and bibliography sections, hence the plugin allows you
|
66
|
+
to render terms and bibliographies independently.
|
67
|
+
|
68
|
+
While the plugin provides commands for steps 2 and 3, it is also possible to
|
69
|
+
render such content using the Liquid templating language directly in a
|
70
|
+
Glossarist block.
|
71
|
+
|
72
|
+
There are two ways to use this plugin:
|
73
|
+
|
74
|
+
* Use a Glossarist block together with a custom template.
|
75
|
+
* Use the commands provided by the plugin to render terms and bibliographies.
|
76
|
+
|
77
|
+
=== Using a Glossarist block
|
78
|
+
|
79
|
+
This plugin provides a Glossarist block that allows you to load a Glossarist
|
80
|
+
dataset and render terms from it using a Liquid template.
|
81
|
+
|
82
|
+
Syntax:
|
83
|
+
|
84
|
+
[source,adoc]
|
85
|
+
------
|
86
|
+
[glossarist,{dataset-path},{filters},{context}]
|
87
|
+
----
|
88
|
+
// Liquid template
|
89
|
+
----
|
90
|
+
------
|
91
|
+
|
92
|
+
Where,
|
93
|
+
|
94
|
+
`{dataset-path}`:: The path to the Glossarist dataset (e.g.,
|
95
|
+
`./path/to/glossarist-dataset`).
|
96
|
+
|
97
|
+
`{context}`:: The context in which the dataset is being used (e.g., `concepts`).
|
98
|
+
|
99
|
+
`{filters}`:: (Optional) Filters to apply to the dataset prior to making the
|
100
|
+
`context` available.
|
101
|
+
|
102
|
+
[example]
|
103
|
+
======
|
104
|
+
Given the following Glossarist block:
|
105
|
+
|
106
|
+
[source,adoc]
|
107
|
+
------
|
108
|
+
[glossarist,my-dataset,concepts]
|
109
|
+
----
|
110
|
+
{%- for concept in concepts -%}
|
111
|
+
==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
112
|
+
|
113
|
+
{{ concept.data.localizations['eng'].data.definition[0].content }}
|
114
|
+
{%- endfor -%}
|
115
|
+
----
|
116
|
+
------
|
117
|
+
|
118
|
+
With the following Glossarist dataset:
|
119
|
+
|
120
|
+
`my-dataset/concept-concept.yaml`:
|
121
|
+
[source,yaml]
|
122
|
+
----
|
123
|
+
---
|
124
|
+
data:
|
125
|
+
identifier: '64'
|
126
|
+
localized_concepts:
|
127
|
+
eng: localized-concept-eng
|
128
|
+
ara: localized-concept-ara
|
129
|
+
dan: localized-concept-dan
|
130
|
+
deu: localized-concept-deu
|
131
|
+
kor: localized-concept-kor
|
132
|
+
msa: localized-concept-msa
|
133
|
+
rus: localized-concept-rus
|
134
|
+
spa: localized-concept-spa
|
135
|
+
swe: localized-concept-swe
|
136
|
+
dateAccepted: 2008-11-15 00:00:00.000000000 +05:00
|
137
|
+
id: db4ac6ad-9b2c-5dd0-93ad-b1c06365cfb8
|
138
|
+
related: []
|
139
|
+
status: valid
|
140
|
+
----
|
141
|
+
|
142
|
+
`my-dataset/localized-concept-eng.yaml`:
|
143
|
+
[source,yaml]
|
144
|
+
----
|
145
|
+
---
|
146
|
+
data:
|
147
|
+
dates:
|
148
|
+
- date: 2008-11-15 00:00:00.000000000 +05:00
|
149
|
+
type: accepted
|
150
|
+
definition:
|
151
|
+
- content: unit of knowledge created by a unique combination of characteristics
|
152
|
+
examples: []
|
153
|
+
id: '64'
|
154
|
+
notes:
|
155
|
+
- content: Concepts are not necessarily bound to particular languages. They are,
|
156
|
+
however, influenced by the social or cultural background which often leads to
|
157
|
+
different categorizations.
|
158
|
+
release: 2.0
|
159
|
+
sources:
|
160
|
+
- origin:
|
161
|
+
ref: ISO 1087-1:2000
|
162
|
+
clause: 3.2.1
|
163
|
+
link: https://www.iso.org/standard/20057.html
|
164
|
+
type: authoritative
|
165
|
+
status: unspecified
|
166
|
+
- origin:
|
167
|
+
ref: ISO/TS 19104:2008
|
168
|
+
type: lineage
|
169
|
+
status: unspecified
|
170
|
+
terms:
|
171
|
+
- type: expression
|
172
|
+
normative_status: preferred
|
173
|
+
designation: concept
|
174
|
+
language_code: eng
|
175
|
+
entry_status: valid
|
176
|
+
review_date: 2013-01-29 00:00:00.000000000 +05:00
|
177
|
+
review_decision_date: 2016-10-01 00:00:00.000000000 +05:00
|
178
|
+
review_decision_event: Publication of ISO 19104:2016
|
179
|
+
dateAccepted: 2008-11-15 00:00:00.000000000 +05:00
|
180
|
+
id: 000bb787-0d0f-5330-b07d-3469adbe9289
|
181
|
+
status: valid
|
182
|
+
----
|
183
|
+
|
184
|
+
`my-dataset/concept-address-component.yaml`:
|
185
|
+
[source,yaml]
|
186
|
+
----
|
187
|
+
---
|
188
|
+
data:
|
189
|
+
identifier: '64'
|
190
|
+
localized_concepts:
|
191
|
+
eng: localized-address-component-eng
|
192
|
+
ara: localized-address-component-ara
|
193
|
+
dan: localized-address-component-dan
|
194
|
+
deu: localized-address-component-deu
|
195
|
+
kor: localized-address-component-kor
|
196
|
+
msa: localized-address-component-msa
|
197
|
+
rus: localized-address-component-rus
|
198
|
+
spa: localized-address-component-spa
|
199
|
+
swe: localized-address-component-swe
|
200
|
+
dateAccepted: 2008-11-15 00:00:00.000000000 +05:00
|
201
|
+
id: db4ac6ad-9b2c-5dd0-93ad-b1c06365cfb8
|
202
|
+
related: []
|
203
|
+
status: valid
|
204
|
+
----
|
205
|
+
|
206
|
+
`my-dataset/localized-address-component-eng.yaml`:
|
207
|
+
[source,yaml]
|
208
|
+
----
|
209
|
+
---
|
210
|
+
data:
|
211
|
+
dates:
|
212
|
+
- date: 2015-12-15 00:00:00.000000000 +05:00
|
213
|
+
type: accepted
|
214
|
+
definition:
|
215
|
+
- content: constituent part of the address
|
216
|
+
examples: []
|
217
|
+
id: '1553'
|
218
|
+
notes:
|
219
|
+
- content: An address component may reference another object such as a spatial object
|
220
|
+
(e.g. an administrative boundary or a land parcel) or a non-spatial object (e.g.
|
221
|
+
an organization or a person).
|
222
|
+
- content: An address component may have one or more alternative values, e.g. alternatives
|
223
|
+
in different languages or abbreviated alternatives.
|
224
|
+
release: 4.0
|
225
|
+
sources:
|
226
|
+
- origin:
|
227
|
+
ref: ISO 19160-1:2015
|
228
|
+
clause: '4.5'
|
229
|
+
link: https://www.iso.org/standard/61710.html
|
230
|
+
type: authoritative
|
231
|
+
terms:
|
232
|
+
- type: expression
|
233
|
+
normative_status: preferred
|
234
|
+
designation: address component
|
235
|
+
language_code: eng
|
236
|
+
entry_status: valid
|
237
|
+
review_date: 2012-02-27 00:00:00.000000000 +05:00
|
238
|
+
review_decision_date: 2015-12-15 00:00:00.000000000 +05:00
|
239
|
+
review_decision_event: Normal ISO processing
|
240
|
+
dateAccepted: 2015-12-15 00:00:00.000000000 +05:00
|
241
|
+
id: 02f7c47b-8820-59a6-a82e-127103ea42ec
|
242
|
+
status: valid
|
243
|
+
----
|
244
|
+
|
245
|
+
The output will be:
|
246
|
+
|
247
|
+
[source,adoc]
|
248
|
+
----
|
249
|
+
==== concept
|
250
|
+
|
251
|
+
unit of knowledge created by a unique combination of characteristics
|
252
|
+
|
253
|
+
==== address component
|
254
|
+
|
255
|
+
constituent part of the address
|
256
|
+
----
|
257
|
+
======
|
258
|
+
|
259
|
+
|
260
|
+
In the block syntax, filters can be applied to the dataset to filter or sort the
|
261
|
+
concepts based on specific criteria. For example, you can filter concepts by
|
262
|
+
group or language, or sort them by term.
|
263
|
+
|
264
|
+
Multiple filters can be applied by separating them with a semicolon `;`.
|
265
|
+
|
266
|
+
.Using multiple filters
|
267
|
+
[example]
|
268
|
+
====
|
269
|
+
[source,adoc]
|
270
|
+
------
|
271
|
+
[glossarist,dataset,filter='group=foo;sort_by=term',concepts]
|
272
|
+
----
|
273
|
+
...
|
274
|
+
----
|
275
|
+
------
|
276
|
+
====
|
277
|
+
|
278
|
+
|
279
|
+
The following types of filters are supported:
|
280
|
+
|
281
|
+
Collection filters:: These filters are applied to the entire dataset and affect
|
282
|
+
which concepts are loaded into the block.
|
283
|
+
|
284
|
+
`sort_by=<field name>`::: Sorts the dataset in ascending order of the given
|
285
|
+
field values. The field `term` is a special case, where it sorts according to
|
286
|
+
the `default_designation` of the term.
|
287
|
+
+
|
288
|
+
[example]
|
289
|
+
`sort_by=term` will sort concepts in ascending order based on the
|
290
|
+
default term (which is the first English designation, at `data.localizations['eng'].data.terms[0].designation`).
|
291
|
+
|
292
|
+
`lang=<language code>`::: Loads concepts in the specified language.
|
293
|
+
+
|
294
|
+
[example]
|
295
|
+
`lang=ara` loads all localized concepts of Arabic for all concepts.
|
296
|
+
|
297
|
+
`group=<group name>`::: Loads concepts that belong to the specified group. Group is a dataset-specific
|
298
|
+
field that can be used to categorize concepts.
|
299
|
+
+
|
300
|
+
[example]
|
301
|
+
`group=foo` will only load concepts that have a group named `foo`.
|
302
|
+
|
303
|
+
Field filters:: These filters are applied to individual fields of the concepts
|
304
|
+
and affect which concepts are included in the block based on the values of those
|
305
|
+
fields.
|
306
|
+
|
307
|
+
`{path}=({value})`::: Value match. Loads concepts where the value of the
|
308
|
+
specified field matches the given value.
|
309
|
+
+
|
310
|
+
[example]
|
311
|
+
`data.localizations['eng'].data.terms[0].designation=entity` will only load
|
312
|
+
concepts where the English term is "entity".
|
313
|
+
|
314
|
+
`start_with({value})`::: Value starts with. Loads concepts where the specified field starts with the given value.
|
315
|
+
+
|
316
|
+
[example]
|
317
|
+
`data.localizations['eng'].data.terms[0].designation.start_with(enti)` will only
|
318
|
+
load concepts where the English term starts with "enti".
|
319
|
+
|
320
|
+
|
321
|
+
[example]
|
322
|
+
====
|
323
|
+
[source,adoc]
|
324
|
+
--------
|
325
|
+
Given the following Glossarist block:
|
326
|
+
|
327
|
+
[source,adoc]
|
328
|
+
------
|
329
|
+
[glossarist,glossarist-v2,filter='data.localizations['eng'].data.terms[0].designation.start_with(conc)',concepts]
|
330
|
+
----
|
331
|
+
{%- for concept in concepts -%}
|
332
|
+
==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
333
|
+
|
334
|
+
{{ concept.data.localizations['eng'].data.definition[0].content }}
|
335
|
+
{%- endfor -%}
|
336
|
+
----
|
337
|
+
------
|
338
|
+
|
339
|
+
The output will be:
|
340
|
+
|
341
|
+
[source,adoc]
|
342
|
+
----
|
343
|
+
==== concept
|
344
|
+
|
345
|
+
unit of knowledge created by a unique combination of characteristics
|
346
|
+
|
347
|
+
==== address component
|
348
|
+
|
349
|
+
constituent part of the address
|
350
|
+
----
|
351
|
+
--------
|
352
|
+
====
|
353
|
+
|
354
|
+
|
355
|
+
=== Loading a Glossarist dataset globally
|
356
|
+
|
357
|
+
In cases where the document works mainly with a single Glossarist dataset, it is
|
358
|
+
possible to load the dataset globally at the beginning of the document for
|
359
|
+
performance reasons. This allows you to use the dataset in any block without
|
360
|
+
having to specify the dataset path again.
|
361
|
+
|
362
|
+
Glossarist provides the `:glossarist-dataset:` syntax in the document attributes
|
363
|
+
section to load a dataset globally. Each dataset will henceforth be identified
|
364
|
+
by the unique name and path.
|
365
|
+
|
366
|
+
Syntax:
|
367
|
+
|
368
|
+
[source,adoc]
|
369
|
+
----
|
370
|
+
// header
|
371
|
+
:glossarist-dataset: {dataset1-name}:{dataset1-path};{dataset2-name}:{dataset2-path}
|
372
|
+
|
373
|
+
// content
|
374
|
+
----
|
375
|
+
|
376
|
+
Where,
|
377
|
+
|
378
|
+
`{dataset-name}`:: The name of the dataset (e.g., `dataset`).
|
379
|
+
|
380
|
+
`{dataset-path}`:: The path to the Glossarist dataset (e.g., `./path/to/glossarist-dataset`).
|
381
|
+
|
382
|
+
One or more datasets can be loaded by separating them with a semicolon `;`.
|
383
|
+
|
384
|
+
These datasets can then be used in any Glossarist block in the document
|
385
|
+
without having to specify the dataset path again.
|
386
|
+
|
387
|
+
[example]
|
388
|
+
====
|
389
|
+
[source,adoc]
|
390
|
+
------
|
391
|
+
:glossarist-dataset: dataset1:./path/to/glossarist-dataset1;dataset2:./path/to/glossarist-dataset2
|
392
|
+
|
393
|
+
=== Terms and definitions
|
394
|
+
[glossarist,dataset1,concepts]
|
395
|
+
----
|
396
|
+
{%- for concept in concepts -%}
|
397
|
+
Term: {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
398
|
+
|
399
|
+
{%- endfor -%}
|
400
|
+
----
|
401
|
+
------
|
402
|
+
|
403
|
+
The output will be:
|
404
|
+
|
405
|
+
[source,adoc]
|
406
|
+
----
|
407
|
+
=== Terms and definitions
|
408
|
+
Term: concept
|
409
|
+
|
410
|
+
Term: address component
|
411
|
+
----
|
412
|
+
====
|
413
|
+
|
414
|
+
|
415
|
+
=== Glossarist predefined templates
|
416
|
+
|
417
|
+
==== General
|
418
|
+
|
419
|
+
Glossarist provides predefined templates for rendering concepts and
|
420
|
+
bibliographies.
|
421
|
+
|
422
|
+
==== Rendering one concept
|
423
|
+
|
424
|
+
The `glossarist::render[{dataset-name},{term}]` command renders a single concept
|
425
|
+
from the globally loaded dataset.
|
426
|
+
|
427
|
+
Syntax:
|
428
|
+
|
429
|
+
[source,adoc]
|
430
|
+
----
|
431
|
+
glossarist::render[{dataset-name}, {term}]
|
432
|
+
----
|
433
|
+
|
434
|
+
Where,
|
435
|
+
|
436
|
+
`{dataset-name}`:: The name of the dataset (e.g., `dataset`).
|
437
|
+
|
438
|
+
`{term}`:: The term to render (e.g., `foobar`).
|
439
|
+
+
|
440
|
+
NOTE: The `term` points to the
|
441
|
+
`data.localizations['eng'].data.terms[0].designation` field of the concept.
|
442
|
+
|
443
|
+
[example]
|
444
|
+
====
|
445
|
+
Given the following code:
|
446
|
+
|
447
|
+
[source,adoc]
|
448
|
+
----
|
449
|
+
:glossarist-dataset: dataset:my-dataset
|
450
|
+
|
451
|
+
=== Terms and definitions
|
452
|
+
|
453
|
+
glossarist::render[dataset,concept]
|
454
|
+
----
|
455
|
+
|
456
|
+
The output will be:
|
457
|
+
|
458
|
+
[source,adoc]
|
459
|
+
----
|
460
|
+
=== Terms and definitions
|
461
|
+
|
462
|
+
==== concept
|
463
|
+
|
464
|
+
unit of knowledge created by a unique combination of characteristics
|
465
|
+
|
466
|
+
[NOTE]
|
467
|
+
Concepts are not necessarily bound to particular languages. They are, however,
|
468
|
+
influenced by the social or cultural background which often leads to different
|
469
|
+
categorizations.
|
470
|
+
|
471
|
+
[.source]
|
472
|
+
<<ISO_1087-1_2000,3.2.1>>
|
473
|
+
----
|
474
|
+
====
|
475
|
+
|
476
|
+
The command automatically detects section depth (e.g., `=== Terms and
|
477
|
+
definitions` is at depth 2) and renders the concept at "depth + 1". It uses the
|
478
|
+
default template for rendering a single concept, which is defined in the plugin.
|
479
|
+
|
480
|
+
The default template for rendering a single concept is used, and is provided at
|
481
|
+
<<default-template-for-rendering-concepts>>.
|
482
|
+
|
483
|
+
==== Rendering all concepts
|
484
|
+
|
485
|
+
The `glossarist::import[{dataset-name}]` command renders all concepts from the
|
486
|
+
globally loaded dataset.
|
487
|
+
|
488
|
+
Syntax:
|
489
|
+
|
490
|
+
[source,adoc]
|
491
|
+
----
|
492
|
+
glossarist::import[{dataset-name}]
|
493
|
+
----
|
494
|
+
|
495
|
+
Where,
|
496
|
+
|
497
|
+
`{dataset-name}`:: The name of the dataset (e.g., `dataset`).
|
498
|
+
|
499
|
+
[example]
|
500
|
+
======
|
501
|
+
Given the following code:
|
502
|
+
|
503
|
+
[source,adoc]
|
504
|
+
----
|
505
|
+
:glossarist-dataset: dataset:my-dataset
|
506
|
+
|
507
|
+
=== Terms and definitions
|
508
|
+
|
509
|
+
glossarist::import[dataset]
|
510
|
+
----
|
511
|
+
|
512
|
+
The output will be:
|
513
|
+
|
514
|
+
[source,adoc]
|
515
|
+
----
|
516
|
+
=== Terms and definitions
|
517
|
+
|
518
|
+
==== concept
|
519
|
+
|
520
|
+
unit of knowledge created by a unique combination of characteristics
|
521
|
+
|
522
|
+
[NOTE]
|
523
|
+
====
|
524
|
+
Concepts are not necessarily bound to particular languages. They are, however,
|
525
|
+
influenced by the social or cultural background which often leads to different
|
526
|
+
categorizations.
|
527
|
+
====
|
528
|
+
|
529
|
+
[.source]
|
530
|
+
<<ISO_1087-1_2000,3.2.1>>
|
531
|
+
|
532
|
+
==== address component
|
533
|
+
|
534
|
+
constituent part of the address
|
535
|
+
|
536
|
+
[NOTE]
|
537
|
+
====
|
538
|
+
An address component may reference another object such as a spatial object
|
539
|
+
(e.g. an administrative boundary or a land parcel) or a non-spatial object (e.g.
|
540
|
+
an organization or a person).
|
541
|
+
====
|
542
|
+
|
543
|
+
[NOTE]
|
544
|
+
====
|
545
|
+
An address component may have one or more alternative values, e.g. alternatives
|
546
|
+
for "street" could include "road", "avenue", or "boulevard".
|
547
|
+
====
|
548
|
+
|
549
|
+
[.source]
|
550
|
+
<<ISO_19160-1_2015,4.5>>
|
551
|
+
----
|
552
|
+
======
|
553
|
+
|
554
|
+
|
555
|
+
==== Bibliography for a single term
|
556
|
+
|
557
|
+
The `glossarist::render_bibliography_entry[{dataset-name}, {term}]` command renders
|
558
|
+
a bibliography entry for a single term in the globally loaded dataset.
|
559
|
+
|
560
|
+
Syntax:
|
561
|
+
|
562
|
+
[source,adoc]
|
563
|
+
----
|
564
|
+
glossarist::render_bibliography_entry[{dataset-name}, {term}]
|
565
|
+
----
|
566
|
+
|
567
|
+
Where,
|
568
|
+
|
569
|
+
`{dataset-name}`:: The name of the dataset (e.g., `dataset`).
|
570
|
+
|
571
|
+
`{term}`:: The term to render the bibliography for (e.g., `foo`).
|
572
|
+
|
573
|
+
The command automatically detects the bibliographic reference for the term and
|
574
|
+
renders it using the default template for bibliography, which is defined in
|
575
|
+
<<default-template-for-bibliography>>.
|
576
|
+
|
577
|
+
[example]
|
578
|
+
====
|
579
|
+
Given the following code:
|
580
|
+
|
581
|
+
[source,adoc]
|
582
|
+
----
|
583
|
+
:glossarist-dataset: dataset:my-dataset
|
584
|
+
|
585
|
+
...
|
586
|
+
|
587
|
+
[bibliography]
|
588
|
+
== Bibliography
|
589
|
+
|
590
|
+
glossarist::render_bibliography_entry[dataset, foo]
|
591
|
+
----
|
592
|
+
|
593
|
+
The output will be:
|
594
|
+
|
595
|
+
[source,adoc]
|
596
|
+
----
|
597
|
+
== Bibliography
|
598
|
+
|
599
|
+
* [[[ISO_1087-1_2000,ISO 1087-1:2000]]]
|
600
|
+
----
|
601
|
+
====
|
602
|
+
|
603
|
+
==== Bibliography for all terms
|
604
|
+
|
605
|
+
The `glossarist::render_bibliography[{dataset-name}]` command renders a
|
606
|
+
bibliography for all terms in the globally loaded dataset.
|
607
|
+
|
608
|
+
Syntax:
|
609
|
+
|
610
|
+
[source,adoc]
|
611
|
+
----
|
612
|
+
glossarist::render_bibliography[{dataset-name}]
|
613
|
+
----
|
614
|
+
|
615
|
+
Where,
|
616
|
+
|
617
|
+
`{dataset-name}`:: The name of the dataset (e.g., `dataset`).
|
618
|
+
|
619
|
+
[example]
|
620
|
+
====
|
621
|
+
Given the following code:
|
622
|
+
|
623
|
+
[source,adoc]
|
624
|
+
----
|
625
|
+
:glossarist-dataset: dataset:my-dataset
|
626
|
+
|
627
|
+
[bibliography]
|
628
|
+
== Bibliography
|
629
|
+
|
630
|
+
glossarist::render_bibliography[dataset]
|
631
|
+
----
|
632
|
+
|
633
|
+
The output will be:
|
634
|
+
|
635
|
+
[source,adoc]
|
636
|
+
----
|
637
|
+
== Bibliography
|
638
|
+
|
639
|
+
* [[[ISO_1087-1_2000,ISO 1087-1:2000]]]
|
640
|
+
* [[[ISO_19160-1_2015,ISO 19160-1:2015]]]
|
641
|
+
----
|
642
|
+
====
|
643
|
+
|
644
|
+
|
645
|
+
== Extended examples
|
646
|
+
|
647
|
+
This section provides extended examples of using the Glossarist plugin with realistic sample data.
|
648
|
+
|
649
|
+
[example]
|
650
|
+
.Basic rendering of all terms
|
651
|
+
====
|
652
|
+
Suppose we have the following terms in our dataset:
|
653
|
+
|
654
|
+
|===
|
655
|
+
| Name | Definition | Groups
|
656
|
+
|
657
|
+
| concept
|
658
|
+
| Unit of knowledge created by a unique combination of characteristics
|
659
|
+
| terminology
|
660
|
+
|
661
|
+
| address component
|
662
|
+
| Constituent part of the address
|
663
|
+
| addressing, location
|
664
|
+
|
665
|
+
| spatial reference system
|
666
|
+
| System for identifying position in the real world
|
667
|
+
| geospatial, coordinate
|
668
|
+
|===
|
669
|
+
|
670
|
+
Using the following Glossarist block:
|
671
|
+
|
672
|
+
[source,asciidoc]
|
673
|
+
------
|
674
|
+
=== Terms and definitions
|
675
|
+
[glossarist, /path/to/glossarist-dataset, dataset]
|
676
|
+
----
|
677
|
+
{%- for concept in dataset -%}
|
678
|
+
==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
679
|
+
|
680
|
+
{{ concept.data.localizations['eng'].data.definition[0].content }}
|
681
|
+
{%- endfor -%}
|
682
|
+
----
|
683
|
+
------
|
684
|
+
|
685
|
+
The output will be:
|
686
|
+
|
687
|
+
[source,asciidoc]
|
688
|
+
----
|
689
|
+
=== Terms and definitions
|
690
|
+
|
691
|
+
==== concept
|
692
|
+
|
693
|
+
Unit of knowledge created by a unique combination of characteristics
|
694
|
+
|
695
|
+
==== address component
|
696
|
+
|
697
|
+
Constituent part of the address
|
698
|
+
|
699
|
+
==== spatial reference system
|
700
|
+
|
701
|
+
System for identifying position in the real world
|
702
|
+
----
|
703
|
+
====
|
704
|
+
|
705
|
+
[example]
|
706
|
+
.Applying sorting and filtering by group
|
707
|
+
====
|
708
|
+
Using the same dataset as above, but with sorting and filtering by the "terminology" group:
|
709
|
+
|
710
|
+
[source,asciidoc]
|
711
|
+
------
|
712
|
+
=== Terms and definitions
|
713
|
+
[glossarist, /path/to/glossarist-dataset, filter='group=terminology;sort_by=term', dataset]
|
714
|
+
----
|
715
|
+
{%- for concept in dataset -%}
|
716
|
+
==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
717
|
+
|
718
|
+
{{ concept.data.localizations['eng'].data.definition[0].content }}
|
719
|
+
{%- endfor -%}
|
720
|
+
----
|
721
|
+
------
|
722
|
+
|
723
|
+
The output will be:
|
724
|
+
|
725
|
+
[source,asciidoc]
|
726
|
+
----
|
727
|
+
=== Terms and definitions
|
728
|
+
|
729
|
+
==== concept
|
730
|
+
|
731
|
+
Unit of knowledge created by a unique combination of characteristics
|
732
|
+
----
|
733
|
+
====
|
734
|
+
|
735
|
+
[example]
|
736
|
+
.Filtering by field value
|
737
|
+
======
|
738
|
+
Using the same dataset, but filtering for terms related to addressing:
|
739
|
+
|
740
|
+
[source,asciidoc]
|
741
|
+
------
|
742
|
+
=== Terms and definitions
|
743
|
+
[glossarist, /path/to/glossarist-dataset, filter='group=addressing', dataset]
|
744
|
+
----
|
745
|
+
{%- for concept in dataset -%}
|
746
|
+
==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
747
|
+
|
748
|
+
{{ concept.data.localizations['eng'].data.definition[0].content }}
|
749
|
+
|
750
|
+
{% for note in concept.data.localizations['eng'].data.notes %}
|
751
|
+
[NOTE]
|
752
|
+
====
|
753
|
+
{{ note.content }}
|
754
|
+
====
|
755
|
+
{% endfor %}
|
756
|
+
{%- endfor -%}
|
757
|
+
----
|
758
|
+
------
|
759
|
+
|
760
|
+
The output will be:
|
761
|
+
|
762
|
+
[source,asciidoc]
|
763
|
+
----
|
764
|
+
=== Terms and definitions
|
765
|
+
|
766
|
+
==== address component
|
767
|
+
|
768
|
+
Constituent part of the address
|
769
|
+
|
770
|
+
[NOTE]
|
771
|
+
====
|
772
|
+
An address component may reference another object such as a spatial object
|
773
|
+
(e.g. an administrative boundary or a land parcel) or a non-spatial object (e.g.
|
774
|
+
an organization or a person).
|
775
|
+
====
|
776
|
+
|
777
|
+
[NOTE]
|
778
|
+
====
|
779
|
+
An address component may have one or more alternative values, e.g. alternatives
|
780
|
+
in different languages or abbreviated alternatives.
|
781
|
+
====
|
782
|
+
----
|
783
|
+
======
|
784
|
+
|
785
|
+
|
786
|
+
== Appendix
|
787
|
+
|
788
|
+
[[default-template-for-rendering-concepts]]
|
789
|
+
=== Default template for rendering concepts
|
790
|
+
|
791
|
+
[source,asciidoc]
|
792
|
+
----
|
793
|
+
==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
|
794
|
+
<type>:[designation for the type]
|
795
|
+
|
796
|
+
{{ concept.data.localizations['eng'].data.definition[0].content }}
|
797
|
+
|
798
|
+
{% for example in <concept.data.localizations['eng'].data.examples> %}
|
799
|
+
[example]
|
800
|
+
{{ example.content }}
|
801
|
+
|
802
|
+
{% endfor %}
|
803
|
+
|
804
|
+
{% for note in <concept.data.localizations['eng'].data.notes> %}
|
805
|
+
[NOTE]
|
806
|
+
====
|
807
|
+
{{ note.content }}
|
808
|
+
====
|
809
|
+
|
810
|
+
{% endfor %}
|
811
|
+
|
812
|
+
{% for source in <concept.data.localizations['eng'].data.sources> %}
|
813
|
+
[.source]
|
814
|
+
<<{{ <source.origin.text.gsub(" ", "_").gsub("/", "_").gsub(":", "_")>,<source.origin.clause> }}>>
|
815
|
+
|
816
|
+
{% endfor %}
|
817
|
+
----
|
818
|
+
|
819
|
+
|
820
|
+
[[default-template-for-bibliography]]
|
821
|
+
=== Default template for bibliography
|
822
|
+
|
823
|
+
[source,asciidoc]
|
824
|
+
----
|
825
|
+
* [[[{{ <source.origin.text.gsub(" ", "_").gsub("/", "_").gsub(":", "_")>,<source.origin.clause> }},{{source.origin.text}}]]]
|
826
|
+
----
|
827
|
+
|
828
|
+
== Documentation
|
829
|
+
|
830
|
+
Please refer to https://www.metanorma.org.
|
831
|
+
|
832
|
+
== Copyright and license
|
833
|
+
|
834
|
+
Copyright Ribose.
|
835
|
+
|
836
|
+
Licensed under the MIT License.
|