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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a270ae844deeec964e0cd1640bdc4059d527cf07
4
- data.tar.gz: f2868216812e5f03a561c3e09fb57d1120448013
3
+ metadata.gz: fa2dfef79d77d41522a15a8209df3eb6ee3fed4d
4
+ data.tar.gz: cfc159194cd8606d67df6dcaf6e42f74b2a709bf
5
5
  SHA512:
6
- metadata.gz: 6ca9bb390f624ad36a0c1c505c0ae5535752ed4aa9d4f764f43ce28f6f392b3dd79139176607adabe427c513c755d87486ef8ea59e80b3048864e38744444998
7
- data.tar.gz: 0eece75c65eee8570b7dd5035a4b923e18834d2ada3e61496db80cea62897fd249d6d0a0426db59d4d38575efb6b4f9d81eb6daee481eba8f0d71a38db07428d
6
+ metadata.gz: c1ba0a6ec4a1f559067c90b894b75191c1283b73bb5e8546e162ad2f4e86e360f7eaf10982cf1969b5338f45d51e90b48f283b5b8ca7d11f7836faa4baf12416
7
+ data.tar.gz: b761181a2c494dba2fa56c55fc3e1ba12504c40db4eb539d2648c9b215eb66f4b34d9d4e5a6848c52227916e4f0ea4bf2e9837b29b343ed8951bd4b9a0592921
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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 = build_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 build_xslt()
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.7
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
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE1MDkxMDE3MjMzMloXDTE2MDkwOTE3MjMzMlowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAMLr2aPSzSNx5j3BITddVtIlM1LZuVukOitbe4i11On3Lav/L0akubHd+BGz
19
- RdHdp3MssY3hb/EP/ueUlluc9OMQoJuBVKqtcLirsSUUnh4TVoKgixMP4jpJ3/5v
20
- 6dIy8vdnatmE5Q6UMNqfIx1Nk2lfMOS4KwGAOuauSrheiB9L3aNtZtB49umbVon+
21
- 2DfuAj3w1qvm+BVb7FssXJT98BA1rBjw/blRJ1kURKRpJjgsKHGWPYMjOTvTJMLQ
22
- RYcrEdYXjU2PyO4Bzb2ixgzQsxpLdCg3yT5Psh8niClYHqUw8Vml3xsVoAXZARjT
23
- 65ammqagW2LPg+eqHr1Fvy5bjc8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
- DwQEAwIEsDAdBgNVHQ4EFgQUZqY7Mpuhmkr7l2iLIagPN4jvSyAwJgYDVR0RBB8w
25
- HYEbZ2VtbWF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ToIZ5rhuC9mInqGZK+q4
22
+ sBNLmOcTQTtYQuQpAgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
23
+ HQYDVR0OBBYEFGZd1LL9JiYN2wNoiFaJdRDjHnldMCYGA1UdEQQfMB2BG2dlbW1h
24
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
25
+ ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAGOYM7OFVB33IhjZnyja
26
+ UFkBxfPbE7edH3rXWM8cNu5+eWMUmXuVMB3dvId5wsVWi2bYdyiFXBYTajO5YuwQ
27
+ P49hT74+qlGxXQG7AvjOwbPcqLZd8rWeT/cNp7vvr46YpybkC/AWunPwGB4RGCva
28
+ nkdE27U1HOYHM5NngE/Ytd+WDyh6y9dcK1rGySXOPAo+wAsLCQWjMXzOD8LLfc4p
29
+ gYBiqH2BeKU0VXP6fkHI2W1xMtEc8iomSIVYz604Nsk3A5FF1JkabmgFKX8NMjEh
30
+ CkZ6qkMMl64IWv3hWbm6Ou/TqxtUMBsYooo0jjYEmD1AqJeGwV4icnKKmyh4uZ5C
31
+ 80c=
33
32
  -----END CERTIFICATE-----
34
- date: 2016-03-20 00:00:00.000000000 Z
33
+ date: 2018-01-19 00:00:00.000000000 Z
35
34
  dependencies:
36
35
  - !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.5'
41
+ version: '1.7'
43
42
  - - ">="
44
43
  - !ruby/object:Gem::Version
45
- version: 1.5.34
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.5'
51
+ version: '1.7'
53
52
  - - ">="
54
53
  - !ruby/object:Gem::Version
55
- version: 1.5.34
54
+ version: 1.7.28
56
55
  description:
57
- email: james@r0bertson.co.uk
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.4.8
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