-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathextension.rb
64 lines (55 loc) · 925 Bytes
/
extension.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
include Asciidoctor
class StepsPostprocessor < Extensions::Postprocessor
def process document, output
replacement = %(<style>
ol.arabic {
list-style-type: none;
}
ol {
counter-reset: li;
list-style-type: none;
list-style: none;
position: relative;
padding-bottom: 8px;
}
ol, li {
border: 0;
margin: 0;
padding: 0;
font-size: 100%;
}
ol > li {
padding: 5px 0 5px 55px;
position: relative;
margin-bottom: 5px;
}
ol > li:before {
content: counter(li);
counter-increment: li;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 30px;
padding: 0 10px 0 0;
color: #999;
font-size: 20px;
font-weight: bold;
line-height: 35px;
text-align: right;
border-right: 1px solid #ddd;
}
ol > li:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
</style>
)
output.sub /(?=<\/head>)/, replacement
end
end