metanorma-plugin-lutaml 0.7.56 → 0.7.57

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '082818d3c08e139aaf8f7e51fbc3187bdff832c7ff79020ca3a8057e497c0f0e'
4
- data.tar.gz: 8524c16a1c751a3a9b03b9e9e0e77ce9040ccd455d6c7cb4c9bd2ae862b5b1c5
3
+ metadata.gz: eb9c176145db89f41f691658a755ce2f94cd8a1f1f302dd328deb4ec0286c5b0
4
+ data.tar.gz: '0309da4d8a37de8b907e77b7ab46b27f7e6d67269a1dc9ce37fb2150b9f887d6'
5
5
  SHA512:
6
- metadata.gz: 96178a219154034173db6621b51a70821c7c97ca0826db593d8bd9aa38a417156460601db83319f9ee4994451eb16575ab2a1f58befc72fbbf4f6b1bf70809c3
7
- data.tar.gz: c61b1123f75491be102bc38c90f1f361c169a8cdf3227cc7ee0f87e236119efc506d1145e30ac891be37641e15ca1b7a1be401b97d6dd47606d262373abfcfd9
6
+ metadata.gz: a4884c1d32422983d9c5ab5388c63c7a0937526a561a6b4ba5c1043f0250d389efeee2d475d750c3f1f90983caae66aa3b156beeb4551dc093ea1e63a44e95b4
7
+ data.tar.gz: cc10688b5530b8068fa25176e84dceb950e29a355781be749e9a6f6709b5331f64391466db046cd58013f30911ec0ac68d7cd25ee938a51e5e6c04d0b89c4ab1
@@ -17,6 +17,12 @@ module Metanorma
17
17
  )
18
18
  resolved = document.path_resolver
19
19
  .system_path(file_path, docfile_directory)
20
+ # The decorator expands emitted paths against this base: relative
21
+ # prefixes alone get re-anchored by asciidoctor's imagesdir
22
+ # handling (images/../../schemas collapses a level), so the
23
+ # decoration must produce paths that resolve from the docfile.
24
+ options["relative_path_base"] =
25
+ File.expand_path(docfile_directory)
20
26
  # The prefix lands inside emitted image macros, so it must not
21
27
  # carry the absolute build path: two builds of the same tree in
22
28
  # two directories produced different image/@src values
@@ -60,13 +60,26 @@ module Metanorma
60
60
  end
61
61
 
62
62
  def prefix_relative_paths(line, path_prefix)
63
+ # Decorated remarks live on models shared across documents and
64
+ # preprocess passes: a second pass over an already-decorated line
65
+ # would stack the prefix again (paths like
66
+ # ../schemas/schemas/schemas/... rendered unusable). Idempotent:
67
+ # a line that carries this prefix is left alone.
68
+ return line if path_prefix && line.include?(path_prefix)
69
+
63
70
  line.gsub(RELATIVE_PREFIX_MACRO_REGEXP) do |_match|
64
- # The prefix is docfile-relative (metanorma-plugin-lutaml#325):
65
- # expanding it against the process CWD produced absolute image
66
- # paths under whatever directory the build was launched from
67
- # (e.g. <repo>/../../schemas/...), which then failed to resolve
68
- # at render time. An absolute prefix passes through unchanged.
69
- full_path = File.join(path_prefix, $3.strip)
71
+ # Expand against the docfile directory (passed by the adapter
72
+ # as relative_path_base), NOT the process CWD: a CWD expansion
73
+ # produced absolute image paths under whatever directory the
74
+ # build was launched from (e.g. <repo>/../../schemas/...).
75
+ # The absolute result is deliberate: relative targets are
76
+ # re-anchored by asciidoctor's imagesdir handling
77
+ # (images/../../schemas collapses a level), which made every
78
+ # decorated diagram unresolvable at render time.
79
+ full_path = File.expand_path(
80
+ File.join(path_prefix, $3.strip),
81
+ options["relative_path_base"] || Dir.pwd,
82
+ )
70
83
  "#{$1}#{$2}#{full_path}#{$4}"
71
84
  end
72
85
  end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.7.56".freeze
4
+ VERSION = "0.7.57".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.56
4
+ version: 0.7.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.