rsyntaxtree 1.9.0 → 1.10.0
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 +4 -4
- data/CHANGELOG.md +23 -0
- data/CITATION.cff +2 -2
- data/README.md +2 -2
- data/bin/rsyntaxtree +4 -0
- data/lib/rsyntaxtree/utils.rb +0 -1
- data/lib/rsyntaxtree/version.rb +1 -1
- data/lib/rsyntaxtree.rb +35 -17
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38f3abe8841c2097201c6120f900a0d9eb99fb8bea9c6dc8388ac38a8e0df2c7
|
|
4
|
+
data.tar.gz: d22ebd93a2a2ed135e4afcc21797f4f057a3b5d340fdfd265a7f5490ccc642fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3c9dc57831246bdd189e92998ba8325606635669e4e63839509d84db3e21911d0eb928f615b2d2d0f5d9ed6e711c2fed3785d3f1453988deef333a5e513ec48
|
|
7
|
+
data.tar.gz: eea07050d7df010b52615c475d4681749420c7b16687169c9e5ae3de5fbc6683daf939b9c17795442ed2589ad08dfddd745ad41b6d169f5238f521eaab638d3b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.10.0] - 2026-08
|
|
4
|
+
|
|
5
|
+
A transitional release ahead of 2.0, which drops JPG/GIF output and the
|
|
6
|
+
RMagick dependency.
|
|
7
|
+
|
|
8
|
+
### Deprecated
|
|
9
|
+
- JPG and GIF output: the CLI prints a warning to stderr when either is
|
|
10
|
+
requested, and the documentation marks both as deprecated. JPEG blurs
|
|
11
|
+
line art and GIF has no use case here — use PNG. Both formats are
|
|
12
|
+
removed in 2.0.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- The library no longer loads RMagick at require time. SVG, PNG, PDF,
|
|
16
|
+
TikZ and LSIF work without ImageMagick installed; only a JPG or GIF
|
|
17
|
+
request needs RMagick, and a request without it reports the missing
|
|
18
|
+
dependency as a regular input error instead of a bare `LoadError`.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- `RSTError` mutated the message it was given, so raising one with a plain
|
|
22
|
+
string literal crashed inside the error class with a `FrozenError`. Every
|
|
23
|
+
file here carries `frozen_string_literal`, which made the working form the
|
|
24
|
+
unobvious one.
|
|
25
|
+
|
|
3
26
|
## [1.9.0] - 2026-08
|
|
4
27
|
|
|
5
28
|
### Added
|
data/CITATION.cff
CHANGED
|
@@ -11,8 +11,8 @@ repository-code: "https://github.com/yohasebe/rsyntaxtree"
|
|
|
11
11
|
# Concept DOI: always resolves to the latest archived version on Zenodo
|
|
12
12
|
doi: "10.5281/zenodo.21916150"
|
|
13
13
|
license: MIT
|
|
14
|
-
version: 1.
|
|
15
|
-
date-released: 2026-08-
|
|
14
|
+
version: 1.10.0
|
|
15
|
+
date-released: 2026-08-19
|
|
16
16
|
keywords:
|
|
17
17
|
- linguistics
|
|
18
18
|
- syntax tree
|
data/README.md
CHANGED
|
@@ -66,7 +66,7 @@ Connect nodes with lines or arrows:
|
|
|
66
66
|
|
|
67
67
|
### Multiple Output Formats
|
|
68
68
|
|
|
69
|
-
Generate trees in PNG, SVG, PDF,
|
|
69
|
+
Generate trees in PNG, SVG, PDF, or LSIF (JSON) format. (JPG and GIF are deprecated and will be removed in 2.0.)
|
|
70
70
|
|
|
71
71
|
## Web Interface
|
|
72
72
|
|
|
@@ -167,7 +167,7 @@ Usage:
|
|
|
167
167
|
| Option | Description | Default |
|
|
168
168
|
|--------|-------------|---------|
|
|
169
169
|
| `-o, --outdir` | Output directory | `./` |
|
|
170
|
-
| `-f, --format` | Output format: png,
|
|
170
|
+
| `-f, --format` | Output format: png, svg, pdf, lsif, tikz (jpg and gif are deprecated) | `png` |
|
|
171
171
|
| `-l, --leafstyle` | Leaf style: auto, triangle, bar, nothing | `auto` |
|
|
172
172
|
| `-n, --fontstyle` | Font style: sans, serif, cjk, mono | `sans` |
|
|
173
173
|
| `-s, --fontsize` | Font size: 8-26 | `16` |
|
data/bin/rsyntaxtree
CHANGED
|
@@ -160,6 +160,10 @@ opts.each do |key, value|
|
|
|
160
160
|
end
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
+
if %w[jpg gif].include?(string_opts[:format])
|
|
164
|
+
warn "Warning: #{string_opts[:format].upcase} output is deprecated and will be removed in RSyntaxTree 2.0. Use PNG instead."
|
|
165
|
+
end
|
|
166
|
+
|
|
163
167
|
data = if ARGV[0] && File.exist?(File.expand_path(ARGV[0]))
|
|
164
168
|
File.read ARGV[0]
|
|
165
169
|
elsif ARGV[0]
|
data/lib/rsyntaxtree/utils.rb
CHANGED
data/lib/rsyntaxtree/version.rb
CHANGED
data/lib/rsyntaxtree.rb
CHANGED
|
@@ -53,8 +53,10 @@ DEFAULT_OPTS = {
|
|
|
53
53
|
|
|
54
54
|
class RSTError < StandardError
|
|
55
55
|
def initialize(msg = "Error: something unexpected occurred")
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
# Non-destructive: every file here carries frozen_string_literal, so
|
|
57
|
+
# mutating the message in place turned a raise with a plain literal into
|
|
58
|
+
# a FrozenError from inside the error class itself.
|
|
59
|
+
super(msg.gsub(WHITESPACE_BLOCK, "<>"))
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
|
|
@@ -69,7 +71,6 @@ require_relative 'rsyntaxtree/string_parser'
|
|
|
69
71
|
|
|
70
72
|
require 'cgi'
|
|
71
73
|
require 'rsvg2'
|
|
72
|
-
require 'rmagick'
|
|
73
74
|
|
|
74
75
|
module RSyntaxTree
|
|
75
76
|
class RSGenerator
|
|
@@ -243,24 +244,41 @@ module RSyntaxTree
|
|
|
243
244
|
graph.svg_data
|
|
244
245
|
end
|
|
245
246
|
|
|
247
|
+
# JPG and GIF output converts the PNG through RMagick. The require is
|
|
248
|
+
# lazy: both formats are deprecated and will be removed in 2.0, and the
|
|
249
|
+
# library must load without RMagick for every other format. A missing
|
|
250
|
+
# RMagick is reported as an input-level error, not a bare LoadError.
|
|
251
|
+
def with_rmagick
|
|
252
|
+
require 'rmagick'
|
|
253
|
+
yield
|
|
254
|
+
rescue LoadError
|
|
255
|
+
raise RSTError, +"Error: JPG/GIF output requires ImageMagick and the rmagick gem, " \
|
|
256
|
+
"which is not installed. Use PNG instead — JPG and GIF support " \
|
|
257
|
+
"is deprecated and will be removed in 2.0."
|
|
258
|
+
end
|
|
259
|
+
|
|
246
260
|
def draw_jpg
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
with_rmagick do
|
|
262
|
+
png_data = draw_png
|
|
263
|
+
images = Magick::Image.from_blob(png_data)
|
|
264
|
+
image = images.first
|
|
265
|
+
image.format = 'JPEG'
|
|
266
|
+
blob = image.to_blob
|
|
267
|
+
images.each(&:destroy!)
|
|
268
|
+
blob
|
|
269
|
+
end
|
|
254
270
|
end
|
|
255
271
|
|
|
256
272
|
def draw_gif
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
273
|
+
with_rmagick do
|
|
274
|
+
png_data = draw_png
|
|
275
|
+
images = Magick::Image.from_blob(png_data)
|
|
276
|
+
image = images.first
|
|
277
|
+
image.format = 'GIF'
|
|
278
|
+
blob = image.to_blob
|
|
279
|
+
images.each(&:destroy!)
|
|
280
|
+
blob
|
|
281
|
+
end
|
|
264
282
|
end
|
|
265
283
|
|
|
266
284
|
def draw_lsif
|