postsvg 0.2.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc86d0544a9c47fdfedf108692538b5d362fca385c366889ed7ffd3accc40ef4
4
- data.tar.gz: 765f530771bb2168d0bfff09b0f66f7edfc1f78b671ba59dd294646b245e06dc
3
+ metadata.gz: e16167ba04bd75b82581d7d2b134ab27e86dbfb8d6995b1cf2c90dbd066f8c77
4
+ data.tar.gz: 6037cc81949b6081d656e255cb69df316bdbe281693c63a557fb7594e28bd087
5
5
  SHA512:
6
- metadata.gz: 1eafc7316bb8441c1bcb6c87efc1889b895e661cd20fab659274a7dd9bf5960041fa9901d150f8004162cecb4f605daf3ea49127994415cd30c3b4c7d72b6edc
7
- data.tar.gz: 3d24279bccbeaf85e08da0f3e0acac1d21cf5411d69f2e872bd09e6fc276f09bec27ec3d34680138c164336655e337d998a3c8d90691bc46033469be9e0f1e78
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 Nokogiri. There is no Ghostscript, Inkscape, or other external renderer.
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
- │ Nokogiri │
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`, `nokogiri`, `lutaml/canon` (dev only, for XML matcher in integration specs) — see `Gemfile`.
166
+ - `parslet`, `thor`, `leptris`, `lutaml/canon` (dev only, for XML matcher in integration specs) — see `Gemfile`.
167
167
 
168
168
  ## Limitations
169
169
 
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  gem "canon"
8
- gem "nokogiri"
8
+ gem "leptris", "~> 1.9.362"
9
9
  gem "rake"
10
10
  gem "rspec"
11
11
  gem "rubocop"
@@ -6,7 +6,7 @@ module Postsvg
6
6
  # carry typed semantic fields; the base provides a uniform interface
7
7
  # for the translation layer's dispatch.
8
8
  #
9
- # Element instances are immutable: built once from a Nokogiri node
9
+ # Element instances are immutable: built once from a leptris node
10
10
  # via the .from_node factory. The node is not retained.
11
11
  #
12
12
  # Every element exposes `children`, `transform`, `clip_path_id`,
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "nokogiri"
3
+ require "leptris"
4
4
 
5
5
  module Postsvg
6
6
  module Svg
7
- # Parses an SVG document via Nokogiri and produces an Svg::Document.
7
+ # Parses an SVG document via leptris and produces an Svg::Document.
8
8
  # Pure: no I/O, no global state.
9
9
  class Parser
10
10
  def self.call(svg_string)
11
- doc = Nokogiri::XML(svg_string, &:noblanks)
11
+ doc = Leptris::XML.parse(svg_string, options: Leptris::XML::ParseOptions.noblanks)
12
12
  root = doc.root
13
13
  raise TranslationError, "no root element in SVG" unless root
14
14
 
data/lib/postsvg/svg.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Postsvg
4
- # SVG domain model. Built once from a Nokogiri-parsed document;
4
+ # SVG domain model. Built once from a leptris-parsed document;
5
5
  # consumed by the Translation layer (SVG -> PS).
6
6
  #
7
7
  # Svg::* value objects know nothing about PostScript. Their job is
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Postsvg
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.5"
5
5
  end
data/lib/postsvg.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require "postscript"
4
4
  require "parslet"
5
5
  require "thor"
6
- require "nokogiri"
6
+ require "leptris"
7
7
 
8
8
  module Postsvg
9
9
  autoload :VERSION, "postsvg/version"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postsvg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-29 00:00:00.000000000 Z
11
+ date: 2026-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: nokogiri
14
+ name: leptris
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.9.362
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 1.9.362
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parslet
29
29
  requirement: !ruby/object:Gem::Requirement