relaton-render 0.3.10 → 0.4.2

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: 963f65bd45b2b7d271822ba18c63f2a6e34768da2e77b73dee08f43ae9e68c3d
4
- data.tar.gz: 989731f97b400da01dbf2d549b7319f3b04d4450f087866b1622ba381674c744
3
+ metadata.gz: c21e6af4c8c19084d12c883fcc12ec4828965563d84eefa9ad3776fbd4997bf6
4
+ data.tar.gz: df7f7dbbc98ac5de46e904cc572d9ed131921ec7b6418e3080e5115a69ab0647
5
5
  SHA512:
6
- metadata.gz: d8b0815748c83dd0daf24055a1c4e4f7b2a51f2c7d65632d2e5b8596fd112df4882610626716e9feb5f46ce0054ba66ad28543a55aa3162b867dedff92cd2180
7
- data.tar.gz: 917f533dfe7158d182bbd679c1e921442b0786d59a25db92d8cbd330fb01cb05bf9655e0ff566ac4574ab66b670d29d91b1c1b4796bfebb0e82db0e0ef07c479
6
+ metadata.gz: 2d0a91b6196e46b51e2aa88dd923608b885ecc369e63e56bc16fd90d5458f3300c8017d73f0524ecb32b7d811d391be0da4778649559df8a0f540b85150baf4e
7
+ data.tar.gz: aa14c96d47a1b354c26dd4b99df07c334dd9404f8faf04bd7686d3071b85cc0d0769a81976d8ae83846d5334a4c36fa02a3ef0e5d66f152a80dc6ba66d5b960f
data/README.adoc CHANGED
@@ -13,7 +13,21 @@ a configuration, and generates a https://www.metanorma.org[Metanorma] XML render
13
13
  ----
14
14
  input = "<bibitem type='...'>....</bibitem>"
15
15
 
16
- Relaton::Render::General.new(template: ..., nametemplate: ..., seriestemplate: ..., language: "en", script: "Latn").render(input)
16
+ r = Relaton::Render::General.new(template: ..., nametemplate: ..., seriestemplate: ..., language: "en", script: "Latn")
17
+
18
+ r.render(input) == "Author1 and Author2 2000. Title &c."
19
+
20
+ bibliography = "<references><bibitem id=''>...</bibitem>...<bibitem id=''>...</bibitem></references>"
21
+
22
+ r.render_all(bibliography, type: "author-cite") ==
23
+
24
+ { bibitem["id"] :
25
+ { author: "Author1 and Author2",
26
+ date: "2000a",
27
+ citation: "Author1 and Author2 2000a",
28
+ formattedref: "Author1 and Author2 2000a. Title &c."
29
+ }
30
+ }
17
31
  ----
18
32
 
19
33
  The gem processes either Relaton XML, or native Relaton classes.
@@ -31,6 +45,7 @@ The parameters are:
31
45
  `script`:: in ISO-15124
32
46
  `template`:: templates for rendering different bibliographic types
33
47
  `nametemplate`:: templates for rendering personal names
48
+ `authorcitetemplate`:: templates for rendering names for the purpose of author-date citations
34
49
  `seriestemplate`:: template for rendering series
35
50
  `journaltemplate`:: template for rendering journals in article citations
36
51
  `extenttemplate`:: templates for rendering extents
@@ -39,6 +54,42 @@ The parameters are:
39
54
  `date`:: default date format (from Twitter CLDR)
40
55
  `i18nhash`:: Metanorma internationalisation hash
41
56
 
57
+ == Functionality
58
+
59
+ === Rendering single reference
60
+
61
+ Given an Relaton bibitem object (or equivalent Relaton XML), `render(input)` will output a formatted reference for that
62
+ bibitem, following the rules laid out in the configuration. That output can be inserted into the `<formattedref>` element
63
+ of the bibitem by the calling code, and used as the authoritative rendering of the citation.
64
+
65
+ This method does not address how the bibliographic item is to be cited, and does not differentiate citations with the same
66
+ author and date. It should not be used for rendering of references aligned to the author-date citation system.
67
+
68
+ === Rendering multiple references
69
+
70
+ Given a collection of Relaton bibitem objects (or equivalent Relaton XML, wrapped in `<references>`),
71
+ `render_all(bibliography, type: type)`
72
+ will output a hash of objects, with information to be used both for rendering references, and for generating citations.
73
+ This method addresses the disambiguation of citiations, and changes to rendering of references reflecting that disambiguation.
74
+ For that reason, this method should be used for references using the author-date citation system.
75
+
76
+ The `type` argument of `render_all` reflects the citation system to be used.
77
+
78
+ * If it is set to "author-date", citations with the same author and date will be disambiguated from each other
79
+ by appending a letter to the date, in the order in which they occur in `bibliography`. (That means that any fixed sorting
80
+ of references needs to be applied before the bibliography is presented to the method.)
81
+ * If it is set to nil (as is the default), no such disambiguation occurs.
82
+
83
+ The hash maps from the anchor of each bibitem (`bibitem/@id`), to an object containing the following fields:
84
+
85
+ `formattedref`:: the formatted reference, as output by `render(input)`, but with the date of the citation disambiguated
86
+ if called with `type: "author-date"`.
87
+ `citation`:: the citation for the reference (Author-Date if called with `type: "author-date"`; `docidentifier` if called with `type: nil`).
88
+ `author`:: the author designation for the reference (if called with `type: "author-date"`)
89
+ `date`:: the date designation for the reference, with disambiguating letter if necessary (if called with `type: "author-date"`).
90
+ The author and date are differentiated so that consumers can separate them in citations -- e.g. "Jones (1996) claims",
91
+ "(Jones 1996, 1997)".
92
+
42
93
  == Configuration
43
94
 
44
95
  === Templates
@@ -110,6 +161,7 @@ drawn from the bibliographic item:
110
161
  | access_location | ./accessLocation | | Y |
111
162
  | extent | ./extent | Y | | Render with standard abbreviations for pp, vols, with n-dash, with delimiting of multiple locations
112
163
  | creatornames | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'publisher'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<nametemplate,`nametemplate`>> applied to each name; joining template from internationalisation applied to multiple names
164
+ | authorcite | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'publisher'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<authorcitetemplate,`authorcitetemplate`>> applied to each name; joining template from internationalisation applied to multiple names
113
165
  | role | ./contributor[role/description] \| ./contributor[role/@type] | | |
114
166
  | date | ./date[@type = 'issued'] \| ./date[@type = 'circulated'] \| ./date | | Y |
115
167
  | date_updated | ./date[@type = 'updated'] | | Y |
@@ -122,6 +174,8 @@ drawn from the bibliographic item:
122
174
  | labels | | | text to be looked up in internationalisation configuration files: "edition", "In", "At", "Vol", "Vols", "p.", "pp"
123
175
  |===
124
176
 
177
+ Missing dates and places of publication are rendered as "n.d." and "n.p." or the equivalent internationalisation (`no_date`, `no_place` in the internationalisation YAML files.) However, missing dates are left as nil in standards, as undated standards indicate that the citation applies to the latest version of the standard, and not that the date is unknown.
178
+
125
179
  Many fields are populated either by the description of the bibliographic item itself, or by the description of the item containing it (the _host_ item: `./relation[@type = 'includedIn']/bibitem`). For example, in a paper included in an edited volume, the edition will typically be given for the editor volume, rather than for the paper. Those fields are indicated by "Can come from host" in the table.
126
180
 
127
181
  The Liquid templates use the filters defined in Liquid, such as `upcase`. We have defined some custom filters:
@@ -189,6 +243,12 @@ For example:
189
243
 
190
244
  In the case of `more`, the `(name)[1]` entries are repeated for all additional authors above 2 and before the final author.
191
245
 
246
+ [[authorcitetemplate]]
247
+ === Author citation templates
248
+
249
+ The `authorcitetemplate` is a subclass of the name template, configured for rendering author names for author-date citations.
250
+ That means that it typically selects only surnames for rendering.
251
+
192
252
  [[seriestemplate]]
193
253
  === Series template
194
254
 
@@ -4,6 +4,8 @@ and: و
4
4
  updated: محدث
5
5
  viewed: ينظر
6
6
  version: الإصدار
7
+ no_date: بدون تاريخ
8
+ no_place: بدون مدينة
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -4,6 +4,8 @@ and: und
4
4
  updated: aktualisiert
5
5
  viewed: angesehen
6
6
  version: Version
7
+ no_date: o.J.
8
+ no_place: o.O.
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -4,6 +4,8 @@ and: and
4
4
  updated: updated
5
5
  viewed: viewed
6
6
  version: version
7
+ no_date: n.d.
8
+ no_place: n.p.
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -4,6 +4,8 @@ and: y
4
4
  updated: actualizado
5
5
  viewed: visto
6
6
  version: versión
7
+ no_date: s.f.
8
+ no_place: s.l.
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -4,6 +4,8 @@ and: et
4
4
  updated: mise à jour
5
5
  viewed: vu
6
6
  version: version
7
+ no_date: s.d.
8
+ no_place: s.l.
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -4,6 +4,8 @@ and: и
4
4
  updated: обновлен
5
5
  viewed: просмотрено
6
6
  version: версия
7
+ no_date: б.г.
8
+ no_place: б.м.
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -4,6 +4,8 @@ and: 和
4
4
  updated: 更新
5
5
  viewed: 看过
6
6
  version: 版本
7
+ no_date: 无日期
8
+ no_place: 无出版地
7
9
  date_formats:
8
10
  month_year: yMMMM
9
11
  day_month_year: to_long_s
@@ -16,15 +16,19 @@ module Relaton
16
16
  end
17
17
 
18
18
  def name_fields_format(hash)
19
- hash[:place] = nameformat(hash[:place_raw]&.map do |x|
20
- { nonpersonal: x }
21
- end)
22
19
  [%i(creatornames creators), %i(host_creatornames host_creators),
23
20
  %i(publisher publisher_raw), %i(distributor distributor_raw)]
24
21
  .each do |k|
25
22
  hash[k[0]] = nameformat(hash[k[1]])
26
23
  end
27
24
  hash[:publisher_abbrev] = hash[:publisher_abbrev_raw]&.join(", ")
25
+ hash[:authorcite] = authorciteformat(hash[:creators])
26
+ place_format(hash)
27
+ end
28
+
29
+ def place_format(hash)
30
+ hash[:place] =
31
+ nameformat(hash[:place_raw].map { |x| { nonpersonal: x } })
28
32
  end
29
33
 
30
34
  def role_fields_format(hash)
@@ -51,6 +55,8 @@ module Relaton
51
55
  [%i(date date), %i(date_updated date_updated),
52
56
  %i(date_accessed date_accessed)].each do |k|
53
57
  hash[k[0]] = dateformat(hash[k[1]], hash)
58
+ k[0] == :date && hash[:type] != "standard" and
59
+ hash[k[0]] ||= @r.i18n.get["no_date"]
54
60
  end
55
61
  end
56
62
 
@@ -87,6 +93,19 @@ module Relaton
87
93
  @r.nametemplate.render(names_out)
88
94
  end
89
95
 
96
+ def authorciteformat(names)
97
+ return names if names.nil? || @r.authorcitetemplate.nil?
98
+
99
+ parts = %i(surname initials given middle nonpersonal)
100
+ names_out = names.each_with_object({}) do |n, m|
101
+ parts.each do |i|
102
+ m[i] ||= []
103
+ m[i] << n[i]
104
+ end
105
+ end
106
+ @r.authorcitetemplate.render(names_out)
107
+ end
108
+
90
109
  def role_inflect(contribs, role)
91
110
  return nil if role.nil? || contribs.size.zero? ||
92
111
  %w(author publisher).include?(role)
@@ -0,0 +1,96 @@
1
+ module Relaton
2
+ module Render
3
+ class Citations
4
+ def initialize(opt = {})
5
+ @type = opt[:type]
6
+ @i18n = opt[:i18n]
7
+ @renderer = opt[:renderer]
8
+ end
9
+
10
+ # takes array of { id, type, author, date, ord, data_liquid }
11
+ def render(ret)
12
+ cites = citations(ret)
13
+ cites.each_key do |k|
14
+ cites[k] = render1(cites[k])
15
+ end
16
+ cites
17
+ end
18
+
19
+ def render1(cit)
20
+ r = @renderer.renderer(cit[:type] || "misc")
21
+ cit[:formattedref] =
22
+ @renderer.valid_parse(@i18n.l10n(r.render(cit[:data_liquid])))
23
+ %i(type data_liquid).each { |x| cit.delete(x) }
24
+ cit
25
+ end
26
+
27
+ def citations(ret)
28
+ case @type
29
+ when "author-date" then disambig_author_date_citations(ret)
30
+ when nil then generic_citation(ret)
31
+ else raise "Unimplemented citation type"
32
+ end
33
+ end
34
+
35
+ def generic_citation(ret)
36
+ ret.each_with_object({}) do |b, m|
37
+ m[b[:id]] = { data_liquid: b[:data_liquid], type: b[:type],
38
+ citation: b[:data_liquid][:docidentifier] }
39
+ end
40
+ end
41
+
42
+ # takes array of { id, type, author, date, ord, data_liquid }
43
+ def disambig_author_date_citations(ret)
44
+ to_hash(suffix_date(sort_ord(breakdown(ret))))
45
+ end
46
+
47
+ def breakdown(ret)
48
+ ret.each_with_object({}) do |b, m|
49
+ m[b[:author]] ||= {}
50
+ m[b[:author]][b[:date]] ||= []
51
+ m[b[:author]][b[:date]] << b
52
+ end
53
+ end
54
+
55
+ def sort_ord(ret)
56
+ ret.each do |author, v|
57
+ v.each_key do |date|
58
+ ret[author][date].sort! { |a, b| a[:ord] <=> b[:ord] }
59
+ end
60
+ end
61
+ end
62
+
63
+ def suffix_date(ret)
64
+ ret.each do |k, v|
65
+ v.each do |k1, v1|
66
+ next if v1.reject { |b| b[:date].nil? }.size < 2
67
+
68
+ suffix_date1(ret, k, k1)
69
+ end
70
+ end
71
+ ret
72
+ end
73
+
74
+ def suffix_date1(ret, key1, key2)
75
+ ret[key1][key2].each_with_index do |b, i|
76
+ next if b[:date].nil?
77
+
78
+ b[:date] += ("a".ord + i).chr.to_s
79
+ b[:data_liquid][:date] = b[:date]
80
+ end
81
+ end
82
+
83
+ def to_hash(ret)
84
+ ret.each_with_object({}) do |(_k, v), m|
85
+ v.each do |_k1, v1|
86
+ v1.each do |b|
87
+ m[b[:id]] = { author: b[:author], date: b[:date],
88
+ citation: "#{b[:author]} #{b[:date]}",
89
+ data_liquid: b[:data_liquid], type: b[:type] }
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -5,6 +5,13 @@ nametemplate:
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
+ authorcitetemplate:
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 %}"
12
+ # disabled the following: they should be provided in inheriting calls
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
+ # etal_count: 5
8
15
  seriestemplate: "{% if series_formatted %}{{ series_formatted }}{%else%}{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %} ({{series_run}}) {{series_num}}|({{series_partnumber}}){%endif%}"
9
16
  journaltemplate: "<em>{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %}</em> ({{series_run}}) {{ labels['volume'] }}_{{series_num}} {{ labels['part'] }}_{{series_partnumber}}"
10
17
  extenttemplate:
@@ -24,12 +31,12 @@ sizetemplate:
24
31
  language: en
25
32
  script: Latn
26
33
  template:
27
- book: "{{ creatornames }} ({{role}}) . <em>{{ title }}</em> [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {{place}}: {{publisher}}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. {{size}}. {{extent}}."
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}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. {{size}}. {{extent}}."
28
35
  # TODO: omitted: author ids, subsidiary titles, subsidiary creators, rights metadata, distributor, item attributes, relationships
29
36
  booklet: book
30
37
  manual: book
31
38
  proceedings: book
32
- inbook: "{{ creatornames }} ({{role}}) . {{ title }} . {{ labels['in'] | capitalize }}: {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em> [{{medium}}] . {{ edition | capitalize_first }}. ({{ series }}.) {{place}}: {{publisher}}. {{date}}. {{size}}. {{extent}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
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}}. {{ standardidentifier | first }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
33
40
  inproceedings: inbook
34
41
  incollection: inbook
35
42
  # TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
@@ -1,4 +1,5 @@
1
1
  require_relative "render_classes"
2
+ require_relative "citations"
2
3
  require "yaml"
3
4
  require "liquid"
4
5
  require "relaton_bib"
@@ -9,7 +10,8 @@ module Relaton
9
10
  module Render
10
11
  class General
11
12
  attr_reader :template, :journaltemplate, :seriestemplate, :nametemplate,
12
- :extenttemplate, :sizetemplate, :lang, :script, :i18n,
13
+ :authorcitetemplate, :extenttemplate, :sizetemplate,
14
+ :lang, :script, :i18n,
13
15
  :edition, :edition_ordinal, :date
14
16
 
15
17
  def initialize(opt = {})
@@ -27,6 +29,7 @@ module Relaton
27
29
 
28
30
  def klass_initialize(_options)
29
31
  @nametemplateklass = Relaton::Render::Template::Name
32
+ @authorcitetemplateklass = Relaton::Render::Template::AuthorCite
30
33
  @seriestemplateklass = Relaton::Render::Template::Series
31
34
  @extenttemplateklass = Relaton::Render::Template::Extent
32
35
  @sizetemplateklass = Relaton::Render::Template::Size
@@ -40,6 +43,8 @@ module Relaton
40
43
  @parse = @parseklass.new(lang: @lang, script: @script)
41
44
  @nametemplate = @nametemplateklass
42
45
  .new(template: opt["nametemplate"], i18n: @i18n)
46
+ @authorcitetemplate = @authorcitetemplateklass
47
+ &.new(template: opt["authorcitetemplate"], i18n: @i18n)
43
48
  @seriestemplate = @seriestemplateklass
44
49
  .new(template: opt["seriestemplate"], i18n: @i18n)
45
50
  @journaltemplate = @seriestemplateklass
@@ -128,7 +133,42 @@ module Relaton
128
133
  data = @parse.extract(doc)
129
134
  data_liquid = @fieldsklass.new(renderer: self)
130
135
  .compound_fields_format(data)
131
- @i18n.l10n(r.render(data_liquid))
136
+ valid_parse(@i18n.l10n(r.render(data_liquid)))
137
+ end
138
+
139
+ def valid_parse(ret)
140
+ @i18n.get["no_date"] == ret and return nil
141
+ ret
142
+ end
143
+
144
+ # expect array of Relaton objects, in sorted order
145
+ def render_all(bib, type: "author-date")
146
+ bib = sanitise_citations_input(bib) or return
147
+ Citations.new(type: type, renderer: self, i18n: @i18n)
148
+ .render(citations1(bib))
149
+ end
150
+
151
+ def sanitise_citations_input(bib)
152
+ bib.is_a?(Array) and return bib
153
+ bib.is_a?(String) and return sanitise_citations_input_string(bib)
154
+ end
155
+
156
+ def sanitise_citations_input_string(bib)
157
+ p = Nokogiri::XML(bib) or return
158
+ (p.errors.empty? && p.root.at("./bibitem")) or return nil
159
+
160
+ p.root.xpath("./bibitem").each_with_object([]) do |b, m|
161
+ m << RelatonBib::XMLParser.from_xml(b.to_xml)
162
+ end
163
+ end
164
+
165
+ def citations1(bib)
166
+ bib.each_with_object([]).with_index do |(b, m), i|
167
+ data_liquid = @fieldsklass.new(renderer: self)
168
+ .compound_fields_format(@parse.extract(b))
169
+ m << { author: data_liquid[:authorcite], date: data_liquid[:date],
170
+ ord: i, id: b.id, data_liquid: data_liquid, type: b.type }
171
+ end
132
172
  end
133
173
 
134
174
  private
@@ -180,6 +180,9 @@ module Relaton
180
180
  [acc, curr, prec]
181
181
  end
182
182
  end
183
+
184
+ class AuthorCite < Name
185
+ end
183
186
  end
184
187
  end
185
188
  end
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.3.10".freeze
3
+ VERSION = "0.4.2".freeze
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "isodoc-i18n"
32
32
  spec.add_dependency "liquid", "~> 4"
33
33
  spec.add_dependency "nokogiri"
34
- spec.add_dependency "relaton-bib", ">= 1.11.0"
34
+ spec.add_dependency "relaton-bib", ">= 1.12.0"
35
35
  spec.add_dependency "twitter_cldr"
36
36
  spec.add_dependency "tzinfo-data" # we need this for windows only
37
37
  #spec.metadata["rubygems_mfa_required"] = "true"
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.3.10
4
+ version: 0.4.2
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-07-04 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 1.11.0
145
+ version: 1.12.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 1.11.0
152
+ version: 1.12.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: twitter_cldr
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,7 @@ files:
206
206
  - lib/relaton-render.rb
207
207
  - lib/relaton/render/fields/date.rb
208
208
  - lib/relaton/render/fields/fields.rb
209
+ - lib/relaton/render/general/citations.rb
209
210
  - lib/relaton/render/general/config.yml
210
211
  - lib/relaton/render/general/render.rb
211
212
  - lib/relaton/render/general/render_classes.rb