Skip to content

Commit 032dbe5

Browse files
committed
added new epub theme
1 parent f96812e commit 032dbe5

22 files changed

+406
-0
lines changed

_themes/epub/epub-cover.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{%- extends "epub/epub-cover.html" %}
2+
3+
{% block content %}
4+
<div class="epub-cover">
5+
<img src="static/cover.png" />
6+
</div>
7+
{% endblock %}

_themes/epub/static/cover.png

130 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../djangodocs/static/docicons-behindscenes.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../djangodocs/static/docicons-note.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../djangodocs/static/docicons-philosophy.png
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../djangodocs/static/docicons-warning.png

_themes/epub/static/epub.css

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
h1 { margin-top: 0; }
2+
3+
/* Keep lists a bit narrow to maximize page estate regarding width. */
4+
ol, ul {
5+
margin: 0;
6+
padding: 0 0 0 1.3em;
7+
}
8+
9+
/* Images should never exceed the width of the page. */
10+
img { max-width: 100%; }
11+
12+
/* Don't display URL after links, this is not print. */
13+
.link-target { display: none; }
14+
15+
/* This is the front cover page of the book. */
16+
.epub-cover { text-align: center; }
17+
.epub-cover h1 { margin: 4em 0 0 0; }
18+
.epub-cover h2 { margin: 1em 0; }
19+
.epub-cover h3 { margin: 3em 0 2em 0; }
20+
21+
/* Code examples should never exceed the width of the page, so wrap instead. */
22+
pre, span.pre { white-space: pre-wrap; }
23+
24+
pre {
25+
background-color: #f6f6f6;
26+
border: 0;
27+
padding: 0.5em;
28+
font-size: 90%;
29+
}
30+
31+
/* Header for some code blocks. */
32+
.snippet-filename {
33+
background-color: #393939;
34+
color: white;
35+
margin: 0;
36+
padding: 0.5em;
37+
font: bold 90% monospace;
38+
}
39+
.snippet-filename + .highlight > pre,
40+
.snippet-filename + pre {
41+
margin-top: 0;
42+
}
43+
44+
a:link, a:visited { color: #396623; }
45+
a:hover { color: #1d3311; }
46+
47+
/* Use special styled note boxes from the default theme, but with the left side
48+
fitted after the icon, to allow text resizing with breaking. */
49+
.note, .admonition {
50+
background-position: 9px 0.8em;
51+
background-repeat: no-repeat;
52+
padding: 0.8em 1em 0.8em 65px;
53+
margin: 1em 0;
54+
border: 0.01em solid black;
55+
}
56+
57+
.note, .admonition { background-image: url(docicons-note.png); }
58+
div.admonition-philosophy { background-image: url(docicons-philosophy.png); }
59+
div.admonition-behind-the-scenes { background-image: url(docicons-behindscenes.png); }
60+
.admonition.warning { background-image: url(docicons-warning.png); }
61+
62+
.admonition-title {
63+
font-weight: bold;
64+
margin: 0;
65+
}
66+
67+
.admonition .last { margin-bottom: 0; }

_themes/epub/theme.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[theme]
2+
inherit = epub
3+
stylesheet = epub.css
4+
pygments_style = sphinx
5+
6+
[options]
7+
relbar1 = false
8+
footer = false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% extends "basic/genindex.html" %}
2+
3+
{% block bodyclass %}{% endblock %}
4+
{% block sidebarwrapper %}{% endblock %}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{% extends "basic/layout.html" %}
2+
3+
{%- macro secondnav() %}
4+
{%- if prev %}
5+
&laquo; <a href="{{ prev.link|e }}" title="{{ prev.title|e }}">previous</a>
6+
{{ reldelim2 }}
7+
{%- endif %}
8+
{%- if parents %}
9+
<a href="{{ parents.0.link|e }}" title="{{ parents.0.title|e }}" accesskey="U">up</a>
10+
{%- else %}
11+
<a title="{{ docstitle }}" href="{{ pathto('index') }}" accesskey="U">up</a>
12+
{%- endif %}
13+
{%- if next %}
14+
{{ reldelim2 }}
15+
<a href="{{ next.link|e }}" title="{{ next.title|e }}">next</a> &raquo;
16+
{%- endif %}
17+
{%- endmacro %}
18+
19+
{% block extrahead %}
20+
{# When building htmlhelp (CHM format) disable jQuery inclusion, #}
21+
{# as it causes problems in compiled CHM files. #}
22+
{% if builder != "htmlhelp" %}
23+
{{ super() }}
24+
<script type="text/javascript" src="{{ pathto('templatebuiltins.js', 1) }}"></script>
25+
<script type="text/javascript">
26+
(function($) {
27+
if (!django_template_builtins) {
28+
// templatebuiltins.js missing, do nothing.
29+
return;
30+
}
31+
$(document).ready(function() {
32+
// Hyperlink Django template tags and filters
33+
var base = "{{ pathto('ref/templates/builtins') }}";
34+
if (base == "#") {
35+
// Special case for builtins.html itself
36+
base = "";
37+
}
38+
// Tags are keywords, class '.k'
39+
$("div.highlight\\-html\\+django span.k").each(function(i, elem) {
40+
var tagname = $(elem).text();
41+
if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
42+
var fragment = tagname.replace(/_/, '-');
43+
$(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
44+
}
45+
});
46+
// Filters are functions, class '.nf'
47+
$("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
48+
var filtername = $(elem).text();
49+
if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
50+
var fragment = filtername.replace(/_/, '-');
51+
$(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
52+
}
53+
});
54+
});
55+
})(jQuery);
56+
</script>
57+
{% endif %}
58+
{% endblock %}
59+
60+
{% block document %}
61+
<div id="custom-doc" class="{% block bodyclass %}{{ 'yui-t6' if pagename != 'index' else '' }}{% endblock %}">
62+
<div id="hd">
63+
<h1><a href="{{ pathto('index') }}">{{ docstitle }}</a></h1>
64+
<div id="global-nav">
65+
<a title="Home page" href="{{ pathto('index') }}">Home</a> {{ reldelim2 }}
66+
<a title="Table of contents" href="{{ pathto('contents') }}">Table of contents</a> {{ reldelim2 }}
67+
<a title="Global index" href="{{ pathto('genindex') }}">Index</a> {{ reldelim2 }}
68+
<a title="Module index" href="{{ pathto('py-modindex') }}">Modules</a>
69+
</div>
70+
<div class="nav">{{ secondnav() }}</div>
71+
</div>
72+
73+
<div id="bd">
74+
<div id="yui-main">
75+
<div class="yui-b">
76+
<div class="yui-g" id="{{ pagename|replace('/', '-') }}">
77+
{% block body %}{% endblock %}
78+
</div>
79+
</div>
80+
</div>
81+
{% block sidebarwrapper %}
82+
{% if pagename != 'index' %}
83+
<div class="yui-b" id="sidebar">
84+
{{ sidebar() }}
85+
{%- if last_updated %}
86+
<h3>Last update:</h3>
87+
<p class="topless">{{ last_updated }}</p>
88+
{%- endif %}
89+
</div>
90+
{% endif %}
91+
{% endblock %}
92+
</div>
93+
94+
<div id="ft">
95+
<div class="nav">{{ secondnav() }}</div>
96+
</div>
97+
</div>
98+
{% endblock %}
99+
100+
{% block sidebarrel %}
101+
<h3>Browse</h3>
102+
<ul>
103+
{% if prev %}
104+
<li>Prev: <a href="{{ prev.link }}">{{ prev.title }}</a></li>
105+
{% endif %}
106+
{% if next %}
107+
<li>Next: <a href="{{ next.link }}">{{ next.title }}</a></li>
108+
{% endif %}
109+
</ul>
110+
<h3>You are here:</h3>
111+
<ul>
112+
<li>
113+
<a href="{{ pathto('index') }}">{{ docstitle }}</a>
114+
{% for p in parents %}
115+
<ul><li><a href="{{ p.link }}">{{ p.title }}</a>
116+
{% endfor %}
117+
<ul><li>{{ title }}</li></ul>
118+
{% for p in parents %}</li></ul>{% endfor %}
119+
</li>
120+
</ul>
121+
{% endblock %}
122+
123+
{# Empty some default blocks out #}
124+
{% block relbar1 %}{% endblock %}
125+
{% block relbar2 %}{% endblock %}
126+
{% block sidebar1 %}{% endblock %}
127+
{% block sidebar2 %}{% endblock %}
128+
{% block footer %}{% endblock %}

0 commit comments

Comments
 (0)