jstreebuilder 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: f98c98e0ff99dffced50db848f6f9ce57845c10c097bef510a26ceb1b3c8dcb8
4
- data.tar.gz: 3dae6f056654e23b0ae5c77f59a616702675fdaf9cb66e63fc4ad0b6f60c454b
3
+ metadata.gz: 1fb6216a6db3b1fa2cea22ff31e25ef0011e781ad32733f72db72868274480d4
4
+ data.tar.gz: 68790d57575371e35df2c3e30fde0d4ac46202e7d56a84dcf41796c4e1eaf210
5
5
  SHA512:
6
- metadata.gz: 3aef11d3b58a5b25b70ad72f9101ec95c8de4d55c8dbf42e765f9fed3999e142befdb5b3eb29d13595ba1a222de571dd16ef7c0213ce1adf3f930477c4b36d86
7
- data.tar.gz: def0b33e5777d7b780f9d5805cc3f57cee0b2ba5cb82faf697fc71fa02286d1982e5248f80f174e72bc73d9da3f921230a39ec3f9ec7849049c94dfec1fc8628
6
+ metadata.gz: bcec7abd75392b28dba2693978032e2b94b3ed6987672c24a725af7861793957c6f7f9b4ca28eede154088eff9fba6c920d76461b48627e00a1b7fa3f4321228
7
+ data.tar.gz: eae3a2574424004193df4d30b9cfa304eeb61847d82faa9f9aa990d9502aa27f55125873cf2c7c8cd4adf09d67bdf149ece43d4710a1944836adfd2cc5fc915f
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/jstreebuilder.rb CHANGED
@@ -11,6 +11,7 @@ require 'polyrex'
11
11
  XSLT = %q[
12
12
  <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
13
13
  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
14
+
14
15
  <xsl:template match='entries'>
15
16
 
16
17
  <xsl:element name='ul'>
@@ -36,7 +37,17 @@ XSLT = %q[
36
37
  </xsl:when>
37
38
  <xsl:otherwise>
38
39
  <xsl:element name='li'>
40
+ <xsl:choose>
41
+ <xsl:when test='summary/url != ""'>
42
+ <xsl:element name='a'>
43
+ <xsl:attribute name='href'><xsl:value-of select='summary/url'/></xsl:attribute>
44
+ <xsl:value-of select='summary/title'/>
45
+ </xsl:element>
46
+ </xsl:when>
47
+ <xsl:otherwise>
39
48
  <xsl:value-of select='summary/title'/>
49
+ </xsl:otherwise>
50
+ </xsl:choose>
40
51
  </xsl:element>
41
52
  </xsl:otherwise>
42
53
  </xsl:choose>
@@ -190,15 +201,23 @@ EOF
190
201
 
191
202
  def tree(opt={})
192
203
 
193
- tree = opt[:xml]
204
+ tree = opt[:src]
194
205
 
195
- schema = 'entries/entry[title]'
196
- xslt_schema = 'tree/item[@title:title]'
197
-
198
- # transform the tree xml into a polyrex document
199
- pxsl = PolyrexXSLT.new(schema: schema, xslt_schema: xslt_schema).to_xslt
200
- puts 'pxsl: ' + pxsl if @debug
201
- px = Polyrex.new(Rexslt.new(pxsl, tree).to_s)
206
+ s = if tree =~ /<tree>/ then
207
+
208
+ schema = 'entries/entry[title]'
209
+ xslt_schema = 'tree/item[@title:title]'
210
+
211
+ # transform the tree xml into a polyrex document
212
+ pxsl = PolyrexXSLT.new(schema: schema, xslt_schema: xslt_schema).to_xslt
213
+ puts 'pxsl: ' + pxsl if @debug
214
+ Rexslt.new(pxsl, tree).to_s
215
+
216
+ elsif tree =~ /<?polyrex /
217
+ tree
218
+ end
219
+
220
+ px = Polyrex.new(s)
202
221
 
203
222
  # transform the polyrex xml into a nested HTML list
204
223
  #@ul = Rexslt.new(px.to_xml, XSLT).to_xml
@@ -211,4 +230,3 @@ EOF
211
230
  end
212
231
 
213
232
  end
214
-
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstreebuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  /YHvF368/KpwUw6rBLVUbFvCsNvDTe+bPAG72P5om2g/aope7mb9Qc4kATQgWiys
36
36
  rqRI7UAQ3N9ojGSXl6KSySfi
37
37
  -----END CERTIFICATE-----
38
- date: 2019-08-05 00:00:00.000000000 Z
38
+ date: 2019-08-06 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: nokogiri
metadata.gz.sig CHANGED
Binary file