metanorma-plugin-glossarist 0.1.5 → 0.1.7

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: a6c81322a6e6ffc687bba5c93bd828dd0575b311fa4d85e7b2dd05054b62132e
4
- data.tar.gz: bc2cfd48b22e009133a9b8dbfd8961020c63e3709b19294a8f9919979705032f
3
+ metadata.gz: 31c8561ae2833ab723f05a6f26ee240108fc0ae7af69b894dddb35ddb4c4745e
4
+ data.tar.gz: 7204ff398a95968f62494a013ada1c501f7688242ddc66484533181aacbab50a
5
5
  SHA512:
6
- metadata.gz: bed6a841c96d5741a9ef8ae896e5676b787c3f9539eefe245ebb2808f43168c1b8d1381f265ed8798e5fd8a001f43360081d38be9cf96b35b38990fe87d45356
7
- data.tar.gz: c0e590d799ee958142f6943200f4fb2389c6e6d27934add0e9c741789be520875929bee28a2abc303720db216862e780533e73e679ddbd7b0456ad654ac34a48
6
+ metadata.gz: c9671b8af358591e2496abde27a5201c4ad69f4a0063c59172bfc5403fb83791f60129045ff28f76dd4403ac5a3c7d3690320bde966b12876dfa6a5983ff4b97
7
+ data.tar.gz: 80bf6e1c675c189d5f94f2382afddcf08b80926c6acdf52ab7f778e832dada7d90b9b9f5b97e3524d49da84b977df05ae0563f930bf32a563d849b398a8dca8f
@@ -27,11 +27,20 @@ module Liquid
27
27
  end
28
28
  end
29
29
 
30
+ def load_collection(folder_path)
31
+ @@collections ||= {}
32
+
33
+ return @@collections[folder_path] if @@collections[folder_path]
34
+
35
+ collection = ::Glossarist::ManagedConceptCollection.new
36
+ collection.load_from_files(folder_path)
37
+ @@collections[folder_path] = collection
38
+ end
39
+
30
40
  def render(context)
31
41
  @contexts.each do |local_context|
32
42
  context_file = local_context[:file_path].strip
33
- collection = ::Glossarist::ManagedConceptCollection.new
34
- collection.load_from_files(context_file)
43
+ collection = load_collection(context_file)
35
44
 
36
45
  context[local_context[:name]] = Liquid::Drops::ConceptsDrop.new(collection, @filters)
37
46
  end
@@ -26,7 +26,11 @@ module Metanorma
26
26
  def render_liquid(file_content)
27
27
  template = Liquid::Template.parse(file_content)
28
28
  template.registers[:file_system] = file_system
29
- template.render(strict_variables: false, error_mode: :warn)
29
+ rendered_template = template.render(strict_variables: false, error_mode: :warn)
30
+
31
+ return rendered_template unless template.errors.any?
32
+
33
+ raise template.errors.first.cause
30
34
  end
31
35
  end
32
36
  end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Glossarist
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.7"
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.5
4
+ version: 0.1.7
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-07-05 00:00:00.000000000 Z
11
+ date: 2023-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor