metanorma-plugin-plantuml 1.0.8 → 1.0.9

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: f630e977bc4ffc712b558d93838862f20d33a3c321d170035f236b28f263caf9
4
- data.tar.gz: 7767222a7655f56628928d69cf0990d38b5667c6cc74a009af2c53d1232ade2a
3
+ metadata.gz: 1594b7a7a379d41a955dc64c9df45f279e97dcc70e945c8cdd71f24a8dead0de
4
+ data.tar.gz: b7e1d1f1743f13bba5b73bf903cf38711fc6f4e76d68faaa16c1efcd164922ce
5
5
  SHA512:
6
- metadata.gz: 65d274ab21262faf3ffb1909f25b5e99c8eaad34c9f3df675b73aa7c727ca0d2e8f0a03ebd6e73c71e5a595dbf529d1b2e902c68ba635d7d866f8c417c8bc5e9
7
- data.tar.gz: 9ddc2697ab8d6eb43a488aa8c3b30e8d7d0c0c2a6dcf7abbb72501f28b89aff1aae8f36108c65fed41d714c5c627833fa660e26f19d9d76d49d712b84a7826bd
6
+ metadata.gz: 6407c49cb09ad07891238d922fe34f61b876d4be22cf388ebd0a281a6264eade533b0a0b710213d1a936eabc63b97dd88cdc71e34e83922d46169b5392a6397d
7
+ data.tar.gz: f7986cd4458b65f5b4d0040080880c86e101082843dbf9cbc85e5ec18b6292ee4730a2c2feed97a7aa4190f395d3f6107ae873e4c61e45381f82c7696ce333b8
@@ -70,9 +70,20 @@ module Metanorma
70
70
  through_attrs
71
71
  end
72
72
 
73
- def generate_file_prep(parent)
73
+ def generate_file_prep(parent) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
74
+ imagesdir = if parent.document.attr("docfile") &&
75
+ parent.document.attr("imagesdir")
76
+ File.expand_path(
77
+ File.join(
78
+ File.dirname(parent.document.attr("docfile")),
79
+ parent.document.attr("imagesdir"),
80
+ ),
81
+ )
82
+ else
83
+ parent.document.attr("imagesdir")
84
+ end
85
+
74
86
  ldir = localdir(parent)
75
- imagesdir = parent.document.attr("imagesdir")
76
87
  fmt = parent.document
77
88
  .attr("plantuml-image-format")&.strip&.downcase ||
78
89
  Wrapper::DEFAULT_FORMAT
@@ -86,12 +97,25 @@ module Metanorma
86
97
  raise "Destination directory #{ret} not writable for PlantUML!"
87
98
  end
88
99
 
89
- def path_prep(localdir, imagesdir)
90
- path = Pathname.new(File.join(localdir, "_plantuml_images"))
91
- sourcepath = imagesdir ? File.join(localdir, imagesdir) : localdir
100
+ def path_prep(localdir, imagesdir) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
101
+ # Determine source path
102
+ sourcepath = if imagesdir.nil?
103
+ localdir
104
+ elsif Pathname.new(imagesdir).absolute?
105
+ imagesdir
106
+ else
107
+ File.join(localdir, imagesdir)
108
+ end
109
+
110
+ # Determine PlantUML images destination absolute path
111
+ path = Pathname.new(
112
+ File.expand_path(File.join(localdir, "_plantuml_images")),
113
+ )
92
114
  path.mkpath
93
115
 
94
- raise "Destination path #{path} not writable for PlantUML!" unless File.writable?(path)
116
+ unless File.writable?(path)
117
+ raise "Destination path #{path} not writable for PlantUML!"
118
+ end
95
119
 
96
120
  [
97
121
  path,
@@ -9,9 +9,13 @@ module Metanorma
9
9
  module Utils
10
10
  class << self
11
11
  def localdir(document)
12
- document.attributes["localdir"] ||
12
+ if document.attributes["docfile"]
13
+ File.dirname(document.attributes["docfile"])
14
+ else
13
15
  document.attributes["docdir"] ||
14
- File.dirname(document.attributes["docfile"] || ".")
16
+ document.attributes["localdir"] ||
17
+ File.dirname(".")
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -3,7 +3,7 @@
3
3
  module Metanorma
4
4
  module Plugin
5
5
  module Plantuml
6
- VERSION = "1.0.8"
6
+ VERSION = "1.0.9"
7
7
  PLANTUML_JAR_VERSION = "1.2025.7"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-plantuml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-03 00:00:00.000000000 Z
11
+ date: 2026-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor