myoutline 0.2.0 → 0.2.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/lib/myoutline.rb +32 -10
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752b310a3ffc4f555e366c6a4b0f82a2377873b1
|
4
|
+
data.tar.gz: 7fb8965d9a4f5516f012cfbfe053f374c48c17f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2da3cacae84e95865054d059430f03810092841ec1ba4b925e85874623cdb4bc99bc17e9f8d6548879178810af509a8057c7f84651d792bc2e4c342acdc01441
|
7
|
+
data.tar.gz: 78906df6f38baae13d4b3482747ae3a204e0cc05e0e984b63884dca8e3f20de11d1de044e7e481d3ee01925e34122d5171dbc74e07a7a7e110164b6841b1bd37
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/myoutline.rb
CHANGED
@@ -7,6 +7,8 @@ require 'nokogiri'
|
|
7
7
|
|
8
8
|
|
9
9
|
class MyOutline
|
10
|
+
|
11
|
+
attr_reader :pxi
|
10
12
|
|
11
13
|
def initialize(source, debug: false, allsorted: true,
|
12
14
|
autoupdate: true, topic_url: '$topic')
|
@@ -28,7 +30,7 @@ class MyOutline
|
|
28
30
|
# add the new entries to the main index
|
29
31
|
s << a3.join("\n")
|
30
32
|
|
31
|
-
s.prepend '<?ph schema="entries/entry[title]"?>
|
33
|
+
s.prepend '<?ph schema="entries/section[heading]/entry[title, url]"?>
|
32
34
|
|
33
35
|
'
|
34
36
|
|
@@ -49,14 +51,31 @@ class MyOutline
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def to_html()
|
54
|
+
|
55
|
+
px = self.to_px
|
52
56
|
|
53
|
-
|
57
|
+
px.each_recursive do |x, parent|
|
58
|
+
|
59
|
+
if x.is_a? Entry then
|
60
|
+
|
61
|
+
trail = parent.attributes[:trail]
|
62
|
+
s = x.title.gsub(/ +/,'-')
|
63
|
+
x.attributes[:trail] = trail.nil? ? s : trail + '/' + s
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
doc = Nokogiri::XML(px.to_xml)
|
54
70
|
xsl = Nokogiri::XSLT(xslt())
|
55
71
|
|
56
72
|
doc = Rexle.new(xsl.transform(doc).to_s)
|
57
73
|
|
58
|
-
doc.root.css('.atopic').each do |e|
|
59
|
-
e
|
74
|
+
doc.root.css('.atopic').each do |e|
|
75
|
+
puts 'e: ' + e.parent.parent.xml.inspect if @debug
|
76
|
+
e.attributes[:href] = @topic_url.sub(/\$topic/, e.text)\
|
77
|
+
.sub(/\$id/, e.attributes[:id]).sub(/\$trail/, e.attributes[:trail])\
|
78
|
+
.to_s.gsub(/ +/,'-')
|
60
79
|
end
|
61
80
|
|
62
81
|
doc.xml(pretty: true)
|
@@ -77,11 +96,12 @@ class MyOutline
|
|
77
96
|
|
78
97
|
end
|
79
98
|
|
80
|
-
def to_tree
|
99
|
+
def to_tree(alphabet: true)
|
81
100
|
|
82
101
|
a = @pxi.to_s.lines
|
83
102
|
a.shift # remove the ph declaration
|
84
|
-
a.reject! {|x| x =~ /^(?:#[^\n]+|\n+)$/}
|
103
|
+
a.reject! {|x| x =~ /^(?:#[^\n]+|\n+)$/} unless alphabet
|
104
|
+
a.map! {|x| r = x[/^.*(?= # )/]; r ? r + "\n" : x } # strip out the URLS
|
85
105
|
|
86
106
|
a.join
|
87
107
|
|
@@ -105,8 +125,8 @@ class MyOutline
|
|
105
125
|
<xsl:template match='entries/summary'>
|
106
126
|
</xsl:template>
|
107
127
|
|
108
|
-
<xsl:template match='records/
|
109
|
-
<li><h1><xsl:value-of select="summary/
|
128
|
+
<xsl:template match='records/section'>
|
129
|
+
<li><h1><xsl:value-of select="summary/heading"/></h1><xsl:text>
|
110
130
|
</xsl:text>
|
111
131
|
|
112
132
|
<xsl:apply-templates select='records'/>
|
@@ -117,10 +137,12 @@ class MyOutline
|
|
117
137
|
</xsl:template>
|
118
138
|
|
119
139
|
|
120
|
-
<xsl:template match='records/entry
|
140
|
+
<xsl:template match='records/entry'>
|
121
141
|
<ul id="{summary/title}">
|
122
142
|
<li><xsl:text>
|
123
|
-
</xsl:text
|
143
|
+
</xsl:text>
|
144
|
+
<a href="{summary/url}" class='atopic' id='{@id}' trail='{@trail}'>
|
145
|
+
<xsl:value-of select="summary/title"/></a><xsl:text>
|
124
146
|
</xsl:text>
|
125
147
|
|
126
148
|
<xsl:apply-templates select='records'/>
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myoutline
|
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
|
DFhc5TDtqEkJYiaiznQFl34HUKeCAdeAHkmD8jP3fUC8O7zcLXq69EAXGMXw4efB
|
31
31
|
3Co=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-03-
|
33
|
+
date: 2018-03-30 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: pxindex
|
metadata.gz.sig
CHANGED
Binary file
|