relaton-render 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4db19d0a9fb16b91e2e044c547f8ed65287362cf074486c0481d7a718cb7d98
4
- data.tar.gz: 964075dc466461b3388febe72e346db46b28010aa7933ced18f9958f8ee89fd1
3
+ metadata.gz: c8779d553f6f96bee35c94ba359e34485d32f6d6408741921605f47affd3f6ed
4
+ data.tar.gz: 95ac20e5eb03a0a02e95fd25aa9cbef8070c061bcd1b5d64a26dc8973213a81c
5
5
  SHA512:
6
- metadata.gz: 8b463024d200ae37a655cab3812fb4ef20d8b7b7f956c38a262ed4767b431f25c6b648964c09b6c3a37c516da4f6866091a637ba75db2e837fc852953ae64308
7
- data.tar.gz: 4ac009ff61e8d9d21789fe7663b6caac24ce280880e7c97fefb17aa0875a05834538eff7394860d5f84db256cc269341c3873f89a089da6e1fb296aee5b1909c
6
+ metadata.gz: ca75fef0dd5c3f29ce115d470828e564206764ff2f93e4ce710edba7bcd1e0f38b010275d3d873180df7dbe84781d84ec1caed26c1519297635d02af9f78621b
7
+ data.tar.gz: 5ce4b44da59612f956fab4ea2d8d18456989fbd72614e5176e5c7bf1f729f6c567b5f641a4e82f3dfc1caad0c75c1401f5de413d47940d2e32e79d270a0471b7
data/README.adoc CHANGED
@@ -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 field done by using individual
234
- forenames' `initial` attributes, or the forename initials. If the full stops are to be stripped, that needs to occur within the
235
- Liquid template.
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
- if script == "Hans" then load_yaml2("zh-Hans")
12
- else load_yaml2("en")
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['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['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{%if given[2]%}{{given[2]}} {{middle[2]}}{%else%}{{initials[2] | join: ' '}}.{%endif%} {{surname[2] | upcase}}{% 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['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['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['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2] }}{% endif %}"
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}}) . <em>{{ title }}</em> [{{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}}."
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}}) : <em>{{host_title}}</em> [{{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}}]."
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: "<em>{{ title}}</em> [{{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}}]."
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}}) . <em>{{ title }}</em> . {{ 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}}]. "
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 '|' }}: <em>{{ title }}</em> . {{ 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}}]."
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 }}) . <em>{{ title }}</em> . {{ 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}}]. "
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 }}) . <em>{{ title }}</em> . {{ 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}}]. "
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 }}) . <em>{{ title }}</em> . {{ medium | capitalize }}. {{ date }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. {{ authoritative_identifier | join: '. ' }}. {{ other_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
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 }}) . <em>{{ title }}</em> . {{ 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 }}) . <em>{{ title }}</em> . {{ date }}."
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)
@@ -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.gsub(/\{\{/, "#{FIELD_DELIM}{{")
45
- .gsub(/\}\}/, "}}#{FIELD_DELIM}")
46
- .gsub(/\t/, " ")
47
- t1 = t.split(/(\{\{.+?\}\})/).map do |n|
48
- n.include?("{{") ? n : n.gsub(/(?<!\\)\|/, "\t")
49
- end.join
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
 
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.5.3".freeze
3
+ VERSION = "0.5.4".freeze
4
4
  end
5
5
  end
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.3
4
+ version: 0.5.4
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-17 00:00:00.000000000 Z
11
+ date: 2022-11-28 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