dx_sliml 0.1.7 → 0.1.8
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.tar.gz.sig +0 -0
- data/lib/dx_sliml.rb +40 -4
- metadata +27 -28
- 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: fa2dfef79d77d41522a15a8209df3eb6ee3fed4d
|
4
|
+
data.tar.gz: cfc159194cd8606d67df6dcaf6e42f74b2a709bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ba0a6ec4a1f559067c90b894b75191c1283b73bb5e8546e162ad2f4e86e360f7eaf10982cf1969b5338f45d51e90b48f283b5b8ca7d11f7836faa4baf12416
|
7
|
+
data.tar.gz: b761181a2c494dba2fa56c55fc3e1ba12504c40db4eb539d2648c9b215eb66f4b34d9d4e5a6848c52227916e4f0ea4bf2e9837b29b343ed8951bd4b9a0592921
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dx_sliml.rb
CHANGED
@@ -7,7 +7,7 @@ require 'dynarex'
|
|
7
7
|
|
8
8
|
class DxSliml
|
9
9
|
|
10
|
-
attr_reader :to_xslt, :to_html
|
10
|
+
attr_reader :to_xslt, :to_html, :to_xml
|
11
11
|
|
12
12
|
def initialize(sliml=nil, dynarex=nil, dx: dynarex, fields: nil)
|
13
13
|
|
@@ -32,7 +32,6 @@ class DxSliml
|
|
32
32
|
|
33
33
|
sliml ||= create_sliml(fields)
|
34
34
|
@sliml = sliml
|
35
|
-
|
36
35
|
|
37
36
|
sliml.gsub!(/\{[^\}]+/) do |x|
|
38
37
|
x.gsub(/["']?(\S*)\$(\w+)([^"']*)["']?/,'\'\1{\2}\3\'')
|
@@ -42,11 +41,13 @@ class DxSliml
|
|
42
41
|
|
43
42
|
@recxsl = xml.gsub(/\$(\w+)/, '<xsl:value-of select="\1"/>')
|
44
43
|
|
45
|
-
@to_xslt =
|
44
|
+
@to_xslt = build_html_xslt
|
45
|
+
xml_xslt = build_xml_xslt
|
46
46
|
|
47
47
|
#jr190316 xslt = Nokogiri::XSLT(@to_xslt)
|
48
48
|
#jr190316 @to_html = xslt.transform(Nokogiri::XML(@dx.to_xml))
|
49
49
|
@to_html = Rexslt.new(@to_xslt, dx.to_xml).to_s
|
50
|
+
@to_xml = Rexslt.new(xml_xslt, dx.to_xml).to_xml
|
50
51
|
|
51
52
|
end
|
52
53
|
|
@@ -59,7 +60,7 @@ class DxSliml
|
|
59
60
|
|
60
61
|
private
|
61
62
|
|
62
|
-
def
|
63
|
+
def build_html_xslt()
|
63
64
|
|
64
65
|
schema = @dx.schema
|
65
66
|
rootname, recname = schema.split('/').map{|x| x[/\w+/]}
|
@@ -117,6 +118,41 @@ class DxSliml
|
|
117
118
|
xml2.sub('<rec_template/>', @recxsl)
|
118
119
|
end
|
119
120
|
|
121
|
+
def build_xml_xslt()
|
122
|
+
|
123
|
+
schema = @dx.schema
|
124
|
+
rootname, recname = schema.split('/').map{|x| x[/\w+/]}
|
125
|
+
|
126
|
+
xml = RexleBuilder.new
|
127
|
+
raw_a = xml.xsl_stylesheet(xmlns_xsl: \
|
128
|
+
"http://www.w3.org/1999/XSL/Transform", version: "1.0") do
|
129
|
+
xml.xsl_output(method: "xml", indent: "yes", \
|
130
|
+
:"omit-xml-declaration" => "yes")
|
131
|
+
|
132
|
+
xml.xsl_template(match: rootname) do
|
133
|
+
|
134
|
+
xml.xsl_apply_templates(select: 'records/' + recname)
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
xml.xsl_template(match: 'records/' + recname) do
|
140
|
+
|
141
|
+
xml.rec_template
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
xml2 = Rexle.new(raw_a).xml(pretty: true).gsub('xsl_apply_templates',\
|
148
|
+
'xsl:apply-templates').gsub('xsl_value_of','xsl:value-of').\
|
149
|
+
gsub('xsl_template','xsl:template').\
|
150
|
+
gsub('xmlns_xsl','xmlns:xsl').gsub('xsl_for_each','xsl:for-each').\
|
151
|
+
gsub('xsl_','xsl:')
|
152
|
+
|
153
|
+
xml2.sub('<rec_template/>', @recxsl)
|
154
|
+
end
|
155
|
+
|
120
156
|
def create_sliml(fields)
|
121
157
|
|
122
158
|
lines = ['dl']
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,27 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
T+1jKCori2GnHw==
|
13
|
+
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwMTE5MTEyODE5WhcN
|
15
|
+
MTkwMTE5MTEyODE5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+envf
|
17
|
+
sxBbBs1OgvQftd4kHkWLFu/hXuNL7Pt62ofRaUAIi06taT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
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: dynarex
|
@@ -39,22 +38,22 @@ dependencies:
|
|
39
38
|
requirements:
|
40
39
|
- - "~>"
|
41
40
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
41
|
+
version: '1.7'
|
43
42
|
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
44
|
+
version: 1.7.28
|
46
45
|
type: :runtime
|
47
46
|
prerelease: false
|
48
47
|
version_requirements: !ruby/object:Gem::Requirement
|
49
48
|
requirements:
|
50
49
|
- - "~>"
|
51
50
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
51
|
+
version: '1.7'
|
53
52
|
- - ">="
|
54
53
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
54
|
+
version: 1.7.28
|
56
55
|
description:
|
57
|
-
email: james@
|
56
|
+
email: james@jamesrobertson.eu
|
58
57
|
executables: []
|
59
58
|
extensions: []
|
60
59
|
extra_rdoc_files: []
|
@@ -80,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
79
|
version: '0'
|
81
80
|
requirements: []
|
82
81
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.13
|
84
83
|
signing_key:
|
85
84
|
specification_version: 4
|
86
85
|
summary: Uses a Sliml like format to transform a Dynarex document to HTML.
|
metadata.gz.sig
CHANGED
Binary file
|