dynarex 1.7.1 → 1.7.2

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: f159d50429b47dd811e608d5e037e28ce3b65087
4
- data.tar.gz: 223fe64b26299cf573c3e3822e2f0f2c1f6c59bb
3
+ metadata.gz: 497e98c0cc9e83321ab14a3962246040ecd26a96
4
+ data.tar.gz: aebacc2dd1ff7fffcfd0f2b65c0fef193ab728f1
5
5
  SHA512:
6
- metadata.gz: 15d3b9320e169a92e8273f81079564172bacd85e581a1a1d19aaa577fd394ca7e64cea43aaceebcb44642bd9be01a26f41ee14fbac37c8238148e7a50f3daf5c
7
- data.tar.gz: 76ef70d56f3c545f18453f3882ca5d0a889a1e80c3858f7c807ddd0c60dc53090b58c31447007232e716ddf0acacd863628a8c29bd9e99e60f637cd207dbe4a2
6
+ metadata.gz: 18feda8c47b940955190d4c03705e93cfeb068fa0eec3e79b97320777cb8842f0d994d5f14f4147467b8dac310d5aa1b0f9f5bba6fa24ef15a38b798620fdb44
7
+ data.tar.gz: c7058361ee9ab63498f9d0c7d589dc4a5896a2b6a67d6744a4a46576f22df7fb720952fd05235f99a6e3a53c22728b4dd4d33abf2b4572b43b11085490e815ee
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/dynarex.rb CHANGED
@@ -266,11 +266,8 @@ EOF
266
266
  xslt_format = a.join
267
267
 
268
268
  xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
269
- #jr100316 xslt = Nokogiri::XSLT(xsl_buffer)
270
- #jr100316 out = xslt.transform(Nokogiri::XML(@doc.to_s))
271
269
  out = Rexslt.new(xsl_buffer, @doc).to_s
272
270
 
273
- #jr100316 header + "\n--+\n" + out.text
274
271
  header + "\n--+\n" + out
275
272
  elsif self.summary[:rawdoc_type] == 'sectionx' then
276
273
 
@@ -282,13 +279,9 @@ EOF
282
279
 
283
280
  xslt_format = a.join
284
281
 
285
- xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
286
-
287
- #jr100316 xslt = Nokogiri::XSLT(xsl_buffer)
288
- #jr100316 out = xslt.transform(Nokogiri::XML(@doc.to_s))
282
+ xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
289
283
  out = Rexslt.new(xsl_buffer, @doc).to_s
290
284
 
291
- #jr100316 header + "--#\n" + out.text
292
285
  header + "--#\n" + out
293
286
 
294
287
  elsif self.delimiter.length > 0 then
@@ -306,21 +299,10 @@ EOF
306
299
  .gsub(/\[!(\w+)\]/, '<xsl:value-of select="\1"/>')
307
300
 
308
301
  xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
309
- #jr100316 xslt = Nokogiri::XSLT(xsl_buffer)
310
302
 
311
- #jr100316 out = xslt.transform(Nokogiri::XML(self.to_xml))
312
303
  out = Rexslt.new(xsl_buffer, @doc).to_s
313
- #jr100316 header + "\n" + out.text
314
304
  header + "\n" + out
315
305
  end
316
-
317
- #xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
318
- #xslt = Nokogiri::XSLT(xsl_buffer)
319
- #out = xslt.transform(Nokogiri::XML(@doc.to_s))
320
- #jr250811 puts 'xsl_buffer: ' + xsl_buffer
321
- #jr250811 puts 'doc_to_s: ' + @doc.to_s
322
- #out.text
323
- #jr231211 Rexslt.new(xsl_buffer, @doc.to_s).to_s
324
306
 
325
307
  end
326
308
 
@@ -485,6 +467,36 @@ EOF
485
467
  def record_exists?(id)
486
468
  !@doc.root.element("records/*[@id='#{id}']").nil?
487
469
  end
470
+
471
+ # used internally by to_rss()
472
+ #
473
+ def rss_xslt(opt={})
474
+
475
+ h = {limit: 11}.merge(opt)
476
+ doc = Rexle.new(self.to_xslt)
477
+ e = doc.element('//xsl:apply-templates[2]')
478
+
479
+ e2 = doc.root.element('xsl:template[3]')
480
+ item = e2.element('item')
481
+ new_item = item.deep_clone
482
+ item.delete
483
+
484
+ pubdate = @xslt_schema[/pubDate:/]
485
+ xslif = Rexle.new("<xsl:if test='position() &lt; #{h[:limit]}'/>").root
486
+
487
+ if pubdate.nil? then
488
+ pubdate = Rexle.new("<pubDate><xsl:value-of select='pubDate'>" + \
489
+ "</xsl:value-of></pubDate>").root
490
+ new_item.add pubdate
491
+ end
492
+
493
+ xslif.add new_item
494
+ e2.add xslif.root
495
+ xslt = doc.xml
496
+
497
+ xslt
498
+
499
+ end
488
500
 
489
501
  def to_xslt(opt={})
490
502
 
@@ -1056,7 +1068,7 @@ EOF
1056
1068
 
1057
1069
  @default_key ||= e.text('default_key')
1058
1070
  @format_mask = e.text('format_mask')
1059
-
1071
+
1060
1072
  @fields = @schema[/([^(]+)\)$/,1].split(/\s*,\s*/).map(&:to_sym)
1061
1073
 
1062
1074
  @fields << @default_key if @default_key and \
@@ -1244,7 +1256,9 @@ XSL
1244
1256
 
1245
1257
  def summary_to_h
1246
1258
 
1247
- @doc.root.xpath('summary/*').inject({}) do |r,node|
1259
+ h = {recordx_type: 'dynarex'}
1260
+
1261
+ @doc.root.xpath('summary/*').inject(h) do |r,node|
1248
1262
  r.merge node.name.to_s.to_sym => node.text.to_s
1249
1263
  end
1250
1264
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  nP4bxzo6o8Qw40KPcv/n3Vcx8tV8hUOOe4XkImYbeWst9hbbHfbg8daipgkn9NEu
32
32
  YXuVi+EfN14P6g==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-03-11 00:00:00.000000000 Z
34
+ date: 2016-03-15 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex-import
metadata.gz.sig CHANGED
Binary file