metanorma-plugin-lutaml 0.6.4 → 0.6.5

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: e52ac2333cb4e251e5d531e8909d1a763a6f05960ad886136741676639235e44
4
- data.tar.gz: 7f3e2daffb58c5074928121da9f4951f85a704e1cb8d8e666e5cfcfcdff90e7c
3
+ metadata.gz: 701c14675ce78bd6ddc3f3302679709c852e5572da0779c8f26964c6cac866a3
4
+ data.tar.gz: 43d6abe93a90748e2b7a6163d396a43d1f09a8a36f8d0d2e43be34c7492a8daa
5
5
  SHA512:
6
- metadata.gz: bc3b7a23fef7ba9b8b7537ea94d5b28c548b0f55409e4dbf6e8cac0d35742d2126d4831a9bc1747647ac5d9e3c3f4f1ed3d4b00eb0ffeeae0251b65d6301833e
7
- data.tar.gz: e56cad378a1131c70ebc0a47e2d44cbdba2fda3bc4a56f866a4a3e3b45268eeb02fa859e02d48904a8b4b90fe0699fc99c607853e9509b41221953917ed2a0f0
6
+ metadata.gz: 5d45281405302619caf401c6f319c4a217c30c34826e466ef874e661b3cfa3c11c9fa2691638de4590d22c68491bbc70abebea078135706d8cfcca86ec927d1f
7
+ data.tar.gz: 84b31a07da65105d1640613359e24ba60921c4c8c4ecc467cbdd200fee817a5e009b21d0533e90897151ddf260a6c2c48b68006818e5606e633a64197a2ec0bf
@@ -67,7 +67,7 @@ module Metanorma
67
67
  entity_name = match[2]
68
68
  options = parse_options_to_hash(match[3])
69
69
 
70
- result.push(*parse_marco(lutaml_path, entity_name, document,
70
+ result.push(*parse_macro(lutaml_path, entity_name, document,
71
71
  options))
72
72
  else
73
73
  result.push(line)
@@ -75,7 +75,7 @@ module Metanorma
75
75
  end
76
76
  end
77
77
 
78
- def parse_marco(lutaml_path, entity_name, document, options)
78
+ def parse_macro(lutaml_path, entity_name, document, options)
79
79
  lutaml_document = lutaml_document_from_file(document, lutaml_path)
80
80
  .serialized_document
81
81
  entities = [lutaml_document["classes"], lutaml_document["enums"]]
@@ -120,18 +120,30 @@ module Metanorma
120
120
  ::Lutaml::Parser.parse(files)
121
121
  end
122
122
 
123
+ # TODO: Refactor this using Suma::SchemaConfig
123
124
  def load_express_from_index(document, path)
124
125
  yaml_content = YAML.safe_load(File.read(path))
125
- root_path = yaml_content["path"]
126
- schemas_paths = yaml_content["schemas"]
127
- .map do |(schema_name, schema_values)|
128
- schema_values["path"] || File.join(root_path.to_s,
129
- "#{schema_name}.exp")
126
+ schema_yaml_base_path = Pathname.new(File.dirname(path))
127
+
128
+ # If there is a global root path set, all subsequent paths are
129
+ # relative to it.
130
+ if yaml_content['path']
131
+ root_schema_path = Pathname.new(yaml_content['path'])
132
+ schema_yaml_base_path = schema_yaml_base_path + root_schema_path
130
133
  end
131
134
 
132
- files_to_load = schemas_paths.map do |path|
133
- File.new(Utils.relative_file_path(document, path),
134
- encoding: "UTF-8")
135
+ files_to_load = yaml_content["schemas"].map do |key, value|
136
+
137
+ # If there is no path: set for a schema, we assume it uses the
138
+ # schema name as the #{filename}.exp.
139
+ schema_path = if value['path']
140
+ Pathname.new(value['path'])
141
+ else
142
+ Pathname.new("#{key}.exp")
143
+ end
144
+
145
+ real_schema_path = schema_yaml_base_path + schema_path
146
+ File.new(real_schema_path.cleanpath.to_s, encoding: "UTF-8")
135
147
  end
136
148
 
137
149
  ::Lutaml::Parser.parse(files_to_load)
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.6.4".freeze
4
+ VERSION = "0.6.5".freeze
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-lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-08 00:00:00.000000000 Z
11
+ date: 2024-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor