relaton-render 0.5.3 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +11 -4
- data/lib/isodoc/i18n.rb +3 -2
- data/lib/isodoc-yaml/i18n-ar.yaml +5 -0
- data/lib/isodoc-yaml/i18n-de.yaml +5 -0
- data/lib/isodoc-yaml/i18n-en.yaml +5 -0
- data/lib/isodoc-yaml/i18n-es.yaml +5 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +5 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +5 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +8 -3
- data/lib/isodoc-yaml/i18n-zh-Hant.yaml +45 -0
- data/lib/relaton/render/general/config.yml +15 -15
- data/lib/relaton/render/parse/parse_contributors.rb +16 -0
- data/lib/relaton/render/parse/parse_extract.rb +7 -5
- data/lib/relaton/render/template/template.rb +18 -7
- data/lib/relaton/render/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 582bd299999942dc5919461f4bde4d4ea90418708be1cda926903aa05659baa2
|
4
|
+
data.tar.gz: 5c8f8e6346a911b28bca037a9f6f931dd997d562400a615b9bbfd9f66a653848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5994cb6fbfac2a14e0ad9e34c5acd3f33b12e2f983ac2e9de2d34cf8392b8e5e11fa1802eb5bc21dce0b545d1ac2d36b9a50a75e6344b962c207dba31a923cb
|
7
|
+
data.tar.gz: 6363973667df0ba2751b7d87dd6abd7d3f4f733cdb1cbac6c6543ea0cd79befea3cfb5003ae6b50753132c2aebf826f846e0fc12e0985aa84163a88e91c92874
|
data/README.adoc
CHANGED
@@ -158,7 +158,7 @@ drawn from the bibliographic item:
|
|
158
158
|
| authoritative_identifier | ./docidentifier[not(@type = 'metanorma' or @type = 'ordinal' or @type = 'ISBN' or @type = 'ISSN' or @type = 'DOI')] | Y | |
|
159
159
|
| other_identifier | ./docidentifier[@type = 'ISBN' or @type = 'ISSN' or @type = 'DOI'] | Y | | By default, each such identifier is prefixed with its type and colon
|
160
160
|
| status | ./status | | | Rendering varies by flavour
|
161
|
-
| uri | ./uri[@type = 'citation' or @type = '
|
161
|
+
| uri | ./uri[@type = 'citation' or @type = 'uri' or @type = 'src' or true] | | | If multiples, prioritise language match. Always exclude DOI: that is not where the resource is available from
|
162
162
|
| access_location | ./accessLocation | | Y |
|
163
163
|
| extent | ./extent | Y | | Render with standard abbreviations for pp, vols, with n-dash, with delimiting of multiple locations
|
164
164
|
| creatornames | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<nametemplate,`nametemplate`>> applied to each name; joining template from internationalisation applied to multiple names
|
@@ -193,6 +193,7 @@ The Liquid template surrounds each field by preceding and following punctuation.
|
|
193
193
|
* If punctuation is space delimited, it is inserted regardless of preceding content. So `{{ creatornames }} ({{date}}) .` will insert the full stop whether or not the date is present.
|
194
194
|
* Space between punctuation and before punctuation is automatically removed.
|
195
195
|
* Spaces within fields are globally converted to underscores. For that reason, any filter operations in Liquid need to refer to underscore instead of space.
|
196
|
+
* There are primary and secondary quotation marks defined as labels, and subject to internationalisation: `{{ labels['qq-open'] }}`, `{{ labels['qq-close'] }}`, `{{ labels['q-open'] }}`, `{{ labels['q-close'] }}`. By default in Latn and Cyrl, these are `<em>`/`</em>` and empty, respectively; they are 《…》 , 〈…〉 in Hans, and wavy underline, empty in Hant. If these are used, they need not to be space-delimited from what they quote; e.g. `{{ labels['qq-open'] }}{{ title }}{{ labels['qq-close'] }}`.
|
196
197
|
|
197
198
|
For example:
|
198
199
|
|
@@ -230,9 +231,15 @@ draws on the following fields drawn from the bibliographic item:
|
|
230
231
|
| nonpersonal[1] |./contributor[2]/organization/name | Y |
|
231
232
|
|===
|
232
233
|
|
233
|
-
The `formatted-initials` field is presumed to contain full stops, and so do the surrogates of that
|
234
|
-
forenames' `initial` attributes, or the forename initials.
|
235
|
-
|
234
|
+
The `formatted-initials` field is presumed to contain full stops, and so do the surrogates of that
|
235
|
+
field done by using individual forenames' `initial` attributes, or the forename initials.
|
236
|
+
Initials are considered delimited by a full stop followed by space or an alphabetic character.
|
237
|
+
If the full stops are to be stripped, as is often required by bibliographic styles, that needs to occur within the
|
238
|
+
Liquid template. Bibliographic styles also govern whether initials are separated by space; this gem treats full stop,
|
239
|
+
not space, as the initials delimiter.
|
240
|
+
|
241
|
+
(So _D. X._ is two initials, as is _D.X._, but _M.-J._ is a single initial, and so is _de S._)
|
242
|
+
|
236
243
|
|
237
244
|
There are at least three distinct `nametemplate` instances that need to be provided, one for a single contributor (`one:`), one for two contributors (`two:`), one for three or more (`more:`), and optionally one for "et al." (`etal:`). The number of contributors for which "et al." starts being used is indicated by `etal_count`.
|
238
245
|
|
data/lib/isodoc/i18n.rb
CHANGED
@@ -8,8 +8,9 @@ module IsoDoc
|
|
8
8
|
when "en", "fr", "ru", "de", "es", "ar"
|
9
9
|
load_yaml2(lang)
|
10
10
|
when "zh"
|
11
|
-
|
12
|
-
|
11
|
+
case script
|
12
|
+
when "Hans", "Hant" then load_yaml2("zh-#{script}")
|
13
|
+
else load_yaml2("zh-Hans")
|
13
14
|
end
|
14
15
|
else load_yaml2("en")
|
15
16
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
in: في
|
2
2
|
at: في
|
3
3
|
and: و
|
4
|
+
author_and: و
|
4
5
|
updated: محدث
|
5
6
|
viewed: ينظر
|
6
7
|
version: الإصدار
|
@@ -38,6 +39,10 @@ size:
|
|
38
39
|
issue:
|
39
40
|
sg: "% عدد"
|
40
41
|
pl: "% عدد"
|
42
|
+
qq-open: «
|
43
|
+
qq-close: »
|
44
|
+
q-open:
|
45
|
+
q-close:
|
41
46
|
inflection:
|
42
47
|
الطبعة:
|
43
48
|
gender: f
|
@@ -1,6 +1,7 @@
|
|
1
1
|
in: in
|
2
2
|
at: bei
|
3
3
|
and: und
|
4
|
+
author_and: und
|
4
5
|
updated: aktualisiert
|
5
6
|
viewed: angesehen
|
6
7
|
version: Version
|
@@ -27,6 +28,10 @@ extent:
|
|
27
28
|
issue:
|
28
29
|
sg: "Nr. %"
|
29
30
|
pl: "Nr. %"
|
31
|
+
qq-open: <em>
|
32
|
+
qq-close: </em>
|
33
|
+
q-open:
|
34
|
+
q-close:
|
30
35
|
size:
|
31
36
|
page:
|
32
37
|
sg: "% S."
|
@@ -1,6 +1,7 @@
|
|
1
1
|
in: in
|
2
2
|
at: at
|
3
3
|
and: and
|
4
|
+
author_and: and
|
4
5
|
updated: updated
|
5
6
|
viewed: viewed
|
6
7
|
version: version
|
@@ -18,6 +19,10 @@ draft: "draft %"
|
|
18
19
|
editor:
|
19
20
|
sg: ed.
|
20
21
|
pl: eds.
|
22
|
+
qq-open: <em>
|
23
|
+
qq-close: </em>
|
24
|
+
q-open:
|
25
|
+
q-close:
|
21
26
|
extent:
|
22
27
|
page:
|
23
28
|
sg: "p. %"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
in: en
|
2
2
|
at: en
|
3
3
|
and: y
|
4
|
+
author_and: y
|
4
5
|
updated: actualizado
|
5
6
|
viewed: visto
|
6
7
|
version: versión
|
@@ -20,6 +21,10 @@ draft: "borrador %"
|
|
20
21
|
editor:
|
21
22
|
sg: ed.
|
22
23
|
pl: eds.
|
24
|
+
qq-open: <em>
|
25
|
+
qq-close: </em>
|
26
|
+
q-open:
|
27
|
+
q-close:
|
23
28
|
extent:
|
24
29
|
page:
|
25
30
|
sg: "pág. %"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
in: dans
|
2
2
|
at: à
|
3
3
|
and: et
|
4
|
+
author_and: et
|
4
5
|
updated: mise à jour
|
5
6
|
viewed: vu
|
6
7
|
version: version
|
@@ -22,6 +23,10 @@ draft: "brouillon %"
|
|
22
23
|
editor:
|
23
24
|
sg: éd.
|
24
25
|
pl: éd.
|
26
|
+
qq-open: <em>
|
27
|
+
qq-close: </em>
|
28
|
+
q-open:
|
29
|
+
q-close:
|
25
30
|
extent:
|
26
31
|
page:
|
27
32
|
sg: "p. %"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
in: в
|
2
2
|
at: в
|
3
3
|
and: и
|
4
|
+
author_and: и
|
4
5
|
updated: обновлен
|
5
6
|
viewed: просмотрено
|
6
7
|
version: версия
|
@@ -24,6 +25,10 @@ draft: "проект %"
|
|
24
25
|
editor:
|
25
26
|
sg: изд.
|
26
27
|
pl: изд.
|
28
|
+
qq-open: <em>
|
29
|
+
qq-close: </em>
|
30
|
+
q-open:
|
31
|
+
q-close:
|
27
32
|
extent:
|
28
33
|
page:
|
29
34
|
sg: "стр. %"
|
@@ -1,8 +1,9 @@
|
|
1
1
|
in: 在
|
2
2
|
at: 在
|
3
3
|
and: 和
|
4
|
+
author_and: 和
|
4
5
|
updated: 更新
|
5
|
-
viewed:
|
6
|
+
viewed: 阅
|
6
7
|
version: 版本
|
7
8
|
no_date: 无日期
|
8
9
|
no_place: 无出版地
|
@@ -16,8 +17,12 @@ edition_ordinal: "第%Ordinal版"
|
|
16
17
|
edition: 版
|
17
18
|
draft: "草案%"
|
18
19
|
editor:
|
19
|
-
sg:
|
20
|
-
pl:
|
20
|
+
sg: 编
|
21
|
+
pl: 编
|
22
|
+
qq-open: 《
|
23
|
+
qq-close: 》
|
24
|
+
q-open: 〈
|
25
|
+
q-close: 〉
|
21
26
|
extent:
|
22
27
|
page:
|
23
28
|
sg: "第%页"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
in: 在
|
2
|
+
at: 在
|
3
|
+
and: 和
|
4
|
+
author_and: 與
|
5
|
+
updated: 更新
|
6
|
+
viewed: 閱
|
7
|
+
version: 版本
|
8
|
+
no_date: 無日期
|
9
|
+
no_place: 無出版地
|
10
|
+
date_formats:
|
11
|
+
month_year: yMMMM
|
12
|
+
day_month_year: to_long_s
|
13
|
+
date_time: to_long_s
|
14
|
+
ordinal_keys: []
|
15
|
+
OrdinalRules: digits-ordinal
|
16
|
+
edition_ordinal: "第%Ordinal版"
|
17
|
+
edition: 版
|
18
|
+
draft: "草案%"
|
19
|
+
editor:
|
20
|
+
sg: 編輯
|
21
|
+
pl: 編輯
|
22
|
+
qq-open: <underline style="wavy">
|
23
|
+
qq-close: </underline>
|
24
|
+
q-open: 〈
|
25
|
+
q-close: 〉
|
26
|
+
extent:
|
27
|
+
page:
|
28
|
+
sg: "第%頁"
|
29
|
+
pl: "第%頁"
|
30
|
+
volume:
|
31
|
+
sg: "第%卷"
|
32
|
+
pl: "第%卷"
|
33
|
+
issue:
|
34
|
+
sg: "第%期"
|
35
|
+
pl: "第%期"
|
36
|
+
size:
|
37
|
+
page:
|
38
|
+
sg: "%頁"
|
39
|
+
pl: "%頁"
|
40
|
+
volume:
|
41
|
+
sg: "%卷"
|
42
|
+
pl: "%卷"
|
43
|
+
issue:
|
44
|
+
sg: "%期"
|
45
|
+
pl: "%期"
|
@@ -1,14 +1,14 @@
|
|
1
1
|
nametemplate:
|
2
2
|
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase }} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}"
|
3
|
-
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %} {{ labels['
|
4
|
-
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} {{ labels['
|
3
|
+
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %} {{ labels['author_and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %}"
|
4
|
+
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} {{ labels['author_and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{%if given[2]%}{{given[2]}} {{middle[2]}}{%else%}{{initials[2] | join: ' '}}.{%endif%} {{surname[2] | upcase}}{% endif %}"
|
5
5
|
# disabled the following: they should be provided in inheriting calls
|
6
6
|
# etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} <em>et al.</em>"
|
7
7
|
# etal_count: 5
|
8
8
|
authorcitetemplate:
|
9
9
|
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %}"
|
10
|
-
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %} {{ labels['
|
11
|
-
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %} {{ labels['
|
10
|
+
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %} {{ labels['author_and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %}"
|
11
|
+
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %} {{ labels['author_and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2] }}{% endif %}"
|
12
12
|
# disabled the following: they should be provided in inheriting calls
|
13
13
|
# etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1] }}{% endif %} <em>et al.</em>"
|
14
14
|
# etal_count: 5
|
@@ -31,36 +31,36 @@ sizetemplate:
|
|
31
31
|
language: en
|
32
32
|
script: Latn
|
33
33
|
template:
|
34
|
-
book: "{{ creatornames }} ({{role}}) .
|
34
|
+
book: "{{ creatornames }} ({{role}}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. {{size}}. {{extent}}."
|
35
35
|
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, rights metadata, distributor, item attributes, relationships
|
36
36
|
booklet: book
|
37
37
|
manual: book
|
38
38
|
proceedings: book
|
39
|
-
inbook: "{{ creatornames }} ({{role}}) . {{ title }} . {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) :
|
39
|
+
inbook: "{{ creatornames }} ({{role}}) . {{labels['q-open']}}{{ title }}{{labels['q-close']}} . {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) : {{labels['qq-open']}}{{host_title}}{{labels['qq-close']}} [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
40
40
|
inproceedings: inbook
|
41
41
|
incollection: inbook
|
42
42
|
# TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
|
43
|
-
journal: "
|
43
|
+
journal: "{{labels['qq-open']}}{{ title}}{{labels['qq-close']}} [{{medium}}] . {{ edition | capitalize_first }}. {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
44
44
|
# TODO subsidiary titles, rights metadata, item attributes, relationships
|
45
|
-
article: "{{ creatornames }} ({{role}}) . {{ title }}. {{ series }} [{{medium}}] . {{ edition | capitalize_first }}. {{size}}. {{ extent }}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
45
|
+
article: "{{ creatornames }} ({{role}}) . {{labels['q-open']}}{{ title }}{{labels['q-close']}}. {{ series }} [{{medium}}] . {{ edition | capitalize_first }}. {{size}}. {{ extent }}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
46
46
|
# TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, item attributes, relationships; newspapers
|
47
|
-
software: "{{ creatornames }} ({{ role}}) .
|
47
|
+
software: "{{ creatornames }} ({{ role}}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize}}. {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{size}}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
48
48
|
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
|
49
49
|
electronic resource: software
|
50
|
-
standard: "{{ creatornames }} ({{ role}}) . {{ authoritative_identifier | join '|' }}:
|
50
|
+
standard: "{{ creatornames }} ({{ role}}) . {{ authoritative_identifier | join '|' }}: {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['in'] | capitalize }}:_{{ series_title }}. {{ medium | capitalize }}. {{ edition | capitalize_first }}. {{ place }}: {{ publisher }}. {{date}}. {{size}}. {{ extent }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
51
51
|
# TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, persistent identifier, item attributes, relationships
|
52
52
|
techreport: standard
|
53
|
-
dataset: "{{ creatornames }} ({{ role }}) .
|
53
|
+
dataset: "{{ creatornames }} ({{ role }}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ labels['in'] | capitalize }}:_{{series}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
54
54
|
# TODO: omitted: author ids, system requirements, host archive, copyright, license, data source, distributor, usage instructions, relationships, provenance
|
55
|
-
website: "{{ creatornames }} ({{ role }}) .
|
55
|
+
website: "{{ creatornames }} ({{ role }}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{medium | capitalize }}. {{ place }}: {{ publisher }}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
56
56
|
# TODO: omitted: author ids, page title, system requirements, subsidiary creator, rights metadata, distributor, persistent identifier, archive location, archive date and time, relationships
|
57
57
|
webresource: website
|
58
58
|
# TODO: component part
|
59
|
-
unpublished: "{{ creatornames }} ({{ role }}) .
|
59
|
+
unpublished: "{{ creatornames }} ({{ role }}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ medium | capitalize }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
60
60
|
# TODO: omitted: author ids, subsidiary titles, subsidiary creators, host archive, item attributes, relationships
|
61
61
|
presentation: unpublished
|
62
|
-
thesis: "{{ creatornames }} ({{ role }}) .
|
63
|
-
misc: "{{ creatornames }} ({{ role }}) .
|
62
|
+
thesis: "{{ creatornames }} ({{ role }}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ medium | capitalize }}. {{ place }}: {{ publisher }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
63
|
+
misc: "{{ creatornames }} ({{ role }}) . {{labels['qq-open']}}{{ title }}{{labels['qq-close']}} . {{ date }}."
|
64
64
|
# following are # unsupported types:
|
65
65
|
map: misc
|
66
66
|
audiovisual: misc
|
@@ -27,6 +27,22 @@ module Relaton
|
|
27
27
|
[forenames.first, forenames[1..-1], Array(initials)]
|
28
28
|
end
|
29
29
|
|
30
|
+
def forenames_parse(person)
|
31
|
+
person.name.forename.map do |x|
|
32
|
+
x.content.empty? ? "#{x.initial}." : x.content
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# de S. => one initial, M.-J. => one initial
|
37
|
+
def initials_parse(person)
|
38
|
+
i = person.name.initials&.content or
|
39
|
+
return person.name.forename.map(&:initial)
|
40
|
+
.compact.map { |x| x.sub(/(.)\.?$/, "\\1.") }
|
41
|
+
|
42
|
+
i.sub(/(.)\.?$/, "\\1.")
|
43
|
+
.scan(/.+?\.(?=(?:$|\s|\p{Alpha}))/).map(&:strip)
|
44
|
+
end
|
45
|
+
|
30
46
|
def extractname(contributor)
|
31
47
|
org = contributor.entity if contributor.entity
|
32
48
|
.is_a?(RelatonBib::Organization)
|
@@ -113,11 +113,13 @@ module Relaton
|
|
113
113
|
|
114
114
|
def uri(doc)
|
115
115
|
uri = nil
|
116
|
-
%w(citation
|
116
|
+
%w(citation uri src).each do |t|
|
117
117
|
uri = uri_type_select(doc, t) and break
|
118
118
|
end
|
119
|
-
uri ||= doc.link.detect
|
120
|
-
|
119
|
+
uri ||= doc.link.detect do |u|
|
120
|
+
u.language == @lang && !u.type&.casecmp("doi")&.zero?
|
121
|
+
end
|
122
|
+
uri ||= doc.link.detect { |u| !u.type&.casecmp("doi")&.zero? }
|
121
123
|
return nil unless uri
|
122
124
|
|
123
125
|
uri.content.to_s
|
@@ -125,9 +127,9 @@ module Relaton
|
|
125
127
|
|
126
128
|
def uri_type_select(doc, type)
|
127
129
|
uri = doc.link.detect do |u|
|
128
|
-
u.type == type && u.language == @lang
|
130
|
+
u.type&.downcase == type && u.language == @lang
|
129
131
|
end and return uri
|
130
|
-
uri = doc.link.detect { |u| u.type == type } and return uri
|
132
|
+
uri = doc.link.detect { |u| u.type&.downcase == type } and return uri
|
131
133
|
nil
|
132
134
|
end
|
133
135
|
|
@@ -31,7 +31,8 @@ module Relaton
|
|
31
31
|
|
32
32
|
# denote start and end of field,
|
33
33
|
# so that we can detect empty fields in postprocessing
|
34
|
-
FIELD_DELIM = "\u0018".freeze
|
34
|
+
#FIELD_DELIM = "\u0018".freeze
|
35
|
+
FIELD_DELIM = "%%".freeze
|
35
36
|
|
36
37
|
# escape < >
|
37
38
|
LT_DELIM = "\u0019".freeze
|
@@ -40,13 +41,23 @@ module Relaton
|
|
40
41
|
# use tab internally for non-spacing delimiter
|
41
42
|
NON_SPACING_DELIM = "\t".freeze
|
42
43
|
|
44
|
+
def punct_field?(name)
|
45
|
+
name or return false
|
46
|
+
name = name.gsub(/'/, '"')
|
47
|
+
%w(labels["qq-open"] labels["qq-close"] labels["q-open"]
|
48
|
+
labels["q-close"]).include?(name)
|
49
|
+
end
|
50
|
+
|
43
51
|
def template_process(template)
|
44
|
-
t = template.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
52
|
+
t = template.split(/(\{\{|\}\})/).each_slice(4).map do |a|
|
53
|
+
unless !a[2] || punct_field?(a[2]&.strip)
|
54
|
+
a[1] = "#{FIELD_DELIM}{{"
|
55
|
+
a[3] = "}}#{FIELD_DELIM}"
|
56
|
+
end
|
57
|
+
a.join
|
58
|
+
end.join.gsub(/\t/, " ")
|
59
|
+
t1 = t.gsub(/\}\}#{FIELD_DELIM}\|/o, "}}#{FIELD_DELIM}\t")
|
60
|
+
.gsub(/\|#{FIELD_DELIM}\{\{/o, "\t#{FIELD_DELIM}{{")
|
50
61
|
::Liquid::Template.parse(t1)
|
51
62
|
end
|
52
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-render
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- lib/isodoc-yaml/i18n-fr.yaml
|
204
204
|
- lib/isodoc-yaml/i18n-ru.yaml
|
205
205
|
- lib/isodoc-yaml/i18n-zh-Hans.yaml
|
206
|
+
- lib/isodoc-yaml/i18n-zh-Hant.yaml
|
206
207
|
- lib/isodoc/i18n.rb
|
207
208
|
- lib/relaton-render.rb
|
208
209
|
- lib/relaton/render/fields/date.rb
|