metanorma-plugin-lutaml 0.2.4.pre.alpha.1 → 0.2.4.pre.alpha.2

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: 3d9bb01b3f5a13668f541d4119e0830655c524be8bcfa9414b41004b2f6fbcc4
4
- data.tar.gz: a2851e63eece312d2b529aa3fe68de9fffa794768ab1e15a0eec97b86ca9c9f3
3
+ metadata.gz: d72d3bfa8e8dd1e0a8321f97d9f32b46652e7961036d623d293ed07a0a19c6b1
4
+ data.tar.gz: 18a4eec7fba09c7f1466ae46fdf33d07e70855a9f00b1e4490252c22a7529ed7
5
5
  SHA512:
6
- metadata.gz: 1dd880cc2ac6829e851ad8165150af8905f8a558fda49e610a03af6c720d592c25695c135b3acc4c6be415a76c402060a7813b1783f6e3f8a6d0c580a53d4a63
7
- data.tar.gz: d78b7da3aad28bda7f8b2a1a891ca885068fe4b3261ad684a33e53afc83a5812a4bc13c30d7ef8ca34a0e3d6cc72a1482971ec63a5cec12b28283631cd455cc2
6
+ metadata.gz: 5440d8e90b6184ab41d1969e6520d3745013aa987314b9f50a524066d810497f0be86481bdcd6195bfe2982e1c8de4562226f373746e18bbd4f173796d043f5d
7
+ data.tar.gz: ee100c14d0bf8a945732da8ed86f8816ca67ce02dbe7fea80f14a04ac74fcd4efda65cedff89e5262725f044b3a69de85461d6fb5c724392cf01642b6afdf317
@@ -45,7 +45,11 @@ module Metanorma
45
45
  def prefix_relative_paths(line, path_prefix)
46
46
  line.gsub(RELATIVE_PREFIX_MACRO_REGEXP) do |_match|
47
47
  prefixed_path = File.join(path_prefix, $3.strip)
48
- "#{$1}#{$2}#{prefixed_path}#{$4}"
48
+ # When we are dealing with arelative path of a template: ../path/to/file we need to transform it into
49
+ # the absolute one because `image::` macro wont understand it other way
50
+ prefixed_path = File.absolute_path(prefixed_path) if prefixed_path.start_with?('../')
51
+ full_path = File.expand_path(prefixed_path)
52
+ "#{$1}#{$2}#{full_path}#{$4}"
49
53
  end
50
54
  end
51
55
 
@@ -76,19 +76,21 @@ module Metanorma
76
76
  if express_indexes[path]
77
77
  res.push(*express_indexes[path])
78
78
  else
79
- res.push(content_from_file(document, path).to_liquid)
79
+ res.push(content_from_file(document, path)
80
+ .to_liquid
81
+ .merge('relative_path_prefix' => Utils.relative_file_path(document, File.dirname(path))))
80
82
  end
81
83
  end
82
84
  end
83
85
 
84
86
  def parse_template(document, current_block, block_match, express_indexes)
85
87
  options = parse_options(block_match[3])
86
- .merge("relative_path_prefix" => File.dirname(block_match[1]))
87
88
  contexts_items(block_match, document, express_indexes)
88
89
  .map do |context_items|
89
90
  parse_context_block(document: document,
90
91
  context_lines: current_block,
91
- context_items: decorate_context_items(context_items, options),
92
+ context_items: decorate_context_items(context_items,
93
+ options.merge('relative_path_prefix' => context_items['relative_path_prefix'])),
92
94
  context_name: block_match[2].strip)
93
95
  end.flatten
94
96
  rescue StandardError => e
@@ -40,6 +40,7 @@ module Metanorma
40
40
  begin
41
41
  idxs[name]
42
42
  .push(::Lutaml::Parser.parse(File.new(path, encoding: "UTF-8")).to_liquid)
43
+ .merge("relative_path_prefix" => folder)
43
44
  rescue StandardError => e
44
45
  document.logger.warn("Failed to load #{path}: #{e.message}")
45
46
  end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.2.4-alpha.1".freeze
4
+ VERSION = "0.2.4-alpha.2".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.2.4.pre.alpha.1
4
+ version: 0.2.4.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: 2021-02-09 00:00:00.000000000 Z
11
+ date: 2021-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid