emfsvg 0.1.2 → 0.1.3
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/lib/emfsvg/svg/element.rb +1 -1
- data/lib/emfsvg/svg/elements.rb +1 -1
- data/lib/emfsvg/svg/parser.rb +7 -3
- data/lib/emfsvg/svg.rb +1 -1
- data/lib/emfsvg/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa10edb2ac2c6602479c03f38b672f394d9c99025093d7a5665346917bab956d
|
|
4
|
+
data.tar.gz: 1e18ecea04a50531708768fe8b92effe7b0babf52e8b284603855185eaafc6ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ad2f6818aa2e6a0dfcc5cc6010de3e12d92065dd5f3b2ca6a8076e2f4c4b96761568e9a8c504e8ad6d14776247942a1a49db54dcf9387443baf0fa1123fa2c7
|
|
7
|
+
data.tar.gz: 70eb4d34ac8872571de4062150630df64e77e437d88bdfc86d73cf7143cf1efde0f176403cdf1604a6bbb7c49eab1ee7b4ed9bdc38c757976c07c2a1c90ade25
|
data/lib/emfsvg/svg/element.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Emfsvg
|
|
|
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
|
|
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
|
class Element
|
|
12
12
|
ELEMENT_NAME = "abstract"
|
data/lib/emfsvg/svg/elements.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Emfsvg
|
|
|
4
4
|
module Svg
|
|
5
5
|
# Subclasses of Svg::Element for the supported SVG shape vocabulary.
|
|
6
6
|
# Each subclass parses its typed attributes at construction time
|
|
7
|
-
# (no
|
|
7
|
+
# (no leptris node is retained). Register in Svg::Element's
|
|
8
8
|
# registry so Svg::Element.from_node dispatches correctly.
|
|
9
9
|
module Elements
|
|
10
10
|
autoload :Stylable, "emfsvg/svg/elements/stylable"
|
data/lib/emfsvg/svg/parser.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "leptris"
|
|
4
4
|
|
|
5
5
|
module Emfsvg
|
|
6
6
|
module Svg
|
|
7
7
|
# Parses an SVG document string into a Svg::Document value object.
|
|
8
|
-
#
|
|
8
|
+
# leptris is the only XML parser used in this gem.
|
|
9
9
|
#
|
|
10
10
|
# Width/height are coerced to floats (CSS units other than px are
|
|
11
11
|
# out of scope for v1; a numeric value is treated as user units).
|
|
@@ -14,7 +14,11 @@ module Emfsvg
|
|
|
14
14
|
module_function
|
|
15
15
|
|
|
16
16
|
def call(string)
|
|
17
|
-
doc =
|
|
17
|
+
doc = begin
|
|
18
|
+
Leptris::XML.parse(string, options: Leptris::XML::ParseOptions.noblanks)
|
|
19
|
+
rescue Leptris::XML::ParseError
|
|
20
|
+
raise ParseError, "not an SVG document: unparseable content"
|
|
21
|
+
end
|
|
18
22
|
root = doc.root
|
|
19
23
|
raise ParseError, "not an SVG document: missing root element" unless root
|
|
20
24
|
|
data/lib/emfsvg/svg.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Emfsvg
|
|
4
4
|
# Pure SVG domain model. No EMF knowledge lives here.
|
|
5
5
|
#
|
|
6
|
-
# Svg::Parser consumes a
|
|
6
|
+
# Svg::Parser consumes a leptris-parsed SVG document and produces
|
|
7
7
|
# Svg::Document / Svg::Element value objects. Translation layer
|
|
8
8
|
# (Emfsvg::Translation) consumes these.
|
|
9
9
|
module Svg
|
data/lib/emfsvg/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: emfsvg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
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-
|
|
11
|
+
date: 2026-10-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -81,19 +81,19 @@ dependencies:
|
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '1.6'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: leptris
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
89
|
+
version: 1.9.362
|
|
90
90
|
type: :runtime
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
96
|
+
version: 1.9.362
|
|
97
97
|
description: Convert Microsoft Enhanced Metafile (EMF) to SVG and back. Consumes the
|
|
98
98
|
`emf` gem's domain model. Replaces the FFI wrapper around libemf2svg with a pure-Ruby
|
|
99
99
|
transformer.
|