metanorma-plugin-glossarist 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -6,15 +6,6 @@ require "liquid"
6
6
  require "asciidoctor/reader"
7
7
  require "glossarist"
8
8
  require "metanorma/plugin/glossarist/document"
9
- require "liquid/custom_blocks/with_glossarist_context"
10
-
11
- require "liquid/drops/concepts_drop"
12
- require "liquid/custom_filters/filters"
13
-
14
- Liquid::Template
15
- .register_tag("with_glossarist_context",
16
- Liquid::CustomBlocks::WithGlossaristContext)
17
- Liquid::Template.register_filter(Liquid::CustomFilters::Filters)
18
9
 
19
10
  module Metanorma
20
11
  module Plugin
@@ -23,12 +14,10 @@ module Metanorma
23
14
  GLOSSARIST_DATASET_REGEX = /^:glossarist-dataset:\s*(.*?)$/m.freeze
24
15
  GLOSSARIST_IMPORT_REGEX = /^glossarist::import\[(.*?)\]$/m.freeze
25
16
  GLOSSARIST_RENDER_REGEX = /^glossarist::render\[(.*?)\]$/m.freeze
26
-
27
- GLOSSARIST_BLOCK_REGEX = /^\[glossarist,(.+?),(.+?)\]/
28
- GLOSSARIST_FILTER_BLOCK_REGEX = /^\[glossarist,(.+?),(filter=.+?),(.+?)\]/
29
-
30
- GLOSSARIST_BIBLIOGRAPHY_REGEX = /^glossarist::render_bibliography\[(.*?)\]$/m.freeze
31
- GLOSSARIST_BIBLIOGRAPHY_ENTRY_REGEX = /^glossarist::render_bibliography_entry\[(.*?)\]$/m.freeze
17
+ GLOSSARIST_BLOCK_REGEX = /^\[glossarist,(.+?),(.+?)\]/.freeze
18
+ GLOSSARIST_FILTER_BLOCK_REGEX = /^\[glossarist,(.+?),(filter=.+?),(.+?)\]/.freeze # rubocop:disable Layout/LineLength
19
+ GLOSSARIST_BIBLIOGRAPHY_REGEX = /^glossarist::render_bibliography\[(.*?)\]$/m.freeze # rubocop:disable Layout/LineLength
20
+ GLOSSARIST_BIBLIOGRAPHY_ENTRY_REGEX = /^glossarist::render_bibliography_entry\[(.*?)\]$/m.freeze # rubocop:disable Layout/LineLength
32
21
 
33
22
  # Search document for the following blocks
34
23
  # - :glossarist-dataset: dataset1:./dataset1;dataset2:./dataset2
@@ -63,6 +52,7 @@ module Metanorma
63
52
  @title_depth = { value: 2 }
64
53
  @rendered_bibliographies = {}
65
54
  @seen_glossarist = []
55
+ @context_names = []
66
56
  end
67
57
 
68
58
  def process(document, reader)
@@ -83,14 +73,18 @@ module Metanorma
83
73
  protected
84
74
 
85
75
  def log(doc, text)
86
- File.open("#{doc.attr('docfile')}.glossarist.log.txt", "w:UTF-8") do |f|
76
+ File.open("#{doc.attr('docfile')}.glossarist.log.txt",
77
+ "w:UTF-8") do |f|
87
78
  f.write(text)
88
79
  end
89
80
  end
90
81
 
91
82
  private
92
83
 
93
- def prepare_document(document, input_lines, end_mark = nil)
84
+ def prepare_document( # rubocop:disable Metrics/MethodLength
85
+ document, input_lines, end_mark = nil,
86
+ skip_dataset: false
87
+ )
94
88
  liquid_doc = Document.new
95
89
  liquid_doc.file_system = @config[:file_system]
96
90
 
@@ -98,13 +92,19 @@ module Metanorma
98
92
  current_line = input_lines.next
99
93
  break if end_mark && current_line == end_mark
100
94
 
101
- process_line(document, input_lines, current_line, liquid_doc)
95
+ if !(
96
+ skip_dataset && current_line.start_with?(":glossarist-dataset:")
97
+ )
98
+ process_line(document, input_lines, current_line, liquid_doc)
99
+ end
102
100
  end
103
101
 
104
102
  liquid_doc
105
103
  end
106
104
 
107
- def process_line(document, input_lines, current_line, liquid_doc)
105
+ def process_line( # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
106
+ document, input_lines, current_line, liquid_doc
107
+ )
108
108
  if match = current_line.match(GLOSSARIST_DATASET_REGEX)
109
109
  process_dataset_tag(document, input_lines, liquid_doc, match)
110
110
  elsif match = current_line.match(GLOSSARIST_RENDER_REGEX)
@@ -117,40 +117,44 @@ module Metanorma
117
117
  process_bibliography_entry(liquid_doc, match)
118
118
  elsif match = current_line.match(GLOSSARIST_FILTER_BLOCK_REGEX)
119
119
  process_glossarist_block(document, liquid_doc, input_lines, match)
120
- elsif match = current_line.match(GLOSSARIST_BLOCK_REGEX)
120
+ elsif match = current_line.match(GLOSSARIST_BLOCK_REGEX) # rubocop:disable Lint/DuplicateBranch
121
121
  process_glossarist_block(document, liquid_doc, input_lines, match)
122
122
  else
123
- @title_depth[:value] = current_line.sub(/ .*$/, "").size if /^==+ \S/.match?(current_line)
123
+ if /^==+ \S/.match?(current_line)
124
+ @title_depth[:value] =
125
+ current_line.sub(/ .*$/,
126
+ "").size
127
+ end
124
128
  liquid_doc.add_content(current_line)
125
129
  end
126
130
  end
127
131
 
128
132
  def process_dataset_tag(document, input_lines, liquid_doc, match)
129
133
  @seen_glossarist << "x"
130
- context_names = prepare_dataset_contexts(document, match[1])
131
-
134
+ @context_names << prepare_dataset_contexts(document, match[1])
135
+ @context_names.flatten!
132
136
  dataset_section = <<~TEMPLATE
133
- {% with_glossarist_context #{context_names} %}
134
137
  #{prepare_document(document, input_lines)}
135
- {% endwith_glossarist_context %}
136
138
  TEMPLATE
137
139
 
138
140
  liquid_doc.add_content(
139
141
  dataset_section,
140
- render: true,
142
+ render: false,
141
143
  )
142
144
  end
143
145
 
144
146
  def process_glossarist_block(document, liquid_doc, input_lines, match)
145
147
  @seen_glossarist << "x"
146
148
  end_mark = input_lines.next
147
- path = relative_file_path(document, match[1])
148
-
149
+ # path = relative_file_path(document, match[1])
149
150
  glossarist_params = prepare_glossarist_block_params(document, match)
150
151
 
151
152
  glossarist_section = <<~TEMPLATE.strip
152
153
  {% with_glossarist_context #{glossarist_params} %}
153
- #{prepare_document(document, input_lines, end_mark)}
154
+ #{prepare_document(
155
+ document, input_lines, end_mark,
156
+ skip_dataset: true
157
+ )}
154
158
  {% endwith_glossarist_context %}
155
159
  TEMPLATE
156
160
 
@@ -161,7 +165,7 @@ module Metanorma
161
165
  end
162
166
 
163
167
  def prepare_glossarist_block_params(document, match)
164
- path = relative_file_path(document, match[1])
168
+ path = get_context_path(document, match[1])
165
169
 
166
170
  if match[2].strip.start_with?("filter")
167
171
  filters = match[2].split("=")[1..-1].join("=").strip
@@ -173,6 +177,22 @@ module Metanorma
173
177
  end
174
178
  end
175
179
 
180
+ def get_context_path(document, key) # rubocop:disable Metrics/MethodLength
181
+ context_path = nil
182
+ # try to get context_path from glossarist-dataset definition
183
+ if @context_names && !@context_names.empty?
184
+ context_names = @context_names.map(&:strip)
185
+ context_path = context_names.find do |context|
186
+ context_name, = context.split("=")
187
+ context_name == key
188
+ end
189
+ end
190
+
191
+ return context_path.split("=").last.strip if context_path
192
+
193
+ relative_file_path(document, key)
194
+ end
195
+
176
196
  def process_render_tag(liquid_doc, match)
177
197
  @seen_glossarist << "x"
178
198
  context_name, concept_name = match[1].split(",")
@@ -182,13 +202,15 @@ module Metanorma
182
202
  )
183
203
  end
184
204
 
185
- def process_import_tag(liquid_doc, match)
205
+ def process_import_tag(liquid_doc, match) # rubocop:disable Metrics/AbcSize
186
206
  @seen_glossarist << "x"
187
207
  context_name = match[1].strip
188
- dataset = @datasets[context_name.strip]
208
+ dataset = @datasets[context_name]
189
209
 
190
210
  liquid_doc.add_content(
191
- dataset.concepts.map do |concept_name, _concept|
211
+ dataset.map do |concept|
212
+ concept_name = concept.data.localizations["eng"].data
213
+ .terms[0].designation
192
214
  concept_template(context_name, concept_name)
193
215
  end.join("\n"),
194
216
  )
@@ -200,7 +222,7 @@ module Metanorma
200
222
  dataset = @datasets[dataset_name]
201
223
 
202
224
  liquid_doc.add_content(
203
- dataset.concepts.map do |concept|
225
+ dataset.map do |concept|
204
226
  concept_bibliography(concept)
205
227
  end.compact.sort.join("\n"),
206
228
  )
@@ -209,17 +231,19 @@ module Metanorma
209
231
  def process_bibliography_entry(liquid_doc, match)
210
232
  @seen_glossarist << "x"
211
233
  dataset_name, concept_name = match[1].split(",").map(&:strip)
212
- concept = @datasets[dataset_name][concept_name]
213
-
214
- liquid_doc.add_content(
215
- concept_bibliography(concept),
216
- )
234
+ concept = get_concept(dataset_name, concept_name)
235
+ bibliography = concept_bibliography(concept)
236
+ if bibliography
237
+ liquid_doc.add_content(bibliography)
238
+ end
217
239
  end
218
240
 
219
- def concept_bibliography(concept)
220
- bibliography = concept["eng"]["sources"].map do |source|
221
- ref = source["origin"]["ref"]
241
+ def concept_bibliography(concept) # rubocop:disable Metrics/AbcSize
242
+ sources = concept.data.localizations["eng"].data.sources
243
+ return nil if sources.nil? || sources.empty?
222
244
 
245
+ bibliography = sources.map do |source|
246
+ ref = source.origin.text
223
247
  next if @rendered_bibliographies[ref] || ref.nil? || ref.empty?
224
248
 
225
249
  @rendered_bibliographies[ref] = ref.gsub(/[ \/:]/, "_")
@@ -230,18 +254,16 @@ module Metanorma
230
254
  end
231
255
 
232
256
  def prepare_dataset_contexts(document, contexts)
233
- context_names = contexts.split(";").map do |context|
257
+ contexts.split(";").map do |context|
234
258
  context_name, file_path = context.split(":").map(&:strip)
235
259
  path = relative_file_path(document, file_path)
236
260
 
237
261
  dataset = ::Glossarist::ManagedConceptCollection.new
238
262
  dataset.load_from_files(path)
239
- @datasets[context_name] = Liquid::Drops::ConceptsDrop.new(dataset)
263
+ @datasets[context_name] = dataset.map(&:to_liquid)
240
264
 
241
265
  "#{context_name}=#{path}"
242
266
  end
243
-
244
- context_names.join(",")
245
267
  end
246
268
 
247
269
  def relative_file_path(document, file_path)
@@ -255,10 +277,10 @@ module Metanorma
255
277
 
256
278
  def concept_template(dataset_name, concept_name)
257
279
  <<~CONCEPT_TEMPLATE
258
- #{"=" * (@title_depth[:value] + 1)} {{ #{dataset_name}['#{concept_name}'].term }}
280
+ #{'=' * (@title_depth[:value] + 1)} #{concept_title(dataset_name, concept_name)}
259
281
  #{alt_terms(dataset_name, concept_name)}
260
282
 
261
- {{ #{dataset_name}['#{concept_name}']['eng'].definition[0].content }}
283
+ #{concept_definition(dataset_name, concept_name)}
262
284
 
263
285
  #{examples(dataset_name, concept_name)}
264
286
 
@@ -268,51 +290,99 @@ module Metanorma
268
290
  CONCEPT_TEMPLATE
269
291
  end
270
292
 
271
- def alt_terms(dataset_name, concept_name)
272
- concept = @datasets[dataset_name][concept_name]
293
+ def get_concept(dataset_name, concept_name)
294
+ @datasets[dataset_name].find do |c|
295
+ c.data.localizations["eng"]
296
+ .data.terms[0]
297
+ .designation == concept_name
298
+ end
299
+ end
300
+
301
+ def concept_title(dataset_name, concept_name)
302
+ concept = get_concept(dataset_name, concept_name)
303
+ concept.data.localizations["eng"].data.terms[0].designation
304
+ end
305
+
306
+ def concept_definition(dataset_name, concept_name)
307
+ concept = get_concept(dataset_name, concept_name)
308
+ definition = concept.data.localizations["eng"].data
309
+ .definition[0].content
310
+ definition.to_s
311
+ end
312
+
313
+ def alt_terms(dataset_name, concept_name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
314
+ concept = get_concept(dataset_name, concept_name)
273
315
  term_types = %w[preferred admitted deprecated]
316
+ concept_terms = concept.data.localizations["eng"].data.terms
274
317
 
275
- concept["eng"]["terms"][1..-1].map do |term|
276
- type = if term_types.include?(term["normative_status"])
277
- term["normative_status"]
318
+ concept_terms[1..-1].map do |term|
319
+ type = if term_types.include?(term.normative_status)
320
+ term.normative_status
278
321
  else
279
322
  "alt"
280
323
  end
281
- "#{type}:[#{term['designation']}]"
324
+ "#{type}:[#{term.designation}]"
282
325
  end.join("\n")
283
326
  end
284
327
 
285
- def examples(dataset_name, concept_name)
286
- <<~EXAMPLES
287
- {% for example in #{dataset_name}['#{concept_name}']['eng'].examples %}
288
- [example]
289
- {{ example.content }}
328
+ def examples(dataset_name, concept_name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
329
+ concept = get_concept(dataset_name, concept_name)
330
+ examples = concept.data.localizations["eng"].data.examples
331
+ result = []
332
+
333
+ examples.each do |example|
334
+ content = <<~EXAMPLE
335
+ [example]
336
+ #{example.content}
337
+
338
+ EXAMPLE
339
+ result << content
340
+ end
290
341
 
291
- {% endfor %}
292
- EXAMPLES
342
+ result.join("\n")
293
343
  end
294
344
 
295
- def notes(dataset_name, concept_name)
296
- <<~NOTES
297
- {% for note in #{dataset_name}['#{concept_name}']['eng'].notes %}
298
- [NOTE]
299
- ====
300
- {{ note.content }}
301
- ====
345
+ def notes(dataset_name, concept_name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
346
+ concept = get_concept(dataset_name, concept_name)
347
+ notes = concept.data.localizations["eng"].data.notes
348
+ result = []
302
349
 
303
- {% endfor %}
304
- NOTES
350
+ notes.each do |note|
351
+ content = <<~NOTE
352
+ [NOTE]
353
+ ====
354
+ #{note.content}
355
+ ====
356
+
357
+ NOTE
358
+ result << content
359
+ end
360
+
361
+ result.join("\n")
305
362
  end
306
363
 
307
- def sources(dataset_name, concept_name)
308
- <<~SOURCES
309
- {% for source in #{dataset_name}['#{concept_name}']['eng'].sources %}
310
- {%- if source.origin.ref == nil or source.origin.ref == '' %}{% continue %}{% endif %}
311
- [.source]
312
- <<{{ source.origin.ref | replace: ' ', '_' | replace: '/', '_' | replace: ':', '_' }},{{ source.origin.clause }}>>
364
+ def sources(dataset_name, concept_name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
365
+ concept = get_concept(dataset_name, concept_name)
366
+ sources = concept.data.localizations["eng"].data.sources
367
+ result = []
368
+
369
+ sources.each do |source|
370
+ if source.origin.text && source.origin.text != ""
371
+ source_origin_text = source.origin.text
372
+ .gsub(" ", "_")
373
+ .gsub("/", "_")
374
+ .gsub(":", "_")
375
+ source_content = "#{source_origin_text},#{source.origin.clause}"
376
+ content = <<~SOURCES
377
+ [.source]
378
+ <<#{source_content}>>
379
+
380
+ SOURCES
381
+ result << content
382
+ end
383
+ end
313
384
 
314
- {% endfor %}
315
- SOURCES
385
+ result.join("\n")
316
386
  end
317
387
  end
318
388
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "liquid/custom_blocks/with_glossarist_context"
4
+ require_relative "liquid/custom_filters/filters"
5
+
3
6
  module Metanorma
4
7
  module Plugin
5
8
  module Glossarist
@@ -24,14 +27,30 @@ module Metanorma
24
27
  end
25
28
 
26
29
  def render_liquid(file_content)
27
- template = Liquid::Template.parse(file_content)
30
+ template = ::Liquid::Template
31
+ .parse(file_content, environment: create_liquid_environment)
32
+
28
33
  template.registers[:file_system] = file_system
29
- rendered_template = template.render(strict_variables: false, error_mode: :warn)
34
+ rendered_template = template.render(strict_variables: false,
35
+ error_mode: :warn)
30
36
 
31
37
  return rendered_template unless template.errors.any?
32
38
 
33
39
  raise template.errors.first.cause
34
40
  end
41
+
42
+ def create_liquid_environment
43
+ ::Liquid::Environment.new.tap do |liquid_env|
44
+ liquid_env.register_tag(
45
+ "with_glossarist_context",
46
+ ::Metanorma::Plugin::Glossarist::Liquid::CustomBlocks::
47
+ WithGlossaristContext,
48
+ )
49
+ liquid_env.register_filter(
50
+ ::Metanorma::Plugin::Glossarist::Liquid::CustomFilters::Filters,
51
+ )
52
+ end
53
+ end
35
54
  end
36
55
  end
37
56
  end
@@ -0,0 +1,155 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "liquid"
4
+
5
+ module Metanorma
6
+ module Plugin
7
+ module Glossarist
8
+ module Liquid
9
+ module CustomBlocks
10
+ class WithGlossaristContext < ::Liquid::Block
11
+ def initialize(tag_name, markup, tokens) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
12
+ super
13
+
14
+ @contexts = []
15
+ @filters = {}
16
+
17
+ contexts, filters = markup.split(";", 2)
18
+
19
+ if filters && !filters.empty?
20
+ filters.strip.gsub(/^['"]|['"]$/,
21
+ "").split(";").each do |filter|
22
+ property, value = filter.split("=")
23
+
24
+ @filters[property] = value
25
+ end
26
+ end
27
+
28
+ contexts.split(",").each do |context|
29
+ context_name, file_path = context.split("=").map(&:strip)
30
+
31
+ @contexts << {
32
+ name: context_name,
33
+ file_path: file_path,
34
+ }
35
+ end
36
+ end
37
+
38
+ def load_collection(folder_path)
39
+ @@collections ||= {}
40
+
41
+ return @@collections[folder_path] if @@collections[folder_path]
42
+
43
+ collection = ::Glossarist::ManagedConceptCollection.new
44
+ collection.load_from_files(folder_path)
45
+ @@collections[folder_path] = collection
46
+ end
47
+
48
+ def filter_collection(collection, filters)
49
+ return collection unless filters
50
+
51
+ concept_filters = filters.dup
52
+ lang_filter = concept_filters.delete("lang")
53
+ group_filter = concept_filters.delete("group")
54
+ sort_filter = concept_filters.delete("sort_by")
55
+
56
+ collection = apply_lang_filter(collection, lang_filter)
57
+ collection = apply_group_filter(collection, group_filter)
58
+ collection = apply_field_filter(collection, concept_filters)
59
+ apply_sort_filter(collection, sort_filter)
60
+ end
61
+
62
+ def apply_field_filter(collection, field_filter) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
63
+ return collection if field_filter.nil? || field_filter.empty?
64
+
65
+ collection.select do |obj| # rubocop:disable Metrics/BlockLength
66
+ fields = field_filter.keys.first.split(".")
67
+ value = field_filter.values.first
68
+ start_with = false
69
+
70
+ # check if the last field is a start_with condition
71
+ if fields.last.start_with?("start_with(") &&
72
+ fields.last.include?(")")
73
+ start_with = true
74
+ # Extract content between first '(' and last ')'
75
+ f = fields.last
76
+ value = f[(f.index("(") + 1)...f.rindex(")")]
77
+ fields = fields[0..-2]
78
+ end
79
+
80
+ fields.each do |field|
81
+ # contain index (i.e. field['abc'] or field[1])
82
+ if field.include?("[")
83
+ field, index = field[0..-2].split("[")
84
+
85
+ index = if index.include?("'") || index.include?("\"")
86
+ index.gsub(/['"]/, "")
87
+ else
88
+ index.to_i
89
+ end
90
+
91
+ obj = obj.send(field.to_sym)[index]
92
+ else
93
+ obj = obj.send(field.to_sym)
94
+ end
95
+ end
96
+
97
+ # check if the object matches the value
98
+ if start_with
99
+ obj.start_with?(value)
100
+ else
101
+ obj == value
102
+ end
103
+ end
104
+ end
105
+
106
+ def apply_lang_filter(collection, lang_filter)
107
+ return collection unless lang_filter
108
+
109
+ collection.select do |concept|
110
+ concept.data.localizations.key?(lang_filter)
111
+ end
112
+ end
113
+
114
+ def apply_group_filter(collection, group_filter)
115
+ return collection unless group_filter
116
+
117
+ collection.select do |concept|
118
+ concept.data.groups.include?(group_filter)
119
+ end
120
+ end
121
+
122
+ def apply_sort_filter(collection, sort_filter)
123
+ return collection unless sort_filter
124
+
125
+ sort_filter = case sort_filter
126
+ when "term"
127
+ "default_designation"
128
+ else
129
+ sort_filter
130
+ end
131
+
132
+ collection.sort_by do |concept|
133
+ concept.send(sort_filter.to_sym)
134
+ end
135
+ end
136
+
137
+ def render(context)
138
+ @contexts.each do |local_context|
139
+ context_file = local_context[:file_path].strip
140
+ collection = load_collection(context_file)
141
+
142
+ filtered_collection = filter_collection(collection, @filters)
143
+
144
+ context[local_context[:name]] = filtered_collection
145
+ .map(&:to_liquid)
146
+ end
147
+
148
+ super
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module Plugin
5
+ module Glossarist
6
+ module Liquid
7
+ module CustomFilters
8
+ module Filters
9
+ def values(list)
10
+ list.values
11
+ end
12
+
13
+ def terminological_data(term)
14
+ result = []
15
+
16
+ result << "&lt;#{term['usage_info']}&gt;" if term["usage_info"]
17
+ result << extract_grammar_info(term)
18
+ result << term["geographical_area"]&.upcase
19
+
20
+ result.unshift(",") if result.compact.size.positive?
21
+
22
+ result.compact.join(" ")
23
+ end
24
+
25
+ def extract_grammar_info(term)
26
+ return unless term["grammar_info"]
27
+
28
+ grammar_info = []
29
+
30
+ term["grammar_info"].each do |info|
31
+ grammar_info << info["gender"]&.join(", ")
32
+ grammar_info << info["number"]&.join(", ")
33
+ grammar_info << extract_parts_of_speech(info)
34
+ end
35
+
36
+ grammar_info.join(" ")
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Glossarist
4
- VERSION = "0.2.3".freeze
4
+ VERSION = "0.2.5".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -13,7 +13,8 @@ Gem::Specification.new do |spec|
13
13
  spec.license = "BSD-2-Clause"
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
16
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added
17
+ # into git.
17
18
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
19
  `git ls-files -z`.split("\x0").reject do |f|
19
20
  f.match(%r{^(test|spec|features)/})
@@ -23,7 +24,9 @@ Gem::Specification.new do |spec|
23
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
25
  spec.require_paths = ["lib"]
25
26
 
27
+ spec.required_ruby_version = ">= 2.7.0" # rubocop:disable Gemspec/RequiredRubyVersion
28
+
26
29
  spec.add_dependency "asciidoctor", "~> 2.0.0"
27
- spec.add_dependency "glossarist", "~> 2.0"
30
+ spec.add_dependency "glossarist", "~> 2.3.6"
28
31
  spec.add_dependency "liquid", "~> 5"
29
32
  end