Module: Sevgi::Derender
- Extended by:
- Derender
- Included in:
- Derender
- Defined in:
- lib/sevgi/derender.rb,
lib/sevgi/derender/node.rb,
lib/sevgi/derender/version.rb,
lib/sevgi/derender/document.rb,
lib/sevgi/derender/elements.rb,
lib/sevgi/derender/internal.rb,
lib/sevgi/derender/evaluator.rb,
lib/sevgi/derender/attributes.rb,
lib/sevgi/derender/elements/any.rb,
lib/sevgi/derender/elements/css.rb,
lib/sevgi/derender/elements/junk.rb,
lib/sevgi/derender/elements/root.rb,
lib/sevgi/derender/elements/text.rb
Overview
Converts SVG/XML content into Sevgi DSL source or evaluates it into graphics elements.
Generated source uses bare DSL calls only for recognized element names that cannot dispatch to an existing Ruby or
Sevgi method. Other XML names use the explicit Element DSL word so executing generated source preserves the XML
tree without invoking same-named Ruby methods.
Evaluation APIs treat SVG/XML as data: they build graphics element trees directly and do not execute generated Ruby source. Malformed, rootless, or unmatched input is rejected with ArgumentError.
Namespace dispatch treats qualified and foreign elements as ordinary XML nodes. Their element identity, namespace
declarations, qualified attributes, significant text, and nested svg elements survive source generation and direct
evaluation. CSS specialization applies only to unqualified style elements in no namespace or the default SVG
namespace; the document-root strategy additionally requires an unqualified svg at the root of the conversion.
Defined Under Namespace
Modules: Attributes, Elements Classes: Document, Node
Constant Summary collapse
- VERSION =
Current version of the Sevgi derender gem.
"0.95.0"
Class Method Summary collapse
-
.decompile(content, id: nil) ⇒ Sevgi::Derender::Node
Converts SVG/XML content into a derender node.
-
.decompile_file(file, id: nil) ⇒ Sevgi::Derender::Node
Converts an SVG/XML file into a derender node.
-
.derender(content, id: nil) ⇒ String
Converts SVG/XML content into Sevgi DSL Ruby source.
-
.derender_file(file, id: nil) ⇒ String
Converts an SVG/XML file into Sevgi DSL Ruby source.
-
.evaluate(content, element, id: nil) ⇒ Sevgi::Graphics::Element?
Evaluates SVG/XML content under a graphics element, including the selected node.
-
.evaluate_children(content, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Evaluates only the selected node's children under a graphics element.
-
.evaluate_file(file, element, id: nil) ⇒ Sevgi::Graphics::Element?
Evaluates an SVG/XML file under a graphics element, including the selected node.
-
.evaluate_file_children(file, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Evaluates only the selected node's children from an SVG/XML file under a graphics element.
Instance Method Summary collapse
-
#decompile(content, id: nil) ⇒ Sevgi::Derender::Node
Converts SVG/XML content into a derender node.
-
#decompile_file(file, id: nil) ⇒ Sevgi::Derender::Node
Converts an SVG/XML file into a derender node.
-
#derender(content, id: nil) ⇒ String
Converts SVG/XML content into Sevgi DSL Ruby source.
-
#derender_file(file, id: nil) ⇒ String
Converts an SVG/XML file into Sevgi DSL Ruby source.
-
#evaluate(content, element, id: nil) ⇒ Sevgi::Graphics::Element?
Evaluates SVG/XML content under a graphics element, including the selected node.
-
#evaluate_children(content, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Evaluates only the selected node's children under a graphics element.
-
#evaluate_file(file, element, id: nil) ⇒ Sevgi::Graphics::Element?
Evaluates an SVG/XML file under a graphics element, including the selected node.
-
#evaluate_file_children(file, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Evaluates only the selected node's children from an SVG/XML file under a graphics element.
Class Method Details
.decompile(content, id: nil) ⇒ Sevgi::Derender::Node
Converts SVG/XML content into a derender node.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.decompile_file(file, id: nil) ⇒ Sevgi::Derender::Node
Converts an SVG/XML file into a derender node.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.derender(content, id: nil) ⇒ String
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Unsafe bare Ruby names are emitted through the explicit Element DSL word.
Converts SVG/XML content into Sevgi DSL Ruby source.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.derender_file(file, id: nil) ⇒ String
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Unsafe bare Ruby names are emitted through the explicit Element DSL word.
Converts an SVG/XML file into Sevgi DSL Ruby source.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.evaluate(content, element, id: nil) ⇒ Sevgi::Graphics::Element?
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates SVG/XML content under a graphics element, including the selected node.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.evaluate_children(content, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates only the selected node's children under a graphics element.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.evaluate_file(file, element, id: nil) ⇒ Sevgi::Graphics::Element?
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates an SVG/XML file under a graphics element, including the selected node.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
.evaluate_file_children(file, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates only the selected node's children from an SVG/XML file under a graphics element.
|
|
# File 'lib/sevgi/derender.rb', line 28
|
Instance Method Details
#decompile(content, id: nil) ⇒ Sevgi::Derender::Node
Converts SVG/XML content into a derender node.
102 |
# File 'lib/sevgi/derender.rb', line 102 def decompile(content, id: nil) = Document.new(content).decompile(id) |
#decompile_file(file, id: nil) ⇒ Sevgi::Derender::Node
Converts an SVG/XML file into a derender node.
110 |
# File 'lib/sevgi/derender.rb', line 110 def decompile_file(file, id: nil) = Document.load_file(file).decompile(id) |
#derender(content, id: nil) ⇒ String
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Unsafe bare Ruby names are emitted through the explicit Element DSL word.
Converts SVG/XML content into Sevgi DSL Ruby source.
120 |
# File 'lib/sevgi/derender.rb', line 120 def derender(content, id: nil) = Document.new(content).decompile(id).derender |
#derender_file(file, id: nil) ⇒ String
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Unsafe bare Ruby names are emitted through the explicit Element DSL word.
Converts an SVG/XML file into Sevgi DSL Ruby source.
131 |
# File 'lib/sevgi/derender.rb', line 131 def derender_file(file, id: nil) = Document.load_file(file).decompile(id).derender |
#evaluate(content, element, id: nil) ⇒ Sevgi::Graphics::Element?
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates SVG/XML content under a graphics element, including the selected node.
141 |
# File 'lib/sevgi/derender.rb', line 141 def evaluate(content, element, id: nil) = Document.new(content).decompile(id).evaluate(element) |
#evaluate_children(content, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates only the selected node's children under a graphics element.
150 |
# File 'lib/sevgi/derender.rb', line 150 def evaluate_children(content, element, id: nil) = Document.new(content).decompile(id).evaluate_children(element) |
#evaluate_file(file, element, id: nil) ⇒ Sevgi::Graphics::Element?
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates an SVG/XML file under a graphics element, including the selected node.
161 |
# File 'lib/sevgi/derender.rb', line 161 def evaluate_file(file, element, id: nil) = Document.load_file(file).decompile(id).evaluate(element) |
#evaluate_file_children(file, element, id: nil) ⇒ Array<Sevgi::Graphics::Element>
Namespace-aware dispatch preserves ordinary foreign/qualified nodes and nested SVG elements.
Evaluates only the selected node's children from an SVG/XML file under a graphics element.
171 172 173 |
# File 'lib/sevgi/derender.rb', line 171 def evaluate_file_children(file, element, id: nil) Document.load_file(file).decompile(id).evaluate_children(element) end |