Skip to content

Commit 45ce20d

Browse files
committed
Merge remote-tracking branch 'quiris/master'
2 parents 6b77223 + 26fba30 commit 45ce20d

15 files changed

Lines changed: 17646 additions & 166 deletions

librarian/book2anything.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def run(cls):
5656
parser.add_option('-v', '--verbose',
5757
action='store_true', dest='verbose', default=False,
5858
help='print status messages to stdout')
59+
parser.add_option('-t', '--html-toc',
60+
action='store_true', dest='html_toc', default=False,
61+
help='with inline html toc [book2epub only]')
62+
parser.add_option('-k', '--use-kindlegen',
63+
action='store_true', dest='use_kindlegen', default=False,
64+
help='use kindlegen tool [book2mobi only]')
5965
parser.add_option('-d', '--make-dir',
6066
action='store_true', dest='make_dir', default=False,
6167
help='create a directory for author and put the output file in it')
@@ -96,6 +102,12 @@ def run(cls):
96102
if flag.value(options)]
97103
if transform_flags:
98104
transform_args['flags'] = transform_flags
105+
if options.verbose:
106+
transform_args['verbose'] = True
107+
if options.html_toc and cls.ext == 'epub':
108+
transform_args['html_toc'] = True
109+
if options.use_kindlegen and cls.ext == 'mobi':
110+
transform_args['use_kindlegen'] = True
99111
# Add cover support, if any.
100112
if cls.uses_cover:
101113
if options.image_cache:

librarian/epub.py

Lines changed: 135 additions & 52 deletions
Large diffs are not rendered by default.

librarian/epub/style.css

Lines changed: 90 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ body, p, h1, h2, h3, h4 {
3030

3131
body
3232
{
33-
line-height: 1.5em;
34-
margin: 0;
33+
line-height: 1.5em;
34+
margin: 0;
3535
}
3636

3737
a
3838
{
39-
text-decoration: none;
40-
color: #00e;
39+
text-decoration: none;
40+
color: #00e;
4141
}
4242

4343
a img {
@@ -46,8 +46,15 @@ a img {
4646

4747
#book-text
4848
{
49-
margin: 2em;
50-
/*margin-right: 9em;*/
49+
margin: 2em;
50+
}
51+
52+
@media amzn-kf8
53+
{
54+
#book-text
55+
{
56+
margin: 0;
57+
}
5158
}
5259

5360
/* =================================================== */
@@ -57,11 +64,11 @@ a img {
5764

5865
.h2
5966
{
60-
font-size: 2em;
61-
margin: 0;
62-
margin-top: 1.5em;
63-
font-weight: bold;
64-
line-height: 1.5em;
67+
font-size: 2em;
68+
margin: 0;
69+
margin-top: 1.5em;
70+
font-weight: bold;
71+
line-height: 1.5em;
6572
}
6673

6774
.h3
@@ -75,15 +82,15 @@ a img {
7582

7683
.h4
7784
{
78-
font-size: 1em;
85+
font-size: 1em;
7986
margin: 0;
8087
margin-top: 1.5em;
81-
line-height: 1.5em;
88+
line-height: 1.5em;
8289
}
8390

8491
p
8592
{
86-
margin: 0;
93+
margin: 0;
8794
}
8895

8996
/* ======================== */
@@ -92,31 +99,31 @@ p
9299

93100
.theme-begin
94101
{
95-
border-left: 0.1em solid #DDDDDD;
96-
color: #777;
97-
padding: 0 0.5em;
98-
width: 7.5em;
99-
font-style: normal;
100-
font-weight: normal;
101-
font-size: 0.875em;
102-
float: right;
103-
margin-right: -9.5em;
104-
clear: both;
105-
left: 40em;
106-
line-height: 1.5em;
107-
text-align: left;
102+
border-left: 0.1em solid #DDDDDD;
103+
color: #777;
104+
padding: 0 0.5em;
105+
width: 7.5em;
106+
font-style: normal;
107+
font-weight: normal;
108+
font-size: 0.875em;
109+
float: right;
110+
margin-right: -9.5em;
111+
clear: both;
112+
left: 40em;
113+
line-height: 1.5em;
114+
text-align: left;
108115
}
109116

110117
.annotation
111118
{
112-
margin-bottom: 0.3em;
113-
text-align: left;
119+
margin-bottom: 0.3em;
120+
text-align: justify;
114121
}
115122

116123
.block
117124
{
118-
font-size: 0.875em;
119-
padding: 1em;
125+
font-size: 0.875em;
126+
padding: 1em;
120127
}
121128

122129

@@ -126,9 +133,9 @@ p
126133

127134
.anchor sup
128135
{
129-
line-height: 0;
130-
font-size: 0.7em;
131-
}
136+
line-height: 0;
137+
font-size: 0.7em;
138+
}
132139

133140
/* =================== */
134141
/* = Custom elements = */
@@ -186,9 +193,9 @@ p
186193
text-align: center;
187194
font-weight: bold;
188195

189-
font-size: 1.125em;
190-
line-height: 1.5em;
191-
margin-bottom: -0.25em;
196+
font-size: 1.125em;
197+
line-height: 1.5em;
198+
margin-bottom: -0.25em;
192199
}
193200

194201
.subtitle
@@ -197,34 +204,34 @@ p
197204
text-align: center;
198205
font-weight: bold;
199206

200-
font-size: 1.5em;
201-
line-height: 1.5em;
202-
margin-top: -0.25em;
207+
font-size: 1.5em;
208+
line-height: 1.5em;
209+
margin-top: -0.25em;
203210
}
204211

205212
div.didaskalia
206213
{
207-
font-style: italic;
208-
margin-top: 0.5em;
209-
margin-bottom: 0.5em;
210-
margin-left: 1.5em;
214+
font-style: italic;
215+
margin-top: 0.5em;
216+
margin-bottom: 0.5em;
217+
margin-left: 1.5em;
211218
}
212219

213220
.kwestia
214221
{
215-
margin-top: 0.5em;
222+
margin-top: 0.5em;
216223
}
217224

218225
.paragraph
219226
{
220-
text-align: justify;
221-
margin: 0;
222-
text-indent: 1.2em;
227+
text-align: justify;
228+
margin: 0;
229+
text-indent: 1.2em;
223230
}
224231

225232
h1 + .paragraph, h2 + .paragraph
226233
{
227-
text-indent: 0;
234+
text-indent: 0;
228235
}
229236

230237
h2 + .paragraph:first-letter
@@ -234,30 +241,30 @@ h2 + .paragraph:first-letter
234241

235242
.motto
236243
{
237-
text-align: justify;
238-
font-style: italic;
239-
margin-top: 1.5em;
244+
text-align: justify;
245+
font-style: italic;
246+
margin-top: 1.5em;
240247
}
241248

242249
.motto_podpis, .motto_podpis .paragraph
243250
{
244-
font-size: 0.875em;
245-
text-align: right;
251+
font-size: 0.875em;
252+
text-align: right;
246253
font-style: italic;
247254
}
248255

249256
.fragment
250257
{
251-
border-bottom: 0.1em solid #999;
252-
padding-bottom: 1.5em;
258+
border-bottom: 0.1em solid #999;
259+
padding-bottom: 1.5em;
253260
}
254261

255262
.note
256263
{
257-
text-align: right;
258-
font-style: italic;
259-
margin-top: 1em;
260-
margin-bottom: 0.5em;
264+
text-align: right;
265+
font-style: italic;
266+
margin-top: 1em;
267+
margin-bottom: 0.5em;
261268
}
262269

263270
.note .paragraph
@@ -273,43 +280,43 @@ h2 + .paragraph:first-letter
273280

274281
hr.spacer
275282
{
276-
height: 3em;
277-
visibility: hidden;
283+
height: 3em;
284+
visibility: hidden;
278285
}
279286

280287
hr.spacer-line
281288
{
282-
margin: 0;
283-
margin-top: 1.5em;
284-
margin-bottom: 1.5em;
285-
border: none;
286-
border-bottom: 0.1em solid #000;
289+
margin: 0;
290+
margin-top: 1.5em;
291+
margin-bottom: 1.5em;
292+
border: none;
293+
border-bottom: 0.1em solid #000;
287294
}
288295

289296
.spacer-asterisk
290297
{
291-
padding: 0;
298+
padding: 0;
292299
margin: 0;
293300
margin-top: 1.5em;
294301
margin-bottom: 1.5em;
295-
text-align: center;
302+
text-align: center;
296303
}
297304

298305
div.person-list ol
299306
{
300-
list-style: none;
301-
padding: 0;
302-
padding-left: 1.5em;
307+
list-style: none;
308+
padding: 0;
309+
padding-left: 1.5em;
303310
}
304311

305312
.place-and-time
306313
{
307-
font-style: italic;
314+
font-style: italic;
308315
}
309316

310317
em.math
311318
{
312-
font-style: italic;
319+
font-style: italic;
313320
}
314321
em.foreign-word
315322
{
@@ -326,20 +333,20 @@ em.didaskalia
326333

327334
em.author-emphasis
328335
{
329-
letter-spacing: 0.1em;
336+
letter-spacing: 0.1em;
330337
}
331338

332339
.person-list em.person
333340
{
334-
font-style: normal;
335-
/*font-variant: small-caps;*/
336-
text-transform: uppercase;
341+
font-style: normal;
342+
/*font-variant: small-caps;*/
343+
text-transform: uppercase;
337344
}
338345

339346
.info
340347
{
341-
text-align: center;
342-
margin-bottom: 1em;
348+
text-align: center;
349+
margin-bottom: 1em;
343350
}
344351
.info div
345352
{
@@ -348,9 +355,9 @@ em.author-emphasis
348355

349356
.info img
350357
{
351-
margin: 0;
352-
margin-left: 2em;
353-
margin-right: 2em;
358+
margin: 0;
359+
margin-left: 2em;
360+
margin-right: 2em;
354361
}
355362

356363
p.minor-info {

librarian/epub/toc.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
<link rel="stylesheet" href="style.css" type="text/css" />
77
</head>
88
<body>
9-
<h1>Spis treści</h1>
10-
%s
9+
<div id="book-text">
10+
<h1>Spis treści</h1>
11+
%s
12+
</div>
1113
</body>
1214
</html>

librarian/epub/xsltAnnotations.xsl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,8 @@
3131
</xsl:template>
3232

3333
<xsl:template match="pa|pe|pr|pt" mode="przypis">
34-
<p id="annotation-{@number}" class="annotation" xmlns="http://www.w3.org/1999/xhtml">
35-
<a href="part{@part}.html#anchor-{@number}" xmlns="http://www.w3.org/1999/xhtml">
36-
<xsl:value-of select="@number" />
37-
</a>.
38-
<xsl:apply-templates />
39-
<xsl:if test="name()='pa'"> [przypis autorski]</xsl:if>
40-
</p>
34+
<p id="annotation-{@number}" class="annotation" xmlns="http://www.w3.org/1999/xhtml"><a href="part{@part}.html#anchor-{@number}" xmlns="http://www.w3.org/1999/xhtml"><xsl:value-of select="@number" /></a>. <xsl:apply-templates /><xsl:if test="name()='pa'"> [przypis autorski]</xsl:if></p>
35+
<xsl:text>&#xa;</xsl:text>
4136
</xsl:template>
4237

4338
<xsl:template match="slowo_obce">

0 commit comments

Comments
 (0)