jstreebuilder 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/jstreebuilder.rb +93 -9
- metadata +44 -44
- 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: becee86e064c7f3cc2c1f85d276181bf4b4e8fbf5452c12653984c1bc1c18ea1
|
4
|
+
data.tar.gz: eaad9031c261b926b2bf5356dcc8aa915a096ab1277fcb562463d8df8667bc7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 161ef34be304b151fb0ea7a3a796cf681b9b1d2b93edbbd43a5e055bcac2730feae245256ac95c5e1aeb33e5ced23ea500882f00c1e0e52e9015a4fe064f95ed
|
7
|
+
data.tar.gz: ebc9f22165fc91925d568dcb55423bc7986bc68189477c24a5223226c504d40b19c484dbc1d6295580525b01852149d61034adbf6cbdd8360c4cab30b66544bf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/jstreebuilder.rb
CHANGED
@@ -70,6 +70,66 @@ XSLT = %q[
|
|
70
70
|
</xsl:stylesheet>
|
71
71
|
]
|
72
72
|
|
73
|
+
PLAIN = %q[
|
74
|
+
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
|
75
|
+
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
|
76
|
+
|
77
|
+
<xsl:template match='entries'>
|
78
|
+
|
79
|
+
<xsl:element name='ul'>
|
80
|
+
<xsl:attribute name='id'>myUL</xsl:attribute>
|
81
|
+
<xsl:apply-templates select='records/entry' />
|
82
|
+
</xsl:element>
|
83
|
+
|
84
|
+
</xsl:template>
|
85
|
+
|
86
|
+
<xsl:template match='entry'>
|
87
|
+
|
88
|
+
<xsl:choose>
|
89
|
+
<xsl:when test='records/entry'>
|
90
|
+
|
91
|
+
<xsl:element name='li'>
|
92
|
+
|
93
|
+
<xsl:choose>
|
94
|
+
<xsl:when test='summary/url != ""'>
|
95
|
+
<xsl:element name='a'>
|
96
|
+
<xsl:attribute name='href'><xsl:value-of select='summary/url'/></xsl:attribute>
|
97
|
+
<xsl:value-of select='summary/title'/>
|
98
|
+
</xsl:element>
|
99
|
+
</xsl:when>
|
100
|
+
<xsl:otherwise>
|
101
|
+
<xsl:value-of select='summary/title'/>
|
102
|
+
</xsl:otherwise>
|
103
|
+
</xsl:choose>
|
104
|
+
</xsl:element>
|
105
|
+
<ul>
|
106
|
+
<xsl:apply-templates select='records/entry' />
|
107
|
+
</ul>
|
108
|
+
|
109
|
+
|
110
|
+
</xsl:when>
|
111
|
+
<xsl:otherwise>
|
112
|
+
<xsl:element name='li'>
|
113
|
+
<xsl:choose>
|
114
|
+
<xsl:when test='summary/url != ""'>
|
115
|
+
<xsl:element name='a'>
|
116
|
+
<xsl:attribute name='href'><xsl:value-of select='summary/url'/></xsl:attribute>
|
117
|
+
<xsl:value-of select='summary/title'/>
|
118
|
+
</xsl:element>
|
119
|
+
</xsl:when>
|
120
|
+
<xsl:otherwise>
|
121
|
+
<xsl:value-of select='summary/title'/>
|
122
|
+
</xsl:otherwise>
|
123
|
+
</xsl:choose>
|
124
|
+
</xsl:element>
|
125
|
+
</xsl:otherwise>
|
126
|
+
</xsl:choose>
|
127
|
+
|
128
|
+
</xsl:template>
|
129
|
+
|
130
|
+
</xsl:stylesheet>
|
131
|
+
]
|
132
|
+
|
73
133
|
|
74
134
|
class JsTreeBuilder
|
75
135
|
using ColouredText
|
@@ -159,6 +219,18 @@ body {
|
|
159
219
|
}
|
160
220
|
]
|
161
221
|
|
222
|
+
PLAIN_CSS = "
|
223
|
+
ul {
|
224
|
+
list-style-type: none;
|
225
|
+
background-color: transparent;
|
226
|
+
margin: 0.1em 0.1em; padding: 0.3em 1.3em
|
227
|
+
}
|
228
|
+
ul li {
|
229
|
+
background-color: transparent;
|
230
|
+
margin: 0.1em 0.1em; padding: 0.3em 0.3em
|
231
|
+
}
|
232
|
+
"
|
233
|
+
|
162
234
|
TREE_JS =<<EOF
|
163
235
|
var toggler = document.getElementsByClassName("caret");
|
164
236
|
var i;
|
@@ -173,6 +245,8 @@ EOF
|
|
173
245
|
|
174
246
|
SIDEBAR_JS = TREE_JS
|
175
247
|
|
248
|
+
PLAIN_JS = ''
|
249
|
+
|
176
250
|
class TreeBuilder
|
177
251
|
using ColouredText
|
178
252
|
|
@@ -261,7 +335,7 @@ SIDEBAR_JS = TREE_JS
|
|
261
335
|
|
262
336
|
@debug = options[:debug]
|
263
337
|
|
264
|
-
@types = %i(tree sidebar)
|
338
|
+
@types = %i(tree sidebar plain)
|
265
339
|
|
266
340
|
build(type, options) if type
|
267
341
|
|
@@ -326,8 +400,8 @@ SIDEBAR_JS = TREE_JS
|
|
326
400
|
@html = s.gsub(/<\/div>/,'\0' + "\n").strip.lines[1..-2]\
|
327
401
|
.map {|x| x.sub(/^ /,'') }.join
|
328
402
|
|
329
|
-
@css =
|
330
|
-
@js =
|
403
|
+
@css = type.to_s.upcase + '_CSS'
|
404
|
+
@js = type.to_s.upcase + '_JS'
|
331
405
|
|
332
406
|
end
|
333
407
|
|
@@ -344,21 +418,27 @@ SIDEBAR_JS = TREE_JS
|
|
344
418
|
end
|
345
419
|
|
346
420
|
|
347
|
-
def tree(opt={})
|
421
|
+
def tree(opt={}, xslt=XSLT)
|
348
422
|
|
349
|
-
|
423
|
+
raw_src = opt[:src]
|
424
|
+
|
425
|
+
src, _ = RXFHelper.read raw_src
|
426
|
+
|
427
|
+
header = "<?polyrex schema='entries[title]/entry[title,url]' \
|
428
|
+
delimiter=' # '?>\n\n"
|
350
429
|
|
351
430
|
s = if src =~ /<tree>/ then
|
352
431
|
|
353
432
|
build_px(src)
|
354
433
|
|
355
|
-
elsif src =~
|
434
|
+
elsif src =~ /<\?polyrex-links\?>/
|
435
|
+
header + src.sub(/<\?polyrex-links\?>/,'').lstrip
|
436
|
+
elsif src =~ /<\?polyrex /
|
356
437
|
src
|
357
438
|
elsif src =~ /^#+/
|
358
439
|
build_px(TreeBuilder.new(src, hn: opt[:hn],debug: @debug).to_tree)
|
359
440
|
else
|
360
|
-
|
361
|
-
delimiter=' # '?>\n\n" + src.lstrip
|
441
|
+
header + src.lstrip
|
362
442
|
end
|
363
443
|
|
364
444
|
puts ('s: ' + s.inspect).debug if @debug
|
@@ -369,7 +449,7 @@ SIDEBAR_JS = TREE_JS
|
|
369
449
|
puts ('px: ' + px.inspect).debug if @debug
|
370
450
|
puts ('px.to_xml: ' + px.to_xml.inspect).debug if @debug
|
371
451
|
doc = Nokogiri::XML(px.to_xml)
|
372
|
-
xslt = Nokogiri::XSLT(
|
452
|
+
xslt = Nokogiri::XSLT(xslt)
|
373
453
|
|
374
454
|
@ul = xslt.transform(doc).to_s.lines[1..-1].join
|
375
455
|
|
@@ -380,5 +460,9 @@ SIDEBAR_JS = TREE_JS
|
|
380
460
|
doc.root.attributes[:class] = 'sidenav'
|
381
461
|
@ul = doc.xml(declaration: false)
|
382
462
|
end
|
463
|
+
|
464
|
+
def plain(opt={})
|
465
|
+
tree opt, PLAIN
|
466
|
+
end
|
383
467
|
|
384
468
|
end
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhki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RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
27
|
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAK2zu4AMtsc4SyemYdrxWU+H7mq8f7DOGxBLLmyvr
|
29
|
+
4nrXLRtXIXyLh5A+PSZZYo4yPMTWBceu9llFl/DQz6LAy3DWhrJeIkQLhjr2yMcj
|
30
|
+
2AYCywZoz21O4ZAD/VWGVBXoiwBKgGVHKH5Tg0YP+rPamQpTx/R504XJtsyDDl8c
|
31
|
+
8Dkxnyujqc5uhuRYzTdg2uB8tN/yGLjxp4TserAddrAXmT4eyX2pz5wLw3T4QnUM
|
32
|
+
M5Rbh265lM2dto4oF8l99nEqzjizaTYSqW/QUez+H+8LBuUL3vOZiLJVWpouE2q4
|
33
|
+
RRwa4taVOEYrfq15x2CCvAGTyAmVemNhMNKd1iQEbf0CCzlC9iUlhy71/7OwkFgP
|
34
|
+
Ylqv2eiEKke192rff7eV/rDZhR70zordGPaRHgkuRRs6Ld9yeKS0CduK9YiMeoaf
|
35
|
+
8XaALSKxr3idyvVbBK920Fok7uGfchqJrIU5aP7qDogCmzHHHbiKzd+2arCbxISY
|
36
|
+
+eOXFHOtwvjBqRlX2zAMEukI
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: nokogiri
|
@@ -43,40 +43,40 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.11'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: 1.11.5
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '1.
|
56
|
+
version: '1.11'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
59
|
+
version: 1.11.5
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: polyrex
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 1.3.0
|
67
64
|
- - "~>"
|
68
65
|
- !ruby/object:Gem::Version
|
69
66
|
version: '1.3'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.3.2
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 1.3.0
|
77
74
|
- - "~>"
|
78
75
|
- !ruby/object:Gem::Version
|
79
76
|
version: '1.3'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.3.2
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: polyrex-xslt
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,24 +101,24 @@ dependencies:
|
|
101
101
|
name: kramdown
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: 2.1.0
|
107
104
|
- - "~>"
|
108
105
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
106
|
+
version: '2.3'
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.3.1
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 2.1.0
|
117
114
|
- - "~>"
|
118
115
|
- !ruby/object:Gem::Version
|
119
|
-
version: '2.
|
116
|
+
version: '2.3'
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 2.3.1
|
120
120
|
description:
|
121
|
-
email:
|
121
|
+
email: digital.robertson@gmail.com
|
122
122
|
executables: []
|
123
123
|
extensions: []
|
124
124
|
extra_rdoc_files: []
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
146
|
+
rubygems_version: 3.1.2
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Generates an HTML tree from XML or Markdown.
|
metadata.gz.sig
CHANGED
Binary file
|