relaton-render 1.4.0.pre.alpha.4 → 3.0.0.pre.alpha.2
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/lib/relaton/render/fields/date.rb +48 -0
- data/lib/relaton/render/fields/fields.rb +266 -0
- data/lib/relaton/render/general.rb +12 -0
- data/lib/relaton/render/legacy/citations.rb +178 -0
- data/lib/relaton/render/parse/parse.rb +152 -0
- data/lib/relaton/render/parse/parse_contributors.rb +184 -0
- data/lib/relaton/render/parse/parse_extract.rb +200 -0
- data/lib/relaton/render/parse/parse_id.rb +128 -0
- data/lib/relaton/render/template/hash_utils.rb +64 -0
- data/lib/relaton/render/template/liquid.rb +48 -0
- data/lib/relaton/render/template/subclasses.rb +123 -0
- data/lib/relaton/render/template/template.rb +230 -0
- data/lib/relaton/render/version.rb +1 -1
- data/lib/relaton-render.rb +14 -0
- data/relaton-render.gemspec +5 -0
- metadata +83 -12
- data/lib/isodoc/i18n.rb +0 -34
- data/lib/isodoc-yaml/i18n-ar.yaml +0 -62
- data/lib/isodoc-yaml/i18n-de.yaml +0 -61
- data/lib/isodoc-yaml/i18n-en.yaml +0 -57
- data/lib/isodoc-yaml/i18n-es.yaml +0 -65
- data/lib/isodoc-yaml/i18n-fr.yaml +0 -66
- data/lib/isodoc-yaml/i18n-ja.yaml +0 -58
- data/lib/isodoc-yaml/i18n-ru.yaml +0 -69
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +0 -59
- data/lib/isodoc-yaml/i18n-zh-Hant.yaml +0 -58
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Render
|
|
3
|
+
module Template
|
|
4
|
+
class Series < General
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class Extent < General
|
|
8
|
+
def template_select(hash)
|
|
9
|
+
@template[hash[:type].to_sym]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Size < General
|
|
14
|
+
def template_select(hash)
|
|
15
|
+
@template[hash[:type].to_sym]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Name < General
|
|
20
|
+
def initialize(opt = {})
|
|
21
|
+
@etal_count = opt[:template]["etal_count"]
|
|
22
|
+
@etal_display = opt[:template]["etal_display"] || @etal_count
|
|
23
|
+
opt[:template].delete("etal_count")
|
|
24
|
+
opt[:template].delete("etal_display")
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def template_select(names)
|
|
29
|
+
return nil if names.nil? || names.empty?
|
|
30
|
+
|
|
31
|
+
case names[:surname].size
|
|
32
|
+
when 1 then @template[:one]
|
|
33
|
+
when 2 then @template[:two]
|
|
34
|
+
when 3 then @template[:more]
|
|
35
|
+
else template_select_etal(names)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def template_select_etal(names)
|
|
40
|
+
if @etal_count && names[:surname].size > @etal_count
|
|
41
|
+
expand_nametemplate(@template_raw[:etal], @etal_display)
|
|
42
|
+
else
|
|
43
|
+
expand_nametemplate(@template_raw[:more], names[:surname].size)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# assumes that template contains, consecutively and not interleaved,
|
|
48
|
+
# ...[0], ...[1], ...[2]
|
|
49
|
+
def expand_nametemplate(template, size)
|
|
50
|
+
t = nametemplate_split(template)
|
|
51
|
+
mid = (1..size - 2).each_with_object([]) do |i, m|
|
|
52
|
+
m << t[1].gsub("[1]", "[#{i}]")
|
|
53
|
+
end
|
|
54
|
+
t[1] = mid.join
|
|
55
|
+
t[2].gsub!(/\[\d+\]/, "[#{size - 1}]")
|
|
56
|
+
template_process(combine_nametemplate(t, size))
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def combine_nametemplate(parts, size)
|
|
60
|
+
case size
|
|
61
|
+
when 1 then parts[0] + parts[3]
|
|
62
|
+
when 2 then parts[0] + parts[2] + parts[3]
|
|
63
|
+
else parts.join
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def nametemplate_split(template)
|
|
68
|
+
curr = 0
|
|
69
|
+
prec = ""
|
|
70
|
+
@in_name = 0
|
|
71
|
+
t = template.split(/(\{[{%][^{]+?[}%]\})/)
|
|
72
|
+
.each_with_object([""]) do |n, m|
|
|
73
|
+
m, curr, prec = nametemplate_split1(n, m, curr, prec)
|
|
74
|
+
|
|
75
|
+
m
|
|
76
|
+
end
|
|
77
|
+
[t[0], t[1], t[-1], prec]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def nametemplate_split1(elem, acc, curr, prec)
|
|
81
|
+
if match = /\{[{%].+?\[(\d)\]/.match(elem)
|
|
82
|
+
# we are in a name component
|
|
83
|
+
# if an if is started, track the if nesting...
|
|
84
|
+
@in_name += 1 if /\{%\s*if/.match?(elem)
|
|
85
|
+
if match[1].to_i > curr
|
|
86
|
+
curr += 1
|
|
87
|
+
acc[curr] ||= ""
|
|
88
|
+
end
|
|
89
|
+
acc[curr] += prec
|
|
90
|
+
prec = ""
|
|
91
|
+
acc[curr] += elem
|
|
92
|
+
elsif /\{%\s*endif/.match?(elem) && @in_name.positive?
|
|
93
|
+
# stick the endif to the currently if-nested name component,
|
|
94
|
+
# if we are in one (@in_name.positive?)
|
|
95
|
+
@in_name -= 1
|
|
96
|
+
acc[curr] += prec
|
|
97
|
+
prec = ""
|
|
98
|
+
acc[curr] += elem
|
|
99
|
+
else prec += elem
|
|
100
|
+
end
|
|
101
|
+
[acc, curr, prec]
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class AuthorCite < Name
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
class Cite < General
|
|
109
|
+
def template_select(hash)
|
|
110
|
+
if hash[:citestyle].to_sym == :short
|
|
111
|
+
@template[hash[:type].to_sym]
|
|
112
|
+
else
|
|
113
|
+
@template[hash[:citestyle].to_sym]
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def citation_styles
|
|
118
|
+
@template.keys
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# require_relative "../utils/utils"
|
|
2
|
+
require "liquid"
|
|
3
|
+
require_relative "liquid"
|
|
4
|
+
require_relative "hash_utils"
|
|
5
|
+
require "singleton"
|
|
6
|
+
require "htmlentities"
|
|
7
|
+
|
|
8
|
+
module Relaton
|
|
9
|
+
module Render
|
|
10
|
+
module Template
|
|
11
|
+
class CacheManager
|
|
12
|
+
include Singleton
|
|
13
|
+
|
|
14
|
+
attr_accessor :mutex
|
|
15
|
+
|
|
16
|
+
Hash.include ::Relaton::Render::Legacy::HashCompat
|
|
17
|
+
Array.include ::Relaton::Render::Legacy::ArrayCompat
|
|
18
|
+
|
|
19
|
+
def initialize
|
|
20
|
+
@cache = {}
|
|
21
|
+
@mutex = Mutex.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def store(key, value)
|
|
25
|
+
@cache[key] = value
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def retrieve(key)
|
|
29
|
+
@cache[key]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def clear
|
|
33
|
+
@cache.clear
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class General
|
|
38
|
+
attr_reader :template_raw
|
|
39
|
+
|
|
40
|
+
def initialize(opt = {})
|
|
41
|
+
@htmlentities = HTMLEntities.new
|
|
42
|
+
@templatecache = CacheManager.instance
|
|
43
|
+
@liquid_env = create_liquid_environment
|
|
44
|
+
parse_options(opt)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def parse_options(opt)
|
|
48
|
+
# opt = Utils::sym_keys(opt)
|
|
49
|
+
opt = opt.symbolize_all_keys
|
|
50
|
+
@i18n = opt[:i18n]
|
|
51
|
+
@template_raw = opt[:template].dup
|
|
52
|
+
@template =
|
|
53
|
+
case opt[:template]
|
|
54
|
+
when Hash
|
|
55
|
+
opt[:template].transform_values { |x| template_process(x) }
|
|
56
|
+
when Array then opt[:template].map { |x| template_process(x) }
|
|
57
|
+
else { default: template_process(opt[:template]) }
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def create_liquid_environment
|
|
62
|
+
env = ::Liquid::Environment.new
|
|
63
|
+
env.register_filter(::Relaton::Render::Template::CustomFilters)
|
|
64
|
+
env
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# denote start and end of variable,
|
|
68
|
+
# so that we can detect empty variables in postprocessing
|
|
69
|
+
VARIABLE_DELIM = "%%".freeze
|
|
70
|
+
|
|
71
|
+
# denote citation components which get delimited by period conventionally
|
|
72
|
+
COMPONENT_DELIM = Regexp.quote("$$$").freeze
|
|
73
|
+
|
|
74
|
+
# escape < >
|
|
75
|
+
LT_DELIM = "\u0019".freeze
|
|
76
|
+
GT_DELIM = "\u001a".freeze
|
|
77
|
+
|
|
78
|
+
# use tab internally for non-spacing delimiter
|
|
79
|
+
NON_SPACING_DELIM = "\t".freeze
|
|
80
|
+
|
|
81
|
+
def punct_field?(name)
|
|
82
|
+
name or return false
|
|
83
|
+
name = name.tr("'", '"')
|
|
84
|
+
%w(labels["punct"]["open-title"] labels["punct"]["close-title"]
|
|
85
|
+
labels["punct"]["open-secondary-title"]
|
|
86
|
+
labels["punct"]["close-secondary-title"]).include?(name)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def template_process(template)
|
|
90
|
+
template.is_a?(String) or return template
|
|
91
|
+
t = nil
|
|
92
|
+
@templatecache.mutex.synchronize do
|
|
93
|
+
unless t = @templatecache.retrieve(template)
|
|
94
|
+
t = ::Liquid::Template
|
|
95
|
+
.parse(add_field_delim_to_template(template), environment: @liquid_env)
|
|
96
|
+
@templatecache.store(template, t)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
t
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def add_field_delim_to_template(template)
|
|
103
|
+
t = template.split(/(\{\{|\}\})/).each_slice(4).map do |a|
|
|
104
|
+
unless !a[2] || punct_field?(a[2]&.strip)
|
|
105
|
+
a[1] = "#{VARIABLE_DELIM}{{"
|
|
106
|
+
a[3] = "}}#{VARIABLE_DELIM}"
|
|
107
|
+
end
|
|
108
|
+
a.join
|
|
109
|
+
end.join.tr("\t", " ")
|
|
110
|
+
t.gsub(/\}\}#{VARIABLE_DELIM}\|/o, "}}#{VARIABLE_DELIM}#{NON_SPACING_DELIM}")
|
|
111
|
+
.gsub(/\|#{VARIABLE_DELIM}\{\{/o, "#{NON_SPACING_DELIM}#{VARIABLE_DELIM}{{")
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# hash is what to render, which can be entire bib entry,
|
|
115
|
+
# or a subset of it like names
|
|
116
|
+
# context is information for selecting i18n, which is entire bib entry,
|
|
117
|
+
# potentially enhanced
|
|
118
|
+
def render(hash, context)
|
|
119
|
+
t = template_select(hash) or return nil # TODO select on context?
|
|
120
|
+
i = @i18n.select(context)
|
|
121
|
+
i18nsettings = { "labels" => i.get, "lang" => i.lang,
|
|
122
|
+
"script" => i.script, "locale" => i.locale }
|
|
123
|
+
ret = template_clean(t.render(liquid_hash(hash.merge(i18nsettings))))
|
|
124
|
+
bib_delim = i.get.dig("punct", "biblio-field-delimiter") || ". "
|
|
125
|
+
template_components(ret, bib_delim, context)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def template_select(_hash)
|
|
129
|
+
@template[:default]
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def template_clean(str)
|
|
133
|
+
str = str.gsub(/</i, LT_DELIM).gsub(/>/i, GT_DELIM)
|
|
134
|
+
str = template_clean1(@htmlentities.decode(str))
|
|
135
|
+
/[[:alnum:]]/.match?(str) or return nil
|
|
136
|
+
str.strip.gsub(/#{LT_DELIM}/o, "<")
|
|
137
|
+
.gsub(/#{GT_DELIM}/o, ">")
|
|
138
|
+
.gsub(/&(?!#\S+?;)/, "&")
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def template_clean1(str)
|
|
142
|
+
str = strip_empty_variables(str)
|
|
143
|
+
str.gsub(/([,:;]\s*)+<\/esc>([,:;])(\s|_|$)/, "\\2</esc>\\3")
|
|
144
|
+
.gsub(/([,:;]\s*)+([,:;](\s|_|$))/, "\\2")
|
|
145
|
+
.gsub(/([,.:;]\s*)+<\/esc>([.])(\s|_|$)/, "\\2</esc>\\3") # move outside
|
|
146
|
+
.gsub(/([,.:;]\s*)+([.](\s|_|$))/, "\\2") # move outside
|
|
147
|
+
.gsub(/([,:;]\s*)+<\/esc>(,)(\s|_|$)/, "\\2</esc>\\3")
|
|
148
|
+
.gsub(/([,:;]\s*)+(,(\s|_|$))/, "\\2")
|
|
149
|
+
.gsub(/([,:;]\s*)+(#{COMPONENT_DELIM})/o, "\\2")
|
|
150
|
+
.gsub(/(:\s+)(&\s)/, "\\2")
|
|
151
|
+
.gsub(/\s+([,.:;)])/, "\\1") # trim around $$$
|
|
152
|
+
.sub(/^\s*[,.:;]\s*/, "") # no init $$$
|
|
153
|
+
.sub(/[,:;]\s*$/, "")
|
|
154
|
+
.gsub(/(?<!\\)_/, " ")
|
|
155
|
+
.gsub("\\_", "_")
|
|
156
|
+
.gsub(/(?<!#{COMPONENT_DELIM})#{NON_SPACING_DELIM}(?!#{COMPONENT_DELIM})/o, "") # preserve NON_SPACING_DELIM near $$$
|
|
157
|
+
.gsub(/[\n\r ]+/, " ")
|
|
158
|
+
.gsub(/<(\/)?esc>/i, "<\\1esc>")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# get rid of all empty variables, and any text around them,
|
|
162
|
+
# including component delimiters:
|
|
163
|
+
# [{{}}]$$$ => ""
|
|
164
|
+
# [{{}}] $$$ => " $$$"
|
|
165
|
+
def strip_empty_variables(str)
|
|
166
|
+
str.gsub(/\S*#{VARIABLE_DELIM}#{VARIABLE_DELIM}\S*/o, "")
|
|
167
|
+
.gsub(/#{VARIABLE_DELIM}/o, "")
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# delim = punct.biblio-field-terminator must not be i18n'ised:
|
|
171
|
+
# .</esc>. deletes first .
|
|
172
|
+
# .</esc>。does not delete first .
|
|
173
|
+
# So we do not want to pass delim in as .,
|
|
174
|
+
# and then have it i18n to 。after we are done parsing
|
|
175
|
+
#
|
|
176
|
+
# Do not strip any delimiters from final field in string
|
|
177
|
+
#
|
|
178
|
+
# if delim = ". " , then: ({{ series }}$$$|) => (series1.)
|
|
179
|
+
def template_components(str, delim, context)
|
|
180
|
+
str or return str
|
|
181
|
+
delimrstrip, delimre, delimrstripre = template_components_prep(delim)
|
|
182
|
+
ret = template_components_split(str, delimre)
|
|
183
|
+
delim != delimrstrip and # "." in field followed by ". " in delim
|
|
184
|
+
ret = remove_double_period(ret, delimrstripre)
|
|
185
|
+
context[:citestyle] == "short" and
|
|
186
|
+
ret[0] += "<span class='fmt-first-biblio-delim'/>"
|
|
187
|
+
ret.join(delim).gsub(/#{delim}\|/, delimrstrip)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def template_components_split(str, delimre)
|
|
191
|
+
ret = str.gsub(NON_SPACING_DELIM, "|").split(/#{COMPONENT_DELIM}/o)
|
|
192
|
+
.map(&:strip).reject(&:empty?)
|
|
193
|
+
ret[0...-1].map do |s|
|
|
194
|
+
s.sub(/#{delimre}$/, "").sub(%r[#{delimre}(</[^>]+>)$], "\\1")
|
|
195
|
+
end + [ret.last]
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def remove_double_period(ret, delimrstripre)
|
|
199
|
+
ret[0...-1].map do |s|
|
|
200
|
+
s.sub(/#{delimrstripre}$/, "")
|
|
201
|
+
.sub(%r[#{delimrstripre}(</[^>]+>)$], "\\1")
|
|
202
|
+
end + [ret.last]
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def template_components_prep(delim)
|
|
206
|
+
[delim.rstrip, Regexp.quote(delim),
|
|
207
|
+
# if delim is esc'd, ignore the escs in the preceding span
|
|
208
|
+
Regexp.quote(delim.rstrip.gsub(%r{</?esc>}, ""))]
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# need non-breaking spaces in fields: "Updated:_nil" ---
|
|
212
|
+
# we want the "Updated:" deleted,
|
|
213
|
+
# even if it's multiple words, as in French Mise_à_jour.
|
|
214
|
+
def liquid_hash(hash)
|
|
215
|
+
case hash
|
|
216
|
+
when Hash
|
|
217
|
+
hash.map { |k, v| [k.to_s, liquid_hash(v)] }.to_h
|
|
218
|
+
when Array
|
|
219
|
+
hash.map { |v| liquid_hash(v) }
|
|
220
|
+
when String
|
|
221
|
+
hash.empty? ? nil : hash.gsub("_", "\\_").tr(" ", "_")
|
|
222
|
+
else hash
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
require_relative "subclasses"
|
data/lib/relaton-render.rb
CHANGED
|
@@ -2,3 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
require "relaton/render/version"
|
|
4
4
|
require "relaton/render/iso690"
|
|
5
|
+
|
|
6
|
+
module Relaton
|
|
7
|
+
module Render
|
|
8
|
+
# Deprecated 1.x engine leaves, restored so flavor gems that still
|
|
9
|
+
# subclass them load against this line. Superseded by the Iso690
|
|
10
|
+
# engine; removed when the flavors have migrated to CitationStyle
|
|
11
|
+
# instances. Referencing a constant loads its tree on demand.
|
|
12
|
+
autoload :Parse, "relaton/render/parse/parse"
|
|
13
|
+
autoload :Fields, "relaton/render/fields/fields"
|
|
14
|
+
autoload :Date, "relaton/render/fields/date"
|
|
15
|
+
autoload :Template, "relaton/render/template/template"
|
|
16
|
+
autoload :Citations, "relaton/render/legacy/citations"
|
|
17
|
+
end
|
|
18
|
+
end
|
data/relaton-render.gemspec
CHANGED
|
@@ -21,6 +21,11 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.require_paths = ["lib"]
|
|
22
22
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
23
23
|
|
|
24
|
+
spec.add_dependency "htmlentities"
|
|
25
|
+
spec.add_development_dependency "relaton-bib"
|
|
26
|
+
spec.add_dependency "liquid", "~> 5"
|
|
24
27
|
spec.add_dependency "lutaml-model"
|
|
28
|
+
spec.add_dependency "nokogiri"
|
|
29
|
+
spec.add_dependency "twitter_cldr"
|
|
25
30
|
# spec.metadata["rubygems_mfa_required"] = "true"
|
|
26
31
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-render
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0.pre.alpha.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: 2026-10-
|
|
11
|
+
date: 2026-10-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: htmlentities
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: relaton-bib
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: liquid
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '5'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '5'
|
|
13
55
|
- !ruby/object:Gem::Dependency
|
|
14
56
|
name: lutaml-model
|
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -24,6 +66,34 @@ dependencies:
|
|
|
24
66
|
- - ">="
|
|
25
67
|
- !ruby/object:Gem::Version
|
|
26
68
|
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: nokogiri
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: twitter_cldr
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
27
97
|
description: Rendering of ISO 690 XML
|
|
28
98
|
email:
|
|
29
99
|
- open.source@ribose.com
|
|
@@ -43,17 +113,9 @@ files:
|
|
|
43
113
|
- bin/console
|
|
44
114
|
- bin/rspec
|
|
45
115
|
- bin/setup
|
|
46
|
-
- lib/isodoc-yaml/i18n-ar.yaml
|
|
47
|
-
- lib/isodoc-yaml/i18n-de.yaml
|
|
48
|
-
- lib/isodoc-yaml/i18n-en.yaml
|
|
49
|
-
- lib/isodoc-yaml/i18n-es.yaml
|
|
50
|
-
- lib/isodoc-yaml/i18n-fr.yaml
|
|
51
|
-
- lib/isodoc-yaml/i18n-ja.yaml
|
|
52
|
-
- lib/isodoc-yaml/i18n-ru.yaml
|
|
53
|
-
- lib/isodoc-yaml/i18n-zh-Hans.yaml
|
|
54
|
-
- lib/isodoc-yaml/i18n-zh-Hant.yaml
|
|
55
|
-
- lib/isodoc/i18n.rb
|
|
56
116
|
- lib/relaton-render.rb
|
|
117
|
+
- lib/relaton/render/fields/date.rb
|
|
118
|
+
- lib/relaton/render/fields/fields.rb
|
|
57
119
|
- lib/relaton/render/general.rb
|
|
58
120
|
- lib/relaton/render/iso690.rb
|
|
59
121
|
- lib/relaton/render/iso690/element.rb
|
|
@@ -86,6 +148,15 @@ files:
|
|
|
86
148
|
- lib/relaton/render/iso690/style/type_template.rb
|
|
87
149
|
- lib/relaton/render/iso690/styles/author-date.yml
|
|
88
150
|
- lib/relaton/render/iso690/template.rb
|
|
151
|
+
- lib/relaton/render/legacy/citations.rb
|
|
152
|
+
- lib/relaton/render/parse/parse.rb
|
|
153
|
+
- lib/relaton/render/parse/parse_contributors.rb
|
|
154
|
+
- lib/relaton/render/parse/parse_extract.rb
|
|
155
|
+
- lib/relaton/render/parse/parse_id.rb
|
|
156
|
+
- lib/relaton/render/template/hash_utils.rb
|
|
157
|
+
- lib/relaton/render/template/liquid.rb
|
|
158
|
+
- lib/relaton/render/template/subclasses.rb
|
|
159
|
+
- lib/relaton/render/template/template.rb
|
|
89
160
|
- lib/relaton/render/version.rb
|
|
90
161
|
- relaton-render.gemspec
|
|
91
162
|
homepage: https://github.com/relaton/relaton-render
|
data/lib/isodoc/i18n.rb
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require "yaml"
|
|
2
|
-
require "isodoc-i18n"
|
|
3
|
-
|
|
4
|
-
module IsoDoc
|
|
5
|
-
class RelatonRenderI18n < I18n
|
|
6
|
-
def load_yaml1(lang, script)
|
|
7
|
-
case lang
|
|
8
|
-
when "en", "fr", "ru", "de", "es", "ar", "ja"
|
|
9
|
-
load_yaml2(lang)
|
|
10
|
-
when "zh"
|
|
11
|
-
case script
|
|
12
|
-
when "Hans", "Hant" then load_yaml2("zh-#{script}")
|
|
13
|
-
else load_yaml2("zh-Hans")
|
|
14
|
-
end
|
|
15
|
-
else load_yaml2("en")
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def load_yaml2(str)
|
|
20
|
-
YAML.load_file(File.join(File.dirname(__FILE__),
|
|
21
|
-
"../isodoc-yaml/i18n-#{str}.yaml"))
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# force bidi for all i18n strings in Arabic,
|
|
25
|
-
# because of the potential for script mixing
|
|
26
|
-
def cleanup_entities(hash, is_xml: true)
|
|
27
|
-
ret = super
|
|
28
|
-
if @lang == "ar" && ret.include?("%")
|
|
29
|
-
ret = "؜#{ret}؜"
|
|
30
|
-
end
|
|
31
|
-
ret
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
at_url: متاح في
|
|
2
|
-
at_venue: في
|
|
3
|
-
at_institution: في
|
|
4
|
-
at_time: في
|
|
5
|
-
at_location: في
|
|
6
|
-
in_document: في
|
|
7
|
-
in_series: في
|
|
8
|
-
in_archive: في
|
|
9
|
-
and: و
|
|
10
|
-
author_and: و
|
|
11
|
-
updated: محدث
|
|
12
|
-
viewed: ينظر
|
|
13
|
-
version: الإصدار
|
|
14
|
-
also_pub_as: ":نشرت أيضا باسم"
|
|
15
|
-
no_date: بدون تاريخ
|
|
16
|
-
no_place: بدون مدينة
|
|
17
|
-
date_formats:
|
|
18
|
-
month_year: yMMMM
|
|
19
|
-
day_month_year: to_long_s
|
|
20
|
-
date_time: to_long_s
|
|
21
|
-
ordinal_keys: []
|
|
22
|
-
OrdinalRules: digits-ordinal
|
|
23
|
-
edition_ordinal: "الطبعة {{ var1 | ordinal_num: 'edition', '' }}"
|
|
24
|
-
edition_cardinal: "الطبعة {{ var }}"
|
|
25
|
-
edition: الطبعة
|
|
26
|
-
draft: "مشروع %"
|
|
27
|
-
editor:
|
|
28
|
-
sg: محرر
|
|
29
|
-
pl: محرران
|
|
30
|
-
stage:
|
|
31
|
-
valid: صالح
|
|
32
|
-
withdrawn: انسحبت
|
|
33
|
-
extent:
|
|
34
|
-
page:
|
|
35
|
-
sg: "% ص"
|
|
36
|
-
pl: "% ص"
|
|
37
|
-
volume:
|
|
38
|
-
sg: "% المجلد"
|
|
39
|
-
pl: "% المجلدين"
|
|
40
|
-
issue:
|
|
41
|
-
sg: "% عدد"
|
|
42
|
-
pl: "% عدد"
|
|
43
|
-
size:
|
|
44
|
-
page:
|
|
45
|
-
sg: "ص %"
|
|
46
|
-
pl: "ص %"
|
|
47
|
-
volume:
|
|
48
|
-
sg: "المجلد %"
|
|
49
|
-
pl: "المجلدين %"
|
|
50
|
-
issue:
|
|
51
|
-
sg: "% عدد"
|
|
52
|
-
pl: "% عدد"
|
|
53
|
-
punct:
|
|
54
|
-
open-title: «
|
|
55
|
-
close-title: »
|
|
56
|
-
open-secondary-title:
|
|
57
|
-
close-secondary-title:
|
|
58
|
-
inflection:
|
|
59
|
-
الطبعة:
|
|
60
|
-
grammar:
|
|
61
|
-
gender: f
|
|
62
|
-
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
at_url: unter
|
|
2
|
-
at_venue: bei
|
|
3
|
-
at_institution: bei
|
|
4
|
-
at_time: um
|
|
5
|
-
at_location: in
|
|
6
|
-
in_document: in
|
|
7
|
-
in_series: in
|
|
8
|
-
in_archive: in
|
|
9
|
-
and: und
|
|
10
|
-
author_and: und
|
|
11
|
-
updated: aktualisiert
|
|
12
|
-
viewed: angesehen
|
|
13
|
-
version: Version
|
|
14
|
-
also_pub_as: "Auch veröffentlicht als: "
|
|
15
|
-
no_date: o.J.
|
|
16
|
-
no_place: o.O.
|
|
17
|
-
date_formats:
|
|
18
|
-
month_year: yMMMM
|
|
19
|
-
day_month_year: to_long_s
|
|
20
|
-
date_time: to_long_s
|
|
21
|
-
draft: "Entwurf %"
|
|
22
|
-
edition_ordinal: "{{ var1 }} Ausg."
|
|
23
|
-
edition_cardinal: "Ausg. {{ var1 }}"
|
|
24
|
-
ordinal_keys: []
|
|
25
|
-
edition: Ausgabe
|
|
26
|
-
editor:
|
|
27
|
-
sg: Hrsg.
|
|
28
|
-
pl: Hrsg.
|
|
29
|
-
extent:
|
|
30
|
-
page:
|
|
31
|
-
sg: "S. %"
|
|
32
|
-
pl: "S. %"
|
|
33
|
-
volume:
|
|
34
|
-
sg: "Bd. %"
|
|
35
|
-
pl: "Bde. %"
|
|
36
|
-
issue:
|
|
37
|
-
sg: "Nr. %"
|
|
38
|
-
pl: "Nr. %"
|
|
39
|
-
punct:
|
|
40
|
-
open-title: <em>
|
|
41
|
-
close-title: </em>
|
|
42
|
-
open-secondary-title:
|
|
43
|
-
close-secondary-title:
|
|
44
|
-
stage:
|
|
45
|
-
valid: Gültig
|
|
46
|
-
withdrawn: Zurückgezogen
|
|
47
|
-
size:
|
|
48
|
-
page:
|
|
49
|
-
sg: "% S."
|
|
50
|
-
pl: "% S."
|
|
51
|
-
volume:
|
|
52
|
-
sg: "% Bd."
|
|
53
|
-
pl: "% Bde."
|
|
54
|
-
issue:
|
|
55
|
-
sg: "% Nr."
|
|
56
|
-
pl: "% Nr."
|
|
57
|
-
inflection:
|
|
58
|
-
Ausgabe:
|
|
59
|
-
grammar:
|
|
60
|
-
gender: f
|
|
61
|
-
|