-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathbindery.html
More file actions
276 lines (205 loc) · 5.92 KB
/
bindery.html
File metadata and controls
276 lines (205 loc) · 5.92 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
---
---
<!--
Paragraph styles working from here:
https://alwaysreadthemanual.com/read/issues/5/eric-meyer/article.html
Convert all a href's to footnotes at end of chapter?
Combine all footnotes to end of doc? Hmm.
-->
<script src="//code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<style>
html{
font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
}
.posttitle{
font-weight:400;
padding-top:4em;
}
.postsubtitle{
font-weight:100;
font-style:italic;
padding-bottom:4em;
}
.chapternumber{
position:absolute;
top:0px;
text-transform:uppercase;
color:#00991F;
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
font-weight:bold;
}
.bookgreen{
color:#00991F !important
}
.post-content h2{
padding-top:1em;
}
.post-content p, .post-content blockquote, .post-content ul, .post-content ol, .post-content li, .post-content table{
font-size:12px;
line-height:15px;
text-align:justify;
margin-top:5px;
}
.post-content h2, .post-content h3, .post-content h4{
font-weight:400;
font-style:italic;
}
img{max-width:100%}
/*.post-content>p+p {
text-indent: 1.5em;
}*/
.post-content code{
background-color:#e8fdf5;
border:1px solid #009688;
font-family:palatino;
padding: 20px;
display: inline-block;
border-radius: 5px;
}
.post-content blockquote{
margin:0px;
margin-left:40px;
font-style:italic;
font-family:Arial, Helvetica, sans-serif;
}
.📖-footer:not(:empty){
padding-top:5px;
border-top:1px solid #00991F;
font-size:10px;
}
#intro{
width:100%;
height:100%;
background-color:#f3f3f3;
z-index:10;
}
#imprint{
text-align:center;
}
#imprint img{
display:block;
width:100px;
margin:auto;
margin-top:calc(50vh - 50px);
}
.sectiontitle{
font-size:45px;
}
.tocsubtitle{
font-size:0.8em;
}
.toc-row{
padding-bottom:20px;
}
</style>
<div id="content">
<div id="intro">#s</div>
<div id="imprint"><img src="https://i.imgur.com/QP7DiY7.png"/><br>Yes! And... press</div>
<div id="toc">
<h3>Table of Contents</h3>
<div class="toc">
{% for section in site.data.chapters %}
<a href="#section{{forloop.index}}">{{section.title}}</a>
{% assign chapterindex = forloop.index %}
{% for chapter in section.chapters %}
{% if chapter.url%}
<span><a href="#section{{chapterindex}}chapter{{forloop.index}}">{{chapter.title}}</a></span>
<span class="tocsubtitle"><em>{{chapter.subtitle}}</em></span>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
<h1>The Strategic Independent</h1>
<p>Intro text goes here...</p>
<p>What if there was a margin note that went something<span data-title="Margin waffles here" class="marginnote"></span> like this</p>
{% for section in site.data.chapters %}
<section>
<h2 class="sectiontitle bookgreen" id="section{{forloop.index}}">{{section.title}}</h2>
<p class="sectiondescription"><em>{{section.blurb}}</em></p>
{% assign chapterindex = forloop.index %}
{% for chapter in section.chapters %}
{% if chapter.url%}
<h1 class="posttitle" id="section{{chapterindex}}chapter{{forloop.index}}">{{chapter.title}}</h1>
<h2 class="postsubtitle">{{chapter.subtitle}}</h2>
{% assign tempurl = chapter.url | remove:"https://tomcritchlow.com" %}
{% assign post = site.posts | where:"url", tempurl | first %}
<div class="post-content">
{{post.content}}
</div>
{% else %}
{% endif %}
{% endfor %}
</section>
{% endfor %}
</div>
<script src="https://unpkg.com/bindery@2.3.1/dist/bindery.min.js"></script>
<script>
//NBED TODO: remove twitter JS, instagram JS, quotebacks JS
var footnotes = $(".footnotes p");
$("sup").each(function(index){
var fn = footnotes[index].removeChild(footnotes[index].lastChild);
$(this).replaceWith("<span class='marginnote' data-title='"+footnotes[index].innerHTML+"'></span>");
});
$(".footnotes").hide()
$( document ).ready(function() {
let linksAsFootnotes = Bindery.Footnote({
selector: 'p > a',
render: (element, number) => `${number}: Link to ${element.href}`
});
let marginFootnotes = Bindery.Footnote({
selector: '.marginnote',
render: (element, number) => `${number}: ${element.getAttribute("data-title")}`
});
let breakRule = Bindery.PageBreak({
selector: 'h1',
position: 'before',
});
let breakHeaders = Bindery.PageBreak({
selector: "h1, h2, h3, h4, h5, h6, li, tr",
position: "avoid"
});
let headerRule = Bindery.RunningHeader({
render: (pageInfo) => pageInfo.isLeft
? `${pageInfo.number} · ${pageInfo.heading.h1}`
: `Tom Critchlow · ${pageInfo.number}`
});
let firstPage = Bindery.FullBleedPage({
selector: '#intro',
continue: 'same'
});
let imprintPage = Bindery.FullBleedPage({
selector: '#imprint',
continue: 'same'
});
let tableContents = Bindery.PageReference({
selector: '#toc a',
replace: (element, number) => {
let row = document.createElement('div');
row.classList.add('toc-row');
row.innerHTML = element.textContent;
row.innerHTML += `<span style='float: right;'>${number}</span>`;
return row;
}
});
let beforesectionbreak = Bindery.PageBreak({
selector: '.sectiontitle',
position: 'before',
continue: 'left'
})
let aftersectionbreak = Bindery.PageBreak({
selector: '.sectiondescription',
position: 'after',
continue: 'left'
})
Bindery.makeBook({
content: '#content',
rules: [tableContents, beforesectionbreak, aftersectionbreak, firstPage, imprintPage, linksAsFootnotes,breakRule,headerRule, breakHeaders, marginFootnotes],
pageSetup: {
size: { width: '6in', height: '9in' },
margin: { top: '1in', inner: '1in', outer: '0.8in', bottom: '1in' },
},
});
});
</script>