metanorma-plugin-plantuml 1.0.5 → 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: 16e8bf4ddf357ba4f08740382237313dd48cbee2fcfca80601c2f1a578f2d902
4
- data.tar.gz: 2480aedc5cafcdc41d20a52766bf65b4ce39418def0cd660b0147ff335c0b13d
3
+ metadata.gz: 231d4ad0a53b48775c54c4920f7a9b55eff8853809e79597af91980065ea21ae
4
+ data.tar.gz: 5dcdb1e04b32ca5e3f22577b395953b26872a2cc5620c961838833eb6192e2c1
5
5
  SHA512:
6
- metadata.gz: f9217b009f4ba58ef78d676073d80606723e03010950d9ec0128b3e0f0ebbeb444e99883fcd9dd5b5fbec1047829dd4ccd790dcd27f091482c5d3072ebb5d449
7
- data.tar.gz: ea90a7d62d74ac7aaa3facba46e8d8950a934e185f9a541cc76c600e7fccf9ad3a0d166e1bac4cd5838fab532a014f28f42dc42c8e1ccef0f9c2f27ceab27d1b
6
+ metadata.gz: 3568b612e0fca38d1645fb19807bf345abaf955342e81fdee15a874c29295fce91c14b2d47e943e706ba8922d9f31da364b21daf0483154d3f85d66bb1677b44
7
+ data.tar.gz: 810dab27b571e16623bfff0cd36b7cdc4fa643fe2592a3b87cdb5568296df45fa60746595c19c99c1e7afdb53f17a071e92a595f9aa7d3fc218bd9180a632263
data/.gitignore ADDED
@@ -0,0 +1,41 @@
1
+ # Ignore bundler config
2
+ /.bundle/
3
+
4
+ # Ignore all logfiles and tempfiles
5
+ /log/*
6
+ /tmp/*
7
+ !/log/.keep
8
+ !/tmp/.keep
9
+
10
+ # Ignore vendor directory
11
+ /vendor/
12
+
13
+ # Ignore Gemfile.lock (for gems)
14
+ /Gemfile.lock
15
+
16
+ # Ignore pkg directory
17
+ /pkg/
18
+
19
+ # Ignore OS generated files
20
+ .DS_Store
21
+ .DS_Store?
22
+ ._*
23
+ .Spotlight-V100
24
+ .Trashes
25
+ ehthumbs.db
26
+ Thumbs.db
27
+
28
+ # Ignore IDE files
29
+ .vscode/
30
+ .idea/
31
+ *.swp
32
+ *.swo
33
+ *~
34
+
35
+ # Ignore test coverage
36
+ /coverage/
37
+ /.simplecov
38
+
39
+ # Ignore local development files
40
+ .env
41
+ .env.local
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
  ====
@@ -112,8 +112,15 @@ module Metanorma
112
112
  reader.source
113
113
  else
114
114
  # get content from ImageBlockMacroProcessor
115
- docdir = parent.document.attributes["docdir"]
116
- File.read(File.join(docdir, reader))
115
+ docfile_directory = File.dirname(
116
+ parent.document.attributes["docfile"] || ".",
117
+ )
118
+
119
+ resolved_path = parent.document
120
+ .path_resolver
121
+ .system_path(reader, docfile_directory)
122
+
123
+ File.read(resolved_path)
117
124
  end
118
125
 
119
126
  # Validate that we have matching start/end pairs
@@ -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.5".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.5
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-10 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
@@ -48,6 +48,7 @@ files:
48
48
  - ".github/workflows/plantuml-version-sync.yml"
49
49
  - ".github/workflows/rake.yml"
50
50
  - ".github/workflows/release.yml"
51
+ - ".gitignore"
51
52
  - Gemfile
52
53
  - LICENSE
53
54
  - README.adoc