metanorma-plugin-glossarist 0.1.2 → 0.1.3

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: 161c43940a2841d4b92f05cb5b48cfab1f3eef3db02854b5dc88396e34aa9225
4
- data.tar.gz: 377080e6303ad8e0afb736969e40f7fcbe8b48f354c96e6f82ffa2614a09c603
3
+ metadata.gz: 8b6290545d75d21cefa6a6960b79105dd75412eff970547a3a234816594b03ed
4
+ data.tar.gz: '0647850cbe587276287c59670b1fc99d33e24e3eea4540c23506d49747672380'
5
5
  SHA512:
6
- metadata.gz: 3e2ade62ab37bcdc546ac357af61fb1245135733b85fac794c2503bb4f3d98fd09c6af2e12897f45d489ae5ff83e89468b419268fb3653d5fa1b4e8fd0eee459
7
- data.tar.gz: 5626f96664c0e759a874f6efd5eb69a3ba4069958e470f3cacc2e2ecc980be99e7070f39b22c04a2a55476f535aee9b197a2ef3e503982fda7779491325a0781
6
+ metadata.gz: fa96058a858415981ab0d59fb359e9ca52dcbdf105748514481c28e50f569568c4c59c5a894c7685a27b4ebd4d2d4e38863bcd88541ca16b8b2162dfc9d26eb7
7
+ data.tar.gz: e7d6f5e73dd576499dfeea2f91243b48164e35249fef1f5b70bfdafe57609c5a8695f120d2a8b3e5b2c802c9b6975bff9a0e1a3bfa5a948ad8f9c18079b30868
@@ -34,6 +34,7 @@ module Liquid
34
34
  concept_filters = filters.dup
35
35
  language_filter = concept_filters.delete('lang')
36
36
  sort_filter = concept_filters.delete('sort_by')
37
+ group_filter = concept_filters.delete('group')
37
38
 
38
39
  concepts = concepts_collection.to_h["managed_concepts"].map do |concept|
39
40
  filtered_concept = concept.dup
@@ -61,6 +62,7 @@ module Liquid
61
62
  end
62
63
  end.compact
63
64
 
65
+ apply_group_filter(concepts, group_filter)
64
66
  apply_sort_filter(concepts, sort_filter)
65
67
  end
66
68
 
@@ -70,6 +72,16 @@ module Liquid
70
72
  concepts.sort_by { |concept| concept.dig(*extract_nested_field_names(sort_by)) }
71
73
  end
72
74
 
75
+ def apply_group_filter(concepts, groups)
76
+ return concepts unless groups
77
+
78
+ concepts.select! do |concept|
79
+ groups.split(",").reduce(true) do |pre_result, group|
80
+ pre_result && concept["groups"].include?(group.strip)
81
+ end
82
+ end
83
+ end
84
+
73
85
  def extract_nested_field_names(name)
74
86
  name.split(".").map do |field|
75
87
  field_name = field.strip
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Glossarist
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-glossarist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-11 00:00:00.000000000 Z
11
+ date: 2023-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor