recordx-xslt 0.1.6 → 0.2.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
- SHA1:
3
- metadata.gz: 3f50127db7d7330d4a77ff96bedcba3e3625e44a
4
- data.tar.gz: 6f3c021c8475d9e0ee3c73015e8250353ef4084d
2
+ SHA256:
3
+ metadata.gz: 531d10bd42deb16c83caf1d4f3beb6da9e1ec6cb9f88281ce7b93737c1dfc0b0
4
+ data.tar.gz: a4d34afe21106986a29a2de16c6d3d25df816da6b8cec0154b85394711e0095e
5
5
  SHA512:
6
- metadata.gz: 5c59375f1e232efbbdbf5b952c26a78cb0a80dada35cf4cd1aed4405556a43ed5161b62dae3f5cda5d1b3487c7b223293b252237f3cad9345177bd00055d0718
7
- data.tar.gz: a4939c50c12fdd9165f0f1bb8c190bcdbecd11e1b7e25c9d52dc5b3f432f84dff39712e4cc4aeab9f45e6b4437410be9daae4177b2725cca1fb43daa89d0e24d
6
+ metadata.gz: f6a3eb1435df8e8d89624d79ea8ec08e04df0aca249056e84f5555e449a7a47f290267a9b9144113fcf9b5e8489822121d7da7d84188a7e7a05f767069e66208
7
+ data.tar.gz: 1f273f78518584972476dddbebc3b97e72d00d4a7f1cc5173e0416995b52887d57b9d60b226aebd4385b100d8269b3aff801f825955d7a8db8c176b6fffb5772
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/recordx-xslt.rb CHANGED
@@ -2,13 +2,18 @@
2
2
 
3
3
  # file: recordx-xslt.rb
4
4
 
5
+ require 'c32'
6
+
7
+
5
8
  class RecordxXSLT
9
+ using ColouredText
6
10
 
7
11
  attr_accessor :schema, :xslt_schema
8
12
 
9
- def initialize(options={})
10
- o = {schema: '', xslt_schema: ''}.merge(options)
11
- @schema, @xslt_schema = o.values
13
+ def initialize(schema: '', xslt_schema: '', debug: false)
14
+
15
+ @schema, @xslt_schema, @debug = schema, xslt_schema, debug
16
+
12
17
  end
13
18
 
14
19
  def to_xslt()
@@ -23,6 +28,7 @@ HEADER
23
28
  a_element = @schema.split('/').map{|x| x[/\w+/]}
24
29
 
25
30
  @xslt_schema = build_xslt_schema(@schema) if @xslt_schema.empty?
31
+ puts ('@xslt_schema: ' + @xslt_schema.inspect).debug if @debug
26
32
 
27
33
  a_html = @xslt_schema.split('/').map do |x|
28
34
 
@@ -34,6 +40,8 @@ HEADER
34
40
 
35
41
  [name, list]
36
42
  end
43
+
44
+ puts ('a_html: ' + a_html.inspect).debug if @debug
37
45
 
38
46
  a = a_element.zip(a_html).map.with_index do |a,i|
39
47
 
@@ -87,6 +95,7 @@ HEADER
87
95
 
88
96
  out << indent + "<%s>\n" % tag
89
97
  out << indent + " <xsl:apply-templates select='summary'/>\n"
98
+ out << indent + " <xsl:apply-templates select='records'/>\n"
90
99
  out << indent + "</%s>\n" % tag
91
100
  out << "</xsl:template>\n\n"
92
101
  out << "<xsl:template match='%s/summary'>\n" % [prev_tag]
@@ -101,21 +110,35 @@ HEADER
101
110
 
102
111
  else
103
112
  a.map do |target,src|
113
+
114
+ if @debug then
115
+ puts 'target: ' + target.inspect
116
+ puts 'src: ' + src.inspect
117
+ end
104
118
 
105
119
  if src then
106
120
 
107
- start_tag = target.gsub(/\s*\{[^\}]+\}/) do |attr|
108
-
109
- ' ' + attr.scan(/(\w+[:=]\s*(?:\w+|["'][^"']+["'])),?\s*/)\
110
- .map {|x| x.first.split(/\s*[:=]\s*/) }\
111
- .map {|attr, val| "%s='%s'" % [attr,val.gsub(/^["']|["']$/,'')]}\
112
- .join(', ')
121
+ if target[0] == '@' then
122
+
123
+ target.slice!(0,1)
124
+ out << indent + "<xsl:attribute name='#{target}'>" +
125
+ "<xsl:value-of select='#{src}'/></xsl:attribute>\n"
126
+ else
127
+
128
+ start_tag = target.gsub(/\s*\{[^\}]+\}/) do |attr|
129
+
130
+ ' ' + attr.scan(/(\w+[:=]\s*(?:\w+|["'][^"']+["'])),?\s*/)\
131
+ .map {|x| x.first.split(/\s*[:=]\s*/) }\
132
+ .map {|attr, val| "%s='%s'" % [attr,val.gsub(/^["']|["']$/,'')]}\
133
+ .join(', ')
134
+ end
135
+
136
+ end_tag = target.gsub(/\s*{.*/,'')
137
+
138
+ out << indent + "<%s><xsl:value-of select='%s'/></%s>\n" %
139
+ [start_tag,src,end_tag]
113
140
  end
114
141
 
115
- end_tag = target.gsub(/\s*{.*/,'')
116
-
117
- out << indent + "<%s><xsl:value-of select='%s'/></%s>\n" %
118
- [start_tag,src,end_tag]
119
142
  else
120
143
  out << indent + "<%s></%s>\n" % ([target] * 2)
121
144
  end
@@ -125,4 +148,4 @@ HEADER
125
148
  out
126
149
  end
127
150
 
128
- end
151
+ end
data.tar.gz.sig CHANGED
@@ -1,3 +1,4 @@
1
- ���`(7/?V��#���9|�C�(�,( ��+:����gѣOiO|�#(��uC����dggN>��
2
- �摢Jg��Gq�ՠB���zhoe0��S�Z~
3
- i��������� ��d&�[l�t��S}[@���Ѡ6BY->�<�L���LHB���_ԁ��
1
+ ���xc[� =���o����rz,�ݦY�C`[W�����h��:��IYOak*�Ტ̆�|��"��1�4�/Inۇ�y�݌�C�z�� p��AE[(�T'X
2
+ Yoaco>�h�3��<�7S��Esh�KX�k��r������vi��jwg����=Y�#��n/���
3
+ g����ePz}��ۓ���f����+���������jZ���?Pj����ꛍ�Ρx~]o�+L
4
+ ǧg|w�H�bG�RNw��A�ip�F\6�biʳ
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.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,29 +10,53 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvY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VtbWFzdGVyQGphbWVzcm9iZXJ0
27
+ c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEARR1vvPW/CdQ6qXvLk46T+AFpbCDA4QwPiBakxA22
29
+ 7nwIcOrvDVNM6XrU6PT74HvQbAhTISalTSVs+elZmd1T4ZIDHTUgTOnWJkvsrbfj
30
+ R7HNxC/N8Glw3Fi9jd78KZZUmXQGa1zP9RVBgvcapCC1ErOGmsqaPE22xgpyFpTF
31
+ tlSGNn9hCXjuP4yTCp1TQFThMyHlpGERBwANqYKon4IVGSBIp4wzO2ZfrztE004W
32
+ mZYtrdBOryQC7J4CsVz5na3yoqD/oGtIv5Lc5XtFEZsE044SFz9bLnNu/DRZpvrm
33
+ jxHmhBmdy/nmdRBbqy/cLUWUkM6d5qaXFzDhyA3RptS/xJCGerU7pWNSJje/YwDp
34
+ VKfTPTiy+M1DHyo6ywCg1NnLQKR+dVTklWn0OoDQoKdHnXiWZxgTll2TWeh4/+j9
35
+ QD/5hdIe2Jm8+F1UmAR0o297oLqfSF7FANUbtFo/ogklVSFkMOeAdOaa4IklWdeF
36
+ 924Z2hq1Gp9hvWrwijmYoIUZ
33
37
  -----END CERTIFICATE-----
34
- date: 2017-09-10 00:00:00.000000000 Z
35
- dependencies: []
38
+ date: 2019-07-30 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: c32
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.2.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.2'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.2.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.2'
36
60
  description:
37
61
  email: james@jamesrobertson.eu
38
62
  executables: []
@@ -59,9 +83,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
83
  - !ruby/object:Gem::Version
60
84
  version: '0'
61
85
  requirements: []
62
- rubyforge_project:
63
- rubygems_version: 2.6.8
86
+ rubygems_version: 3.0.1
64
87
  signing_key:
65
88
  specification_version: 4
66
- summary: recordx-xslt
89
+ summary: Transforms a RecordX type of schema with an XSLT schema mapping to generate
90
+ an XSLT document.
67
91
  test_files: []
metadata.gz.sig CHANGED
Binary file