yatoc 0.2.4 → 0.2.5
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/lib/yatoc.rb +60 -4
- 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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3116bb2e59758cdae341cf67cc08c7de2ba860cdd55f35293e685c7649128f07
|
4
|
+
data.tar.gz: 4f8b47dd477fcde31ce363e9d238a387f6c86d53a1107f509c0a4fb14617327d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f07baddeaa52820ddf5cf285649a8ea25e58a4ce87ab10cab0d06e27452782e2f20e60247d0aab1cf4aaa32d9040904072c236125ce1356b1bf1d1155170c68
|
7
|
+
data.tar.gz: 7098a90f83ef5ffb04a8e995809dc2f01adf7f9faee875fa6062edf85d9e0e4e02470a63980e90397702b1d3ff94ed61ae493dcc4a4c5956c828fd4fe63135d5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/yatoc.rb
CHANGED
@@ -13,18 +13,20 @@ class Yatoc
|
|
13
13
|
|
14
14
|
attr_reader :to_html, :to_toc, :to_index
|
15
15
|
|
16
|
-
def initialize(html, min_sections: 3, numbered:
|
16
|
+
def initialize(html, min_sections: 3, numbered: nil, debug: false)
|
17
17
|
|
18
18
|
@numbered, @debug, @html = numbered, debug, html
|
19
19
|
|
20
20
|
@to_html = if html =~ /<index[^>]+>/ then
|
21
21
|
|
22
|
+
@numbered ||= false
|
22
23
|
html2 = gen_index(html)
|
23
24
|
puts 'html2: ' + html2.inspect
|
24
|
-
html.sub(/<index[^>]+>/,
|
25
|
+
"%s\n\n<div class='main'>%s</div>" % [html2, html.sub(/<index[^>]+>/, '')]
|
25
26
|
|
26
27
|
elsif html.scan(/<h\d+/).length > min_sections
|
27
28
|
|
29
|
+
@unmbered ||= true
|
28
30
|
gen_toc(html)
|
29
31
|
|
30
32
|
else
|
@@ -33,6 +35,60 @@ class Yatoc
|
|
33
35
|
|
34
36
|
end
|
35
37
|
|
38
|
+
def to_css()
|
39
|
+
|
40
|
+
<<CSS
|
41
|
+
.sidenav {
|
42
|
+
border-top: 1px solid #9ef;
|
43
|
+
border-bottom: 1px solid #9ef;
|
44
|
+
width: 130px;
|
45
|
+
position: fixed;
|
46
|
+
z-index: 1;
|
47
|
+
top: 80px;
|
48
|
+
left: 10px;
|
49
|
+
background: transparent;
|
50
|
+
overflow-x: hidden;
|
51
|
+
padding: 8px 0;
|
52
|
+
}
|
53
|
+
.sidenav ul {
|
54
|
+
background-color: transparent; margin: 0.3em 0.3em 0.3em 0.9em;
|
55
|
+
padding: 0.3em 0.5em; color: #5af;
|
56
|
+
}
|
57
|
+
|
58
|
+
.sidenav ul li {
|
59
|
+
background-color: transparent; margin: 0.3em 0.1em;
|
60
|
+
padding: 0.2em
|
61
|
+
}
|
62
|
+
|
63
|
+
.sidenav a {
|
64
|
+
color: #5af;
|
65
|
+
padding: 6px 8px 6px 8px;
|
66
|
+
text-decoration: none;
|
67
|
+
font-size: 0.9em;
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
.sidenav a:focus { color: #1e2; }
|
73
|
+
.sidenav a:hover { color: #1e2; }
|
74
|
+
.sidenav a:active { color: #1e2; }
|
75
|
+
|
76
|
+
|
77
|
+
a:link:active, a:visited:active {
|
78
|
+
color: (internal value);
|
79
|
+
}
|
80
|
+
|
81
|
+
.main {
|
82
|
+
margin-left: 140px; /* Same width as the sidebar + left position in px */
|
83
|
+
font-size: 1.0em; /* Increased text to enable scrolling */
|
84
|
+
padding: 0px 10px;
|
85
|
+
}
|
86
|
+
|
87
|
+
}
|
88
|
+
CSS
|
89
|
+
|
90
|
+
end
|
91
|
+
|
36
92
|
def to_index(threshold: 5)
|
37
93
|
gen_index(@html, threshold: threshold)
|
38
94
|
end
|
@@ -62,7 +118,7 @@ class Yatoc
|
|
62
118
|
|
63
119
|
index = build_html(a)
|
64
120
|
|
65
|
-
@to_index = "<div id='index' class='
|
121
|
+
@to_index = "<div id='index' class='sidenav'>\n%s\n</div>\n\n" % index
|
66
122
|
|
67
123
|
else
|
68
124
|
|
@@ -75,7 +131,7 @@ class Yatoc
|
|
75
131
|
px = PxIndex.new
|
76
132
|
px.import(s)
|
77
133
|
|
78
|
-
@to_index = "<div id='azindex' class='
|
134
|
+
@to_index = "<div id='azindex' class='sidenav'>\n%s\n</div>\n\n" \
|
79
135
|
% px.build_html
|
80
136
|
end
|
81
137
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yatoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
7RVV+J+oYjvww0tYfGq6N2tECM5thrQYj3cKLzAEEPYBjoWcPA5bqRXBTNta+k+K
|
36
36
|
tc7DELyeAZoKgZBO2wAc4FQ6
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2019-01-
|
38
|
+
date: 2019-01-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: pxindex
|
metadata.gz.sig
CHANGED
Binary file
|