jstreebuilder 0.3.0 → 0.3.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: becee86e064c7f3cc2c1f85d276181bf4b4e8fbf5452c12653984c1bc1c18ea1
4
- data.tar.gz: eaad9031c261b926b2bf5356dcc8aa915a096ab1277fcb562463d8df8667bc7d
3
+ metadata.gz: 78cae4a1eca195d5911489593cd19215b7ff070f3a64dda3d335d475e204ffa3
4
+ data.tar.gz: 9eaeee9e2f4ed52fa14d3f84a32fae4cd451e7f13c46601e2fa01a7a61cf0dad
5
5
  SHA512:
6
- metadata.gz: 161ef34be304b151fb0ea7a3a796cf681b9b1d2b93edbbd43a5e055bcac2730feae245256ac95c5e1aeb33e5ced23ea500882f00c1e0e52e9015a4fe064f95ed
7
- data.tar.gz: ebc9f22165fc91925d568dcb55423bc7986bc68189477c24a5223226c504d40b19c484dbc1d6295580525b01852149d61034adbf6cbdd8360c4cab30b66544bf
6
+ metadata.gz: e3bdc4fcc00377c1acebf131867c6c221549f0193430c97026f745398cadaa60d348e7dd4002f3defe59e79733a7f1eab0a977d4a6779f51ea6227702448b5b5
7
+ data.tar.gz: 6ddaf977fdeeb5dc201ec701ca06db70bae1cfa9fbc3ec22665559b57b41feceb58c762a10343816b48eb2a6694e656b53788b8f53cf6bdf8723010b1ecd440d
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/jstreebuilder.rb CHANGED
@@ -16,15 +16,15 @@ XSLT = %q[
16
16
 
17
17
  <xsl:element name='ul'>
18
18
  <xsl:attribute name='id'>myUL</xsl:attribute>
19
- <xsl:apply-templates select='records/entry' />
19
+ <xsl:apply-templates select='records/link' />
20
20
  </xsl:element>
21
21
 
22
22
  </xsl:template>
23
23
 
24
- <xsl:template match='entry'>
24
+ <xsl:template match='link'>
25
25
 
26
26
  <xsl:choose>
27
- <xsl:when test='records/entry'>
27
+ <xsl:when test='records/link'>
28
28
 
29
29
  <xsl:element name='li'>
30
30
 
@@ -43,7 +43,7 @@ XSLT = %q[
43
43
  </xsl:choose>
44
44
  </xsl:element>
45
45
  <ul class='nested'>
46
- <xsl:apply-templates select='records/entry' />
46
+ <xsl:apply-templates select='records/link' />
47
47
  </ul>
48
48
  </xsl:element>
49
49
 
@@ -78,15 +78,15 @@ PLAIN = %q[
78
78
 
79
79
  <xsl:element name='ul'>
80
80
  <xsl:attribute name='id'>myUL</xsl:attribute>
81
- <xsl:apply-templates select='records/entry' />
81
+ <xsl:apply-templates select='records/link' />
82
82
  </xsl:element>
83
83
 
84
84
  </xsl:template>
85
85
 
86
- <xsl:template match='entry'>
86
+ <xsl:template match='link'>
87
87
 
88
88
  <xsl:choose>
89
- <xsl:when test='records/entry'>
89
+ <xsl:when test='records/link'>
90
90
 
91
91
  <xsl:element name='li'>
92
92
 
@@ -103,7 +103,7 @@ PLAIN = %q[
103
103
  </xsl:choose>
104
104
  </xsl:element>
105
105
  <ul>
106
- <xsl:apply-templates select='records/entry' />
106
+ <xsl:apply-templates select='records/link' />
107
107
  </ul>
108
108
 
109
109
 
@@ -407,7 +407,7 @@ PLAIN_JS = ''
407
407
 
408
408
  def build_px(tree)
409
409
 
410
- schema = 'entries/entry[title, url]'
410
+ schema = 'entries/link[title, url]'
411
411
  xslt_schema = 'tree/item[@title:title, @url:url]'
412
412
 
413
413
  # transform the tree xml into a polyrex document
@@ -420,30 +420,36 @@ PLAIN_JS = ''
420
420
 
421
421
  def tree(opt={}, xslt=XSLT)
422
422
 
423
- raw_src = opt[:src]
423
+ raw_src = opt[:src]
424
424
 
425
- src, _ = RXFHelper.read raw_src
425
+ px = if raw_src.is_a? String then
426
426
 
427
- header = "<?polyrex schema='entries[title]/entry[title,url]' \
428
- delimiter=' # '?>\n\n"
429
-
430
- s = if src =~ /<tree>/ then
427
+ src, _ = RXFHelper.read raw_src
431
428
 
432
- build_px(src)
429
+ header = "<?polyrex schema='entries[title]/link[title,url]' \
430
+ delimiter=' # '?>\n\n"
433
431
 
434
- elsif src =~ /<\?polyrex-links\?>/
435
- header + src.sub(/<\?polyrex-links\?>/,'').lstrip
436
- elsif src =~ /<\?polyrex /
437
- src
438
- elsif src =~ /^#+/
439
- build_px(TreeBuilder.new(src, hn: opt[:hn],debug: @debug).to_tree)
440
- else
441
- header + src.lstrip
432
+ s = if src =~ /<tree>/ then
433
+
434
+ build_px(src)
435
+
436
+ elsif src =~ /<\?polyrex-links\?>/
437
+ header + src.sub(/<\?polyrex-links\?>/,'').lstrip
438
+ elsif src =~ /<\?polyrex /
439
+ src
440
+ elsif src =~ /^#+/
441
+ build_px(TreeBuilder.new(src, hn: opt[:hn],debug: @debug).to_tree)
442
+ else
443
+ header + src.lstrip
444
+ end
445
+
446
+ puts ('s: ' + s.inspect).debug if @debug
447
+ Polyrex.new(s)
448
+
449
+ elsif raw_src.is_a?(Polyrex) # detects PolyrexLinks as Polyrex too
450
+ raw_src
442
451
  end
443
452
 
444
- puts ('s: ' + s.inspect).debug if @debug
445
- px = Polyrex.new(s)
446
-
447
453
  # transform the polyrex xml into a nested HTML list
448
454
  #@ul = Rexslt.new(px.to_xml, XSLT).to_xml
449
455
  puts ('px: ' + px.inspect).debug if @debug
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file