metanorma-plugin-plantuml 1.0.6 → 1.0.7

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: 75336a98da7df341a06f5414a384d4727814537fcabb01ec7cadf25e74de22fc
4
- data.tar.gz: 45d100cab5c110e730306aec82952fb64283e76e5c15c5f37a23a704af2bb3f9
3
+ metadata.gz: 231d4ad0a53b48775c54c4920f7a9b55eff8853809e79597af91980065ea21ae
4
+ data.tar.gz: 5dcdb1e04b32ca5e3f22577b395953b26872a2cc5620c961838833eb6192e2c1
5
5
  SHA512:
6
- metadata.gz: f91adf74d6025425419422f122c86ba28cb6febbd6b62de7e2f408322c10bcb7429b4f08242be4e1f5e548639122ce2a0755abe89289072e1732554d6938b9e6
7
- data.tar.gz: c7f5edb42f7d063c68941d96d2f6d84e1974ba50f98910db731922515c4337c66542d952dba98542cca39efb4459eed0c95a49bf962ebd146bba6a700df73569
6
+ metadata.gz: 3568b612e0fca38d1645fb19807bf345abaf955342e81fdee15a874c29295fce91c14b2d47e943e706ba8922d9f31da364b21daf0483154d3f85d66bb1677b44
7
+ data.tar.gz: 810dab27b571e16623bfff0cd36b7cdc4fa643fe2592a3b87cdb5568296df45fa60746595c19c99c1e7afdb53f17a071e92a595f9aa7d3fc218bd9180a632263
data/README.adoc CHANGED
@@ -89,6 +89,7 @@ Generally, the command syntax is more suitable for referencing external PlantUML
89
89
  files.
90
90
 
91
91
 
92
+ [[command-syntax]]
92
93
  === Command syntax for external diagrams
93
94
 
94
95
  PlantUML diagrams can be directly referenced from external files using the
@@ -104,7 +105,7 @@ plantuml_image::{plantuml-source.puml}[{options}]
104
105
  Where,
105
106
 
106
107
  `{plantuml-source.puml}`:: Path to the PlantUML source file, relative to the
107
- path of the current file.
108
+ path of the document root file.
108
109
 
109
110
  `{options}`:: (Optional) Comma-separated list of options to customize diagram
110
111
  generation.
@@ -140,6 +141,35 @@ The file `foo/bar.puml` is the same as above.
140
141
  The `format=svg` option specifies the output format as SVG.
141
142
  ====
142
143
 
144
+ The path to the PlantUML source file is relative to the document root file,
145
+ which is illustrated in the following example.
146
+
147
+ .PlantUML source file path is relative to document root
148
+ [example]
149
+ ====
150
+ Given the following directory structure:
151
+
152
+ [source]
153
+ ----
154
+ dir/
155
+ dir/sources/document.adoc
156
+ dir/sources/sections/section_1.adoc
157
+ dir/sources/plantuml/my_diagram.puml
158
+ ----
159
+
160
+ Where:
161
+
162
+ * `document.adoc` includes `sections/section_1.adoc`
163
+ * `section_1.adoc` contains the `plantuml_image` command.
164
+
165
+ The path to the PlantUML source file in `section_1.adoc` is specified relative
166
+ to `document.adoc`, the document root, which is `plantuml/my_diagram.puml`:
167
+
168
+ [source,asciidoc]
169
+ ----
170
+ plantuml_image::plantuml/my_diagram.puml[]
171
+ ----
172
+ ====
143
173
 
144
174
 
145
175
  === Block syntax for inline diagrams
@@ -452,6 +482,15 @@ Syntax:
452
482
  :plantuml-includedirs: {path1};{path2};...
453
483
  ----
454
484
 
485
+ Where,
486
+
487
+ `{path1}`, `{path2}`, etc.:: paths to directories (relative to document root)
488
+ containing PlantUML files to be included, delimited by semicolons.
489
+ +
490
+ NOTE: All paths passed to `includedirs` must be relative to the document root
491
+ file, see <<command-syntax>> on how to determine the document root.
492
+
493
+
455
494
  .Resolving PlantUML includes with document-level `includedirs` attribute
456
495
  [example]
457
496
  ====
@@ -33,7 +33,9 @@ module Metanorma
33
33
 
34
34
  def add_image_path_to_includedirs(document, image_path, includedirs)
35
35
  docdir = document.attributes["docdir"]
36
- includedirs << File.dirname(File.join(docdir, image_path))
36
+ includedirs << File.dirname(
37
+ document.path_resolver.system_path(image_path, docdir),
38
+ )
37
39
  includedirs.compact.uniq
38
40
  end
39
41
 
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Plantuml
4
- VERSION = "1.0.6".freeze
4
+ VERSION = "1.0.7".freeze
5
5
  PLANTUML_JAR_VERSION = "1.2025.7".freeze
6
6
  end
7
7
  end
@@ -14,8 +14,8 @@ module Metanorma
14
14
  class Wrapper
15
15
  PLANTUML_JAR_NAME = "plantuml.jar".freeze
16
16
  PLANTUML_JAR_PATH = File.join(
17
- File.dirname(__FILE__), "..", "..", "..",
18
- "..", "data", PLANTUML_JAR_NAME
17
+ Gem::Specification.find_by_name("metanorma-plugin-plantuml").gem_dir,
18
+ "data", PLANTUML_JAR_NAME
19
19
  )
20
20
 
21
21
  SUPPORTED_FORMATS = %w[png svg pdf txt eps].freeze
@@ -213,7 +213,9 @@ module Metanorma
213
213
  # find local include file in includedirs
214
214
  found_include_file = nil
215
215
  options[:includedirs].each do |includedir|
216
- include_file_path = File.join(includedir, include_file)
216
+ include_file_path = Pathname.new(includedir)
217
+ .join(include_file).to_s
218
+
217
219
  if File.exist?(include_file_path)
218
220
  found_include_file = include_file_path
219
221
  break
@@ -222,7 +224,9 @@ module Metanorma
222
224
 
223
225
  if found_include_file
224
226
  # create include file in temp directory
225
- temp_include_file = File.join(temp_dir, include_file)
227
+ temp_include_file = Pathname.new(temp_dir)
228
+ .join(include_file).to_s
229
+
226
230
  FileUtils.mkdir_p(File.dirname(temp_include_file))
227
231
 
228
232
  File.open(temp_include_file, "w") do |f|
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.6
4
+ version: 1.0.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: 2025-09-15 00:00:00.000000000 Z
11
+ date: 2025-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor