pxindex 0.2.0 → 0.2.1
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/pxindex.rb +90 -6
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9e8b4df7ff1521ad0cc9feae7ccd38f243ea8d964e82118a8d69ef1e5d747882
|
4
|
+
data.tar.gz: 995a8f24c9ff2f2461eff8ac12a313ad91b29234fcec8f052a8f2acd98fdef67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d320fe09c8a07b229f96a2df82feb24a78e19c89f24b94d1de88f7b0dba327318f916526673b3d0b811af4e8501ddc0f2540f77678e5361f160c2854ddacb39c
|
7
|
+
data.tar.gz: 5d118fe4a3afbfdebeeec100b657350ac6da61ca9a9f12a1be2a4839d21fd47e1d2e8f4ccb24268ce0fae855e7bb7ba8ba30c5640ce7b90aa2ff0bc62df56762
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/pxindex.rb
CHANGED
@@ -67,6 +67,40 @@ class PxIndex
|
|
67
67
|
|
68
68
|
alias query q?
|
69
69
|
|
70
|
+
def build_html()
|
71
|
+
|
72
|
+
|
73
|
+
@px.each_recursive do |x, parent|
|
74
|
+
|
75
|
+
if x.is_a? Entry then
|
76
|
+
|
77
|
+
trail = parent.attributes[:trail]
|
78
|
+
s = x.title.gsub(/ +/,'-')
|
79
|
+
x.attributes[:trail] = trail.nil? ? s : trail + '/' + s
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
doc = Nokogiri::XML(@px.to_xml)
|
86
|
+
xsl = Nokogiri::XSLT(xslt())
|
87
|
+
|
88
|
+
html_doc = Rexle.new(xsl.transform(doc).to_s)
|
89
|
+
|
90
|
+
html_doc.root.css('.atopic').each do |e|
|
91
|
+
|
92
|
+
puts 'e: ' + e.parent.parent.xml.inspect if @debug
|
93
|
+
|
94
|
+
href = e.attributes[:href]
|
95
|
+
if href.empty? or href[0] == '!' then
|
96
|
+
yield(e)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
html_doc.xml(pretty: true, declaration: false)
|
101
|
+
|
102
|
+
end
|
103
|
+
|
70
104
|
def to_px()
|
71
105
|
@px
|
72
106
|
end
|
@@ -131,11 +165,7 @@ class PxIndex
|
|
131
165
|
if a.any? then
|
132
166
|
puts 'a.map ' + a.map(&:title).inspect
|
133
167
|
end
|
134
|
-
end
|
135
|
-
|
136
|
-
if s.length == 1 and a.any? and keywords.length < 2 then
|
137
|
-
#a = a.first.records
|
138
|
-
end
|
168
|
+
end
|
139
169
|
|
140
170
|
if a.any? then
|
141
171
|
|
@@ -145,7 +175,7 @@ class PxIndex
|
|
145
175
|
|
146
176
|
return nil unless keywords.length > 1
|
147
177
|
|
148
|
-
r = rs
|
178
|
+
r = rs
|
149
179
|
|
150
180
|
if r.any? then
|
151
181
|
|
@@ -163,6 +193,7 @@ class PxIndex
|
|
163
193
|
end
|
164
194
|
|
165
195
|
def sort(a)
|
196
|
+
|
166
197
|
puts 'sorting ... a: ' + a.inspect if @debug
|
167
198
|
return sort_children(a) if a.first.is_a? String
|
168
199
|
|
@@ -170,8 +201,11 @@ class PxIndex
|
|
170
201
|
next unless x[0].is_a? String
|
171
202
|
x[0]
|
172
203
|
end
|
204
|
+
|
173
205
|
puts 'after sort: ' + r.inspect if @debug
|
206
|
+
|
174
207
|
r
|
208
|
+
|
175
209
|
end
|
176
210
|
|
177
211
|
def sort_children(a)
|
@@ -191,6 +225,56 @@ class PxIndex
|
|
191
225
|
' ' * indent + obj
|
192
226
|
|
193
227
|
end
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
def xslt()
|
232
|
+
<<EOF
|
233
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
234
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
235
|
+
<xsl:output method="xml" indent="yes" />
|
236
|
+
|
237
|
+
<xsl:template match='entries'>
|
238
|
+
<ul>
|
239
|
+
<xsl:apply-templates select='summary'/>
|
240
|
+
<xsl:apply-templates select='records'/>
|
241
|
+
</ul>
|
242
|
+
</xsl:template>
|
243
|
+
|
244
|
+
<xsl:template match='entries/summary'>
|
245
|
+
</xsl:template>
|
246
|
+
|
247
|
+
<xsl:template match='records/section'>
|
248
|
+
<li><h1><xsl:value-of select="summary/heading"/></h1><xsl:text>
|
249
|
+
</xsl:text>
|
250
|
+
|
251
|
+
<xsl:apply-templates select='records'/>
|
252
|
+
|
253
|
+
<xsl:text>
|
254
|
+
</xsl:text>
|
255
|
+
</li>
|
256
|
+
</xsl:template>
|
257
|
+
|
258
|
+
|
259
|
+
<xsl:template match='records/entry'>
|
260
|
+
<ul id="{summary/title}">
|
261
|
+
<li><xsl:text>
|
262
|
+
</xsl:text>
|
263
|
+
<a href="{summary/url}" class='atopic' id='{@id}' trail='{@trail}'>
|
264
|
+
<xsl:value-of select="summary/title"/></a><xsl:text>
|
265
|
+
</xsl:text>
|
266
|
+
|
267
|
+
<xsl:apply-templates select='records'/>
|
268
|
+
|
269
|
+
<xsl:text>
|
270
|
+
</xsl:text>
|
271
|
+
</li>
|
272
|
+
</ul>
|
273
|
+
</xsl:template>
|
274
|
+
|
275
|
+
|
276
|
+
</xsl:stylesheet>
|
277
|
+
EOF
|
194
278
|
end
|
195
279
|
|
196
280
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pxindex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
IIkRAfg3vUhmtNQu26Gsi9aZcJAGPKIjdRuYc9oyiGpJv0cQ02HBGRUXnoKS7XYT
|
31
31
|
QDc=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: pxindex-builder
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.6
|
102
|
+
rubygems_version: 2.7.6
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Experimental gem to facilitate a keyword search, by querying a Polyrex document
|
metadata.gz.sig
CHANGED
Binary file
|