Skip to content

Commit

Permalink
Merge remote-tracking branch 'quiris/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rczajka committed Apr 23, 2014
2 parents 6b77223 + 26fba30 commit 45ce20d
Show file tree
Hide file tree
Showing 15 changed files with 17,646 additions and 166 deletions.
12 changes: 12 additions & 0 deletions librarian/book2anything.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def run(cls):
parser.add_option('-v', '--verbose',
action='store_true', dest='verbose', default=False,
help='print status messages to stdout')
parser.add_option('-t', '--html-toc',
action='store_true', dest='html_toc', default=False,
help='with inline html toc [book2epub only]')
parser.add_option('-k', '--use-kindlegen',
action='store_true', dest='use_kindlegen', default=False,
help='use kindlegen tool [book2mobi only]')
parser.add_option('-d', '--make-dir',
action='store_true', dest='make_dir', default=False,
help='create a directory for author and put the output file in it')
Expand Down Expand Up @@ -96,6 +102,12 @@ def run(cls):
if flag.value(options)]
if transform_flags:
transform_args['flags'] = transform_flags
if options.verbose:
transform_args['verbose'] = True
if options.html_toc and cls.ext == 'epub':
transform_args['html_toc'] = True
if options.use_kindlegen and cls.ext == 'mobi':
transform_args['use_kindlegen'] = True
# Add cover support, if any.
if cls.uses_cover:
if options.image_cache:
Expand Down
187 changes: 135 additions & 52 deletions librarian/epub.py

Large diffs are not rendered by default.

173 changes: 90 additions & 83 deletions librarian/epub/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ body, p, h1, h2, h3, h4 {

body
{
line-height: 1.5em;
margin: 0;
line-height: 1.5em;
margin: 0;
}

a
{
text-decoration: none;
color: #00e;
text-decoration: none;
color: #00e;
}

a img {
Expand All @@ -46,8 +46,15 @@ a img {

#book-text
{
margin: 2em;
/*margin-right: 9em;*/
margin: 2em;
}

@media amzn-kf8
{
#book-text
{
margin: 0;
}
}

/* =================================================== */
Expand All @@ -57,11 +64,11 @@ a img {

.h2
{
font-size: 2em;
margin: 0;
margin-top: 1.5em;
font-weight: bold;
line-height: 1.5em;
font-size: 2em;
margin: 0;
margin-top: 1.5em;
font-weight: bold;
line-height: 1.5em;
}

.h3
Expand All @@ -75,15 +82,15 @@ a img {

.h4
{
font-size: 1em;
font-size: 1em;
margin: 0;
margin-top: 1.5em;
line-height: 1.5em;
line-height: 1.5em;
}

p
{
margin: 0;
margin: 0;
}

/* ======================== */
Expand All @@ -92,31 +99,31 @@ p

.theme-begin
{
border-left: 0.1em solid #DDDDDD;
color: #777;
padding: 0 0.5em;
width: 7.5em;
font-style: normal;
font-weight: normal;
font-size: 0.875em;
float: right;
margin-right: -9.5em;
clear: both;
left: 40em;
line-height: 1.5em;
text-align: left;
border-left: 0.1em solid #DDDDDD;
color: #777;
padding: 0 0.5em;
width: 7.5em;
font-style: normal;
font-weight: normal;
font-size: 0.875em;
float: right;
margin-right: -9.5em;
clear: both;
left: 40em;
line-height: 1.5em;
text-align: left;
}

.annotation
{
margin-bottom: 0.3em;
text-align: left;
margin-bottom: 0.3em;
text-align: justify;
}

.block
{
font-size: 0.875em;
padding: 1em;
font-size: 0.875em;
padding: 1em;
}


Expand All @@ -126,9 +133,9 @@ p

.anchor sup
{
line-height: 0;
font-size: 0.7em;
}
line-height: 0;
font-size: 0.7em;
}

/* =================== */
/* = Custom elements = */
Expand Down Expand Up @@ -186,9 +193,9 @@ p
text-align: center;
font-weight: bold;

font-size: 1.125em;
line-height: 1.5em;
margin-bottom: -0.25em;
font-size: 1.125em;
line-height: 1.5em;
margin-bottom: -0.25em;
}

.subtitle
Expand All @@ -197,34 +204,34 @@ p
text-align: center;
font-weight: bold;

font-size: 1.5em;
line-height: 1.5em;
margin-top: -0.25em;
font-size: 1.5em;
line-height: 1.5em;
margin-top: -0.25em;
}

div.didaskalia
{
font-style: italic;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: 1.5em;
font-style: italic;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: 1.5em;
}

.kwestia
{
margin-top: 0.5em;
margin-top: 0.5em;
}

.paragraph
{
text-align: justify;
margin: 0;
text-indent: 1.2em;
text-align: justify;
margin: 0;
text-indent: 1.2em;
}

h1 + .paragraph, h2 + .paragraph
{
text-indent: 0;
text-indent: 0;
}

h2 + .paragraph:first-letter
Expand All @@ -234,30 +241,30 @@ h2 + .paragraph:first-letter

.motto
{
text-align: justify;
font-style: italic;
margin-top: 1.5em;
text-align: justify;
font-style: italic;
margin-top: 1.5em;
}

.motto_podpis, .motto_podpis .paragraph
{
font-size: 0.875em;
text-align: right;
font-size: 0.875em;
text-align: right;
font-style: italic;
}

.fragment
{
border-bottom: 0.1em solid #999;
padding-bottom: 1.5em;
border-bottom: 0.1em solid #999;
padding-bottom: 1.5em;
}

.note
{
text-align: right;
font-style: italic;
margin-top: 1em;
margin-bottom: 0.5em;
text-align: right;
font-style: italic;
margin-top: 1em;
margin-bottom: 0.5em;
}

.note .paragraph
Expand All @@ -273,43 +280,43 @@ h2 + .paragraph:first-letter

hr.spacer
{
height: 3em;
visibility: hidden;
height: 3em;
visibility: hidden;
}

hr.spacer-line
{
margin: 0;
margin-top: 1.5em;
margin-bottom: 1.5em;
border: none;
border-bottom: 0.1em solid #000;
margin: 0;
margin-top: 1.5em;
margin-bottom: 1.5em;
border: none;
border-bottom: 0.1em solid #000;
}

.spacer-asterisk
{
padding: 0;
padding: 0;
margin: 0;
margin-top: 1.5em;
margin-bottom: 1.5em;
text-align: center;
text-align: center;
}

div.person-list ol
{
list-style: none;
padding: 0;
padding-left: 1.5em;
list-style: none;
padding: 0;
padding-left: 1.5em;
}

.place-and-time
{
font-style: italic;
font-style: italic;
}

em.math
{
font-style: italic;
font-style: italic;
}
em.foreign-word
{
Expand All @@ -326,20 +333,20 @@ em.didaskalia

em.author-emphasis
{
letter-spacing: 0.1em;
letter-spacing: 0.1em;
}

.person-list em.person
{
font-style: normal;
/*font-variant: small-caps;*/
text-transform: uppercase;
font-style: normal;
/*font-variant: small-caps;*/
text-transform: uppercase;
}

.info
{
text-align: center;
margin-bottom: 1em;
text-align: center;
margin-bottom: 1em;
}
.info div
{
Expand All @@ -348,9 +355,9 @@ em.author-emphasis

.info img
{
margin: 0;
margin-left: 2em;
margin-right: 2em;
margin: 0;
margin-left: 2em;
margin-right: 2em;
}

p.minor-info {
Expand Down
6 changes: 4 additions & 2 deletions librarian/epub/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<h1>Spis treści</h1>
%s
<div id="book-text">
<h1>Spis treści</h1>
%s
</div>
</body>
</html>
9 changes: 2 additions & 7 deletions librarian/epub/xsltAnnotations.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@
</xsl:template>

<xsl:template match="pa|pe|pr|pt" mode="przypis">
<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>
<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>
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="slowo_obce">
Expand Down
Loading

0 comments on commit 45ce20d

Please sign in to comment.