recordx-xslt 0.1.3 → 0.1.4
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/recordx-xslt.rb +34 -9
- metadata +21 -19
- 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: 7c98f1985544f6404511ad3bf75b2db83a4cfd9c
|
4
|
+
data.tar.gz: c55ddcb0d1c38eb8900d3f9172efe23efa607f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a11f3fba9added4ad4057d796315f4f46bd328b2f540cb3fc1b10ef2bb1d1c07e91f88086e6a29b20496936a25110fa2bf56a309d873b86164c31ae471e3a707
|
7
|
+
data.tar.gz: 0aaeb04fece5e16ed1277965916e8a295d38abfbe5c0419bb83eef10a1fce59a19ad7ef55b1736ede3d352be1d08d379ef4be395459b5d4685bc75120d7f1c2e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/recordx-xslt.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# file: recordx-xslt.rb
|
4
4
|
|
@@ -23,15 +23,20 @@ HEADER
|
|
23
23
|
a_element = @schema.split('/').map{|x| x[/\w+/]}
|
24
24
|
|
25
25
|
a_html = @xslt_schema.split('/').map do |x|
|
26
|
-
|
27
|
-
name = x[/\w+/]
|
28
|
-
children = ($')[/^[\(\[]([^\)\]]+)[\)\]]$/,1]
|
29
|
-
list = children.split(',').map {|y| y.split(':') } if children
|
30
26
|
|
27
|
+
result = x.match(/(\w+)(?:[\(\[]([^\]\)]+)[\]\)])?(.*)/)
|
28
|
+
name, children, remaining = result.captures if result
|
29
|
+
|
30
|
+
#children = ($')[/^[\(\[]([^\)\]]+)[\)\]]$/,1]
|
31
|
+
|
32
|
+
list = children.split(',').map {|y| y.split(':',2)} if children
|
33
|
+
|
34
|
+
#[name, list, remaining]
|
31
35
|
[name, list]
|
32
36
|
end
|
33
37
|
|
34
38
|
a = a_element.zip(a_html).map.with_index do |a,i|
|
39
|
+
|
35
40
|
out = []
|
36
41
|
tag = a.shift
|
37
42
|
field = i > 0 ? 'records/' + tag : tag
|
@@ -45,7 +50,7 @@ HEADER
|
|
45
50
|
out << " <%s>\n" % a.first
|
46
51
|
out << " <xsl:apply-templates select='summary'/>\n"
|
47
52
|
out << " <xsl:apply-templates select='records'/>\n"
|
48
|
-
out << "
|
53
|
+
out << " </%s>\n" % a.first
|
49
54
|
out << "</xsl:template>\n\n"
|
50
55
|
out << "<xsl:template match='%s/summary'>\n" % [tag]
|
51
56
|
out << "</xsl:template>\n\n"
|
@@ -64,14 +69,17 @@ HEADER
|
|
64
69
|
out = []
|
65
70
|
|
66
71
|
unless a.first.is_a? Array then
|
72
|
+
|
67
73
|
tag = a.shift
|
74
|
+
|
68
75
|
out << indent + "<%s>\n" % tag
|
69
76
|
out << indent + " <xsl:apply-templates select='summary'/>\n"
|
70
|
-
out << indent + "
|
77
|
+
out << indent + "</%s>\n" % tag
|
71
78
|
out << "</xsl:template>\n\n"
|
72
79
|
out << "<xsl:template match='%s/summary'>\n" % [prev_tag]
|
73
80
|
|
74
81
|
a.flatten!(1)
|
82
|
+
|
75
83
|
if a.last.is_a? Array then
|
76
84
|
out << scan_e(a, tag, indent + ' ')
|
77
85
|
else
|
@@ -79,8 +87,25 @@ HEADER
|
|
79
87
|
end
|
80
88
|
|
81
89
|
else
|
82
|
-
a.map do |
|
83
|
-
|
90
|
+
a.map do |target,src|
|
91
|
+
|
92
|
+
if src then
|
93
|
+
|
94
|
+
start_tag = target.gsub(/\s*\{[^\}]+\}/) do |attr|
|
95
|
+
|
96
|
+
' ' + attr.scan(/(\w+[:=]\s*(?:\w+|["'][^"']+["'])),?\s*/)\
|
97
|
+
.map {|x| x.first.split(/\s*[:=]\s*/) }\
|
98
|
+
.map {|attr, val| "%s='%s'" % [attr,val.gsub(/^["']|["']$/,'')]}\
|
99
|
+
.join(', ')
|
100
|
+
end
|
101
|
+
|
102
|
+
end_tag = target.gsub(/\s*{.*/,'')
|
103
|
+
|
104
|
+
out << indent + "<%s><xsl:value-of select='%s'/></%s>\n" %
|
105
|
+
[start_tag,src,end_tag]
|
106
|
+
else
|
107
|
+
out << indent + "<%s></%s>\n" % ([target] * 2)
|
108
|
+
end
|
84
109
|
end
|
85
110
|
end
|
86
111
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recordx-xslt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,26 +10,28 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
-
|
15
|
+
8ixkARkWAmV1MB4XDTE0MDkwNjA5NTg0MFoXDTE1MDkwNjA5NTg0MFowSDESMBAG
|
16
16
|
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
17
|
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
+
uoX7MOe9OncggQ==
|
31
33
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
34
|
+
date: 2014-09-06 00:00:00.000000000 Z
|
33
35
|
dependencies: []
|
34
36
|
description:
|
35
37
|
email: james@r0bertson.co.uk
|
@@ -50,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
52
|
requirements:
|
51
53
|
- - ">="
|
52
54
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
55
|
+
version: 2.1.2
|
54
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
57
|
requirements:
|
56
58
|
- - ">="
|
@@ -58,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
60
|
version: '0'
|
59
61
|
requirements: []
|
60
62
|
rubyforge_project:
|
61
|
-
rubygems_version: 2.
|
63
|
+
rubygems_version: 2.2.2
|
62
64
|
signing_key:
|
63
65
|
specification_version: 4
|
64
66
|
summary: recordx-xslt
|
metadata.gz.sig
CHANGED
Binary file
|