yatoc 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39affb3116e586f5382ba8d98504bb5e38ddd24c975f7523e298e374f70eacb4
4
- data.tar.gz: '081f90c89281c13e0d52fc3117cfa7191286a2a086b1011bc26fdf01c8f88ff5'
3
+ metadata.gz: 3116bb2e59758cdae341cf67cc08c7de2ba860cdd55f35293e685c7649128f07
4
+ data.tar.gz: 4f8b47dd477fcde31ce363e9d238a387f6c86d53a1107f509c0a4fb14617327d
5
5
  SHA512:
6
- metadata.gz: cf89f24dabea1385e23fa88da907d6780aae991d049252d15635a2c5d1e15140ef269e9b24211f301b4d7786fa0db6db96e88b4f1bc879825ad60b11e0b5bc54
7
- data.tar.gz: 42b8bf8b5c78742b2be9fe1b1050b41c84a88e85118c487bdbddd1feb40cb30c5c4e744bbe90f4c2fccec0e2310ba727b0af4acc62597d327fe660f4f96483f1
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: true, debug: false)
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[^>]+>/, "\n" + html2 + "\n")
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='index'>\n%s\n</div>\n\n" % index
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='azindex'>\n%s\n</div>\n\n" \
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
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-17 00:00:00.000000000 Z
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