postsvg 0.2.3 → 0.2.5
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/CLAUDE.md +3 -3
- data/lib/postsvg/translation/record_emitter.rb +11 -0
- data/lib/postsvg/version.rb +1 -1
- 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: e16167ba04bd75b82581d7d2b134ab27e86dbfb8d6995b1cf2c90dbd066f8c77
|
|
4
|
+
data.tar.gz: 6037cc81949b6081d656e255cb69df316bdbe281693c63a557fb7594e28bd087
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a877fb8b10d634fd4099bf48722e4f22bc06fd3666d8e4a0fa94e4f47a1c6ba9ab94d4194363e8ed2a2dc4d5b1b90df4f01698f6b6da45f39bdf07ba9806c7a2
|
|
7
|
+
data.tar.gz: 387841a18917ae89771060686407b391c4ad6ad39c028411171a130c46c308f132089b7b3a258508cc4ca4ff66a534c244873d79b70d5608d10604a49b880eae
|
data/CLAUDE.md
CHANGED
|
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
4
4
|
|
|
5
5
|
## What this is
|
|
6
6
|
|
|
7
|
-
`postsvg` is a pure-Ruby bidirectional converter between PostScript/EPS and SVG. Both directions are implemented in the 0.2.x line; the SVg→PS direction is newer. The PS side uses a hand-written lexer + stack-machine interpreter; the SVG side uses
|
|
7
|
+
`postsvg` is a pure-Ruby bidirectional converter between PostScript/EPS and SVG. Both directions are implemented in the 0.2.x line; the SVg→PS direction is newer. The PS side uses a hand-written lexer + stack-machine interpreter; the SVG side uses leptris. There is no Ghostscript, Inkscape, or other external renderer.
|
|
8
8
|
|
|
9
9
|
Code architecture mirrors `emfsvg`: a typed `Model::Program` value object is the single source of truth, with a Renderer / Visitor visiting it to emit SVG, and a Serializer walking it to emit PS.
|
|
10
10
|
|
|
@@ -54,7 +54,7 @@ PS/EPS bytes ──▶│ Postsvg::Lexer │
|
|
|
54
54
|
│ │
|
|
55
55
|
▼ │
|
|
56
56
|
SVG string │
|
|
57
|
-
│
|
|
57
|
+
│ leptris │
|
|
58
58
|
▼ │
|
|
59
59
|
┌─────────────────┐ │
|
|
60
60
|
│ Postsvg:: │ │
|
|
@@ -163,7 +163,7 @@ Errors: `Postsvg::ParseError`, `LexError`, `SyntaxError`, `RenderError`, `StackU
|
|
|
163
163
|
|
|
164
164
|
## Dependencies
|
|
165
165
|
|
|
166
|
-
- `parslet`, `thor`, `
|
|
166
|
+
- `parslet`, `thor`, `leptris`, `lutaml/canon` (dev only, for XML matcher in integration specs) — see `Gemfile`.
|
|
167
167
|
|
|
168
168
|
## Limitations
|
|
169
169
|
|
|
@@ -14,6 +14,17 @@ module Postsvg
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def emit(record)
|
|
17
|
+
# Operators built by the svg -> ps handlers carry their
|
|
18
|
+
# operands as attributes; the serializer writes keywords only
|
|
19
|
+
# and expects the operands as separate literal statements
|
|
20
|
+
# ahead of the keyword (the shape the PS parse path produces).
|
|
21
|
+
# Splice them in so the record stream round-trips.
|
|
22
|
+
if record.is_a?(Model::Operator) &&
|
|
23
|
+
record.class.public_method_defined?(:operand_values)
|
|
24
|
+
record.operand_values.each do |v|
|
|
25
|
+
@records << Model::Literals::Number.new(v)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
17
28
|
@records << record
|
|
18
29
|
self
|
|
19
30
|
end
|
data/lib/postsvg/version.rb
CHANGED