zenml 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51365e366adfa0733bc6fd6ef3a608bb6303ed379aa1d4b71794ce279818ae89
4
- data.tar.gz: e8c724e3e2e257eacdebf8e685f67e4610bf74c55a8f536bc9a0dad7a4cbd776
3
+ metadata.gz: e7e7d6578ba04c84444242c022ecd32c186d420aadb60f5de4e8a73ce687f7b1
4
+ data.tar.gz: e4f4c0388727e80cbced76e9fd31b674ea21958190a2ddbcdfc65d4018282782
5
5
  SHA512:
6
- metadata.gz: 84b1ffa29a37dde0b4cdc121d876b80c8f7c9cf9a6a84201b37fe5b0ce67a22cc9e2f390c06b657be8814cc60bdcf90dd1a69dad225a944190a0de43f563f948
7
- data.tar.gz: 3253f779d41e3810de4a9fef4c8daae49a4025ed6ee8ad0dff56f635d35a20a4903c5594c5d958d68f22d776df90dc06f8a24cca0767a00759dbab379721a9e9
6
+ metadata.gz: 45f627b12002854fd6c58e50d388e317fde41197da73a9de2934f36963c0b8672856031240c7212fdc278175c7e52f27139bbd565bc98e86cef3d580fa16776a
7
+ data.tar.gz: d526a1a9a75f6467cb75385285a5f2b7936174d034a0003f685b47f1a07eda8dcf8418c2a9f55103c0ad20ab0b2f7462eb1f3893e6b343c07f75448e1cb35b9d
data/source/zenml.rb CHANGED
@@ -6,7 +6,7 @@ require 'zenml/utility'
6
6
 
7
7
  module Zenithal
8
8
 
9
- VERSION = "1.4.0"
9
+ VERSION = "1.5.0"
10
10
 
11
11
  require 'zenml/error'
12
12
  require 'zenml/reader'
@@ -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
- attr_reader :configs
15
- attr_reader :variables
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 configuration hash, but not the variable hash.
31
+ # Note that this method initialises the variable hash, but not the configuration hash.
30
32
  def update(document)
31
33
  @document = document
32
- @configs = {}
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
- ## Returns a simple converter that converts an XML document to the equivalent HTML document.
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.0
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-17 00:00:00.000000000 Z
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.