dx_sliml 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/dx_sliml.rb +38 -3
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c805606cbc5ba1c65b3048fb4f9c0ff4d105357
|
4
|
+
data.tar.gz: 34bddec3ecb0311301071c077c51143b2219c2d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfdab4aca28f7faab2ea93fb02801df9044924eeff063285073084f3b8f988387dc5c4b72b7c86b604e86e8af96b36757acd55f5aa2c42f1b6d0c15fd5b05a91
|
7
|
+
data.tar.gz: aafd7154ec3e73df9fe53f244963a653e239b2b894d178add02eae5329de9edac64d05f405146ba24bc3997beb0f4b9be159ea2c38f67e304f475fae74730f6c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/dx_sliml.rb
CHANGED
@@ -9,9 +9,30 @@ class DxSliml
|
|
9
9
|
|
10
10
|
attr_reader :to_xslt, :to_html
|
11
11
|
|
12
|
-
def initialize(sliml, dx)
|
12
|
+
def initialize(sliml=nil, dynarex=nil, dx: dynarex, fields: nil)
|
13
13
|
|
14
|
-
|
14
|
+
|
15
|
+
if sliml.nil? and fields.nil? then
|
16
|
+
|
17
|
+
if dx then
|
18
|
+
|
19
|
+
@dx = dx.is_a?(Dynarex) ? dx : Dynarex.new(dx)
|
20
|
+
# fetch the fields from the schema
|
21
|
+
fields = @dx.schema[/\(([^\)]+)/,1].split(/,\s/)
|
22
|
+
|
23
|
+
else
|
24
|
+
raise 'RxSliml: please enter a sliml string or an array of fields'
|
25
|
+
end
|
26
|
+
|
27
|
+
else
|
28
|
+
@dx = dx.is_a?(Dynarex) ? dx : Dynarex.new(dx)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
sliml ||= create_sliml(fields)
|
34
|
+
@sliml = sliml
|
35
|
+
|
15
36
|
|
16
37
|
sliml.gsub!(/\{[^\}]+/) do |x|
|
17
38
|
x.gsub(/["']?(\S*)\$(\w+)([^"']*)["']?/,'\'\1{\2}\3\'')
|
@@ -28,6 +49,12 @@ class DxSliml
|
|
28
49
|
|
29
50
|
end
|
30
51
|
|
52
|
+
def to_sliml()
|
53
|
+
|
54
|
+
@sliml
|
55
|
+
|
56
|
+
end
|
57
|
+
|
31
58
|
|
32
59
|
private
|
33
60
|
|
@@ -88,5 +115,13 @@ class DxSliml
|
|
88
115
|
|
89
116
|
xml2.sub('<rec_template/>', @recxsl)
|
90
117
|
end
|
118
|
+
|
119
|
+
def create_sliml(fields)
|
120
|
+
|
121
|
+
lines = ['dl']
|
122
|
+
lines << fields.map {|field| " dt %s:\n dd $%s\n" % ([field.to_s]*2) }
|
123
|
+
lines.join("\n")
|
124
|
+
|
125
|
+
end
|
91
126
|
|
92
|
-
end
|
127
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dx_sliml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
riqQvKCPf2pAclvY7x0rzJmfVDI5Puxxi7MLiknObzzMYR3lV9jHqYf9GUX+gZYo
|
32
32
|
T+1jKCori2GnHw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-
|
34
|
+
date: 2015-11-01 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex
|
metadata.gz.sig
CHANGED
Binary file
|