zenml 1.4.0 → 1.5.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/source/zenml.rb +1 -1
- data/source/zenml/converter.rb +13 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e7d6578ba04c84444242c022ecd32c186d420aadb60f5de4e8a73ce687f7b1
|
4
|
+
data.tar.gz: e4f4c0388727e80cbced76e9fd31b674ea21958190a2ddbcdfc65d4018282782
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f627b12002854fd6c58e50d388e317fde41197da73a9de2934f36963c0b8672856031240c7212fdc278175c7e52f27139bbd565bc98e86cef3d580fa16776a
|
7
|
+
data.tar.gz: d526a1a9a75f6467cb75385285a5f2b7936174d034a0003f685b47f1a07eda8dcf8418c2a9f55103c0ad20ab0b2f7462eb1f3893e6b343c07f75448e1cb35b9d
|
data/source/zenml.rb
CHANGED
data/source/zenml/converter.rb
CHANGED
@@ -11,8 +11,9 @@ class ZenithalConverter
|
|
11
11
|
SINGLETON_NAMES = ["br", "img", "hr", "meta", "input", "embed", "area", "base", "link"]
|
12
12
|
|
13
13
|
attr_reader :document
|
14
|
-
|
15
|
-
|
14
|
+
attr_accessor :configs
|
15
|
+
attr_accessor :variables
|
16
|
+
attr_accessor :functions
|
16
17
|
|
17
18
|
def initialize(document, type = :node)
|
18
19
|
@document = document
|
@@ -23,13 +24,14 @@ class ZenithalConverter
|
|
23
24
|
@functions = {}
|
24
25
|
@default_element_template = lambda{|_| empty_nodes}
|
25
26
|
@default_text_template = lambda{|_| empty_nodes}
|
27
|
+
reset_variables
|
26
28
|
end
|
27
29
|
|
28
30
|
# Changes the document to be converted.
|
29
|
-
# Note that this method initialises the
|
31
|
+
# Note that this method initialises the variable hash, but not the configuration hash.
|
30
32
|
def update(document)
|
31
33
|
@document = document
|
32
|
-
|
34
|
+
reset_variables
|
33
35
|
end
|
34
36
|
|
35
37
|
def convert(initial_scope = "")
|
@@ -137,7 +139,13 @@ class ZenithalConverter
|
|
137
139
|
return (@type == :text) ? "" : Nodes[]
|
138
140
|
end
|
139
141
|
|
140
|
-
|
142
|
+
# Override this method to customise how to initialise the variable hash.
|
143
|
+
# This method is called when creating or updating an instance.
|
144
|
+
def reset_variables
|
145
|
+
@variables = {}
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns a simple converter that converts an XML document to the equivalent HTML document.
|
141
149
|
def self.simple_html(document)
|
142
150
|
converter = ZenithalConverter.new(document, :text)
|
143
151
|
converter.add([//], [""]) do |element|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zenml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ziphil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
This gem serves a tool for parsing a document written in ZenML, an alternative new syntax for XML, to an XML node tree.
|