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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/jstreebuilder.rb +33 -27
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78cae4a1eca195d5911489593cd19215b7ff070f3a64dda3d335d475e204ffa3
|
4
|
+
data.tar.gz: 9eaeee9e2f4ed52fa14d3f84a32fae4cd451e7f13c46601e2fa01a7a61cf0dad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
19
|
+
<xsl:apply-templates select='records/link' />
|
20
20
|
</xsl:element>
|
21
21
|
|
22
22
|
</xsl:template>
|
23
23
|
|
24
|
-
<xsl:template match='
|
24
|
+
<xsl:template match='link'>
|
25
25
|
|
26
26
|
<xsl:choose>
|
27
|
-
<xsl:when test='records/
|
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/
|
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/
|
81
|
+
<xsl:apply-templates select='records/link' />
|
82
82
|
</xsl:element>
|
83
83
|
|
84
84
|
</xsl:template>
|
85
85
|
|
86
|
-
<xsl:template match='
|
86
|
+
<xsl:template match='link'>
|
87
87
|
|
88
88
|
<xsl:choose>
|
89
|
-
<xsl:when test='records/
|
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/
|
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/
|
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
|
-
|
425
|
+
px = if raw_src.is_a? String then
|
426
426
|
|
427
|
-
|
428
|
-
delimiter=' # '?>\n\n"
|
429
|
-
|
430
|
-
s = if src =~ /<tree>/ then
|
427
|
+
src, _ = RXFHelper.read raw_src
|
431
428
|
|
432
|
-
|
429
|
+
header = "<?polyrex schema='entries[title]/link[title,url]' \
|
430
|
+
delimiter=' # '?>\n\n"
|
433
431
|
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
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
metadata.gz.sig
CHANGED
Binary file
|