Skip to content

Commit d6fe1da

Browse files
committed
Initial book relayout.
1 parent d930e40 commit d6fe1da

File tree

10 files changed

+164
-32
lines changed

10 files changed

+164
-32
lines changed

doc/source/0_preface.rst

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,29 @@ scratch in :numref:`Chapter %s <programs_files>`.
8989
How to use this book
9090
--------------------
9191

92-
You can, of course, simply sit down and read this book from cover to cover, or
93-
dip in to see what it has to say on particular subjects. However, reading a
94-
book about programming will not teach you to program. For that, you need to get
95-
your hands dirty writing code and debugging your mistakes. To help with this
96-
there is a book website at:
97-
98-
`https://object-oriented-programming.github.io
99-
<https://object-oriented-programming.github.io>`__
100-
101-
As well as a web version of the full text of the book, the website contains
102-
videos and the code needed to do the programming exercises at the end of each
103-
chapter.
92+
.. only:: latex
93+
94+
You can, of course, simply sit down and read this book from cover to cover,
95+
or dip in to see what it has to say on particular subjects. However,
96+
reading a book about programming will not teach you to program. For that,
97+
you need to get your hands dirty writing code and debugging your mistakes.
98+
To help with this there is a book website at:
99+
100+
`https://object-oriented-programming.github.io
101+
<https://object-oriented-programming.github.io>`__
102+
103+
As well as a web version of the full text of the book, the website contains
104+
videos and the code needed to do the programming exercises at the end of
105+
each chapter.
106+
107+
.. only:: html
108+
109+
You can, of course, simply sit down and read this book from cover to cover,
110+
or dip in to see what it has to say on particular subjects. However,
111+
reading a book about programming will not teach you to program. For that,
112+
you need to get your hands dirty writing code and debugging your mistakes.
113+
The videos and exercises throughout the book are designed to help you do
114+
this.
104115

105116
The videos
106117
..........

doc/source/1_introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ are:
102102
.. only:: html
103103

104104
Installation instructions for these pieces of code are provided `on this
105-
page <https://object-oriented-programming.github.io/installation.html>`__`.
105+
page <https://object-oriented-programming.github.io/installation.html>`__.
106106

107107
This is not a course about Git, but a minimal familiarity with Git and GitHub
108108
will be needed in order to work with the examples. :numref:`Appendix %s <git>`
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /usr/bin/env python3
2+
import os
3+
4+
dirname = os.path.dirname(__file__)
5+
6+
with open(os.path.join(dirname, "..", "..", "build", "book", "videos.csv"),
7+
"r") as videos:
8+
with open(os.path.join(dirname, "..", "videos.csv"), "w") as out:
9+
10+
for video in videos:
11+
video = video.split("Video: ")
12+
video[1] = video[1][0].upper() + video[1][1:]
13+
out.write("".join(video))

doc/source/_themes/finite_element/layout.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<div id="access">
2828
<div class="menu">
2929
<ul>
30+
<li class="page_item"><a href="{{ pathto('index.html', 1) }}" title="Book">Book</a></li>
31+
<li class="page_item"><a href="{{ pathto('videos.html', 1) }}" title="Videos">Videos</a></li>
32+
<li class="page_item"><a href="{{ pathto('exercises.html', 1) }}" title="Exercises">Exercises</a></li>
33+
3034
<li class="page_item"><a href="https://github.com/object-oriented-python/object-oriented-programming" title="GitHub">GitHub</a></li>
3135
</ul>
3236
</div><!-- .menu -->

doc/source/_themes/finite_element/static/fenics.css_t

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
body {
1818
font-family: Verdana, Geneva, sans-serif;
19-
font-size: 14px;
19+
font-size: 1rem;
2020
background-color: #ffffff;
2121
color: #ffffff;
2222
margin: 0; padding: 0;
@@ -68,7 +68,7 @@ div.body {
6868
background-color: #ffffff;
6969
color: #3E4349;
7070
padding: 0 30px 30px 30px;
71-
font-size: 14px;
71+
font-size: 1rem;
7272
overflow: auto;
7373
}
7474

@@ -77,7 +77,7 @@ div.footer {
7777
width: 100%;
7878
padding: 13px 0;
7979
text-align: center;
80-
font-size: 13px;
80+
font-size: .875rem;
8181
background: #000;
8282
clear:both;
8383
}
@@ -94,7 +94,7 @@ div.footer a:hover {
9494
div.related {
9595
line-height: 30px;
9696
color: #373839;
97-
font-size: 12px;
97+
font-size: 0.75rem;
9898
background-color: #eee;
9999
}
100100

@@ -147,7 +147,7 @@ a.commit-link {
147147

148148
pre.commit {
149149
clear: both;
150-
font-size: 12px;
150+
font-size: 0.75rem;
151151
}
152152

153153
p.sidebar-title {
@@ -220,16 +220,37 @@ div.body h6 {
220220
}
221221

222222
h1 .section-number::before {
223-
content: "Week ";
223+
content: "Chapter ";
224+
}
225+
226+
#getting-help h1 .section-number::before,
227+
#just-enough-git-to-get-by h1 .section-number::before {
228+
content: "Appendix ";
229+
}
230+
231+
#preface h1 .section-number::before {
232+
content: "";
224233
}
225234

226235
.toctree-l1 > a::before {
227-
content: "Week ";
236+
content: "Chapter ";
237+
}
238+
239+
.appendix.docutils.container .toctree-l1 > a::before {
240+
content: "Appendix ";
241+
}
242+
243+
.preface.docutils.container .toctree-l1 > a::before {
244+
content: "";
245+
}
246+
247+
.toctree-l1 > a::before {
248+
content: "Chapter ";
228249
}
229250

230251
a.headerlink {
231252
color: #1b61d6;
232-
font-size: 12px;
253+
font-size: 0.75rem;
233254
padding: 0 4px 0 4px;
234255
text-decoration: none;
235256
}
@@ -327,7 +348,7 @@ pre, code {
327348
}
328349

329350
.highlight pre {
330-
font-size: 14px;
351+
font-size: 1rem;
331352
line-height: 17px;
332353
background-color: #fafafa;
333354
padding: 10px;
@@ -350,7 +371,7 @@ div.linenodiv {
350371
}
351372

352373
.linenos pre {
353-
font-size: 14px;
374+
font-size: 1rem;
354375
line-height: 17px;
355376
padding: 10px;
356377
margin: 0;
@@ -391,7 +412,7 @@ div.quiz {
391412
tt {
392413
background-color: transparent;
393414
color: #222;
394-
font-size: 14px;
415+
font-size: 1rem;
395416
font-family: Consolas, "andale mono", "lucida console", monospace;
396417
}
397418

@@ -473,7 +494,7 @@ tt.xref {
473494
}
474495
#access .menu-header,
475496
div.menu {
476-
font-size: 13px;
497+
font-size: .875rem;
477498
margin-right: 20px;
478499
width: 100%;
479500
}
@@ -582,6 +603,14 @@ div.menu li {
582603
left:690px;
583604
}
584605

606+
.preface.docutils.container,
607+
.appendix.docutils.container {
608+
margin:0;
609+
padding-left:0;
610+
padding-right:0;
611+
width:100%;
612+
}
613+
585614
#container,
586615
#content {
587616
margin:0;
@@ -597,7 +626,7 @@ padding-left: 1em;
597626
}
598627

599628
#sub-feature {
600-
font-size:13px;
629+
font-size:.875rem;
601630
line-height:18px;
602631
position:relative;
603632
overflow:hidden;
@@ -664,7 +693,7 @@ a.button {
664693
-moz-border-radius: .7em;
665694
border-radius: .7em;
666695
color:#667;
667-
font-size:13px;
696+
font-size:.875rem;
668697
margin:0 10px 0 0;
669698
padding:.75em 1.25em;
670699
text-decoration:none;
@@ -745,7 +774,7 @@ img[alt="build status"] {
745774
margin:10px 0px 10px 0px;
746775
/*padding:10px 5px 50px 5px;*/
747776
font-weight:bold;
748-
font-size:16px;
777+
font-size:1.125rem;
749778
}
750779

751780
.feed_item {
@@ -755,7 +784,7 @@ img[alt="build status"] {
755784
}
756785

757786
.feed_item_date {
758-
font-size: 12px;
787+
font-size: .75rem;
759788
}
760789

761790
/* Equispace the logos. */

doc/source/a1_help.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Getting help
23
------------
34

doc/source/exercises.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Exercise code
2+
=============
3+
4+
These are the GitHub template repositories to use for the exercises in each
5+
Chapter. For further information on using GitHub template repositories, see
6+
:numref:`Appendix %s <git>`.
7+
8+
If you are using this book as a part of a course where the instructor provides
9+
GitHub Classroom assignments for the exercises, you should not use the links
10+
here but rather use the Classroom links provided by your instructor.
11+
12+
13+
* `Chapter 2 exercises <https://github.com/object-oriented-python/exercises-chapter-2>`__
14+
* `Chapter 3 exercises <https://github.com/object-oriented-python/exercises-chapter-3>`__
15+
* `Chapter 4 exercises <https://github.com/object-oriented-python/exercises-chapter-4>`__
16+
* `Chapter 5 exercises <https://github.com/object-oriented-python/exercises-chapter-5>`__
17+
* `Chapter 6 exercises <https://github.com/object-oriented-python/exercises-chapter-6>`__
18+
* `Chapter 7 exercises <https://github.com/object-oriented-python/exercises-chapter-7>`__
19+
* `Chapter 8 exercises <https://github.com/object-oriented-python/exercises-chapter-8>`__
20+
* `Chapter 9 exercises <https://github.com/object-oriented-python/exercises-chapter-9>`__
21+
* `Chapter 10 exercises <https://github.com/object-oriented-python/exercises-chapter-10>`__
22+
23+

doc/source/index.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
would be very interested to hear from anyone interested in using it to
3131
teach.
3232

33+
.. container:: preface
34+
35+
.. toctree::
36+
:maxdepth: 2
37+
38+
0_preface.rst
39+
3340
.. toctree::
3441
:numbered:
3542
:maxdepth: 2
@@ -45,13 +52,11 @@
4552
9_trees_and_directed_acyclic_graphs.rst
4653
10_further_object-oriented_features.rst
4754

48-
.. .. only:: latex and not book
49-
5055
.. raw:: latex
5156

5257
\appendix
5358

54-
.. only:: latex
59+
.. container:: appendix
5560

5661
.. toctree::
5762
:numbered:

doc/source/videos.csv

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
1.1, `Setting up your virtual environment. <https://player.vimeo.com/video/486546635>`_
2+
2.1, `A first Python script. <https://player.vimeo.com/video/486557682>`_
3+
2.2, `A first Python module. <https://player.vimeo.com/video/486845755>`_
4+
2.3, `A first Python package. <https://player.vimeo.com/video/487003753>`_
5+
2.4, `Introducing Pytest. <https://player.vimeo.com/video/486987209>`_
6+
3.1, `A first class <https://player.vimeo.com/video/488143930>`_
7+
3.2, `Defining methods <https://player.vimeo.com/video/488273256>`_
8+
3.3, `Printing classes <https://player.vimeo.com/video/488275072>`_
9+
3.4, `Object equality and test driven development <https://player.vimeo.com/video/488981397>`_
10+
3.5, `Polynomial addition. <https://player.vimeo.com/video/489009900>`_
11+
4.1, `Why style? <https://player.vimeo.com/video/499766703>`_
12+
4.2, `Installing and using a linter. <https://player.vimeo.com/video/499770130>`_
13+
5.1, `Stacks as an abstract data type. <https://player.vimeo.com/video/506479213>`_
14+
5.2, `Dynamic arrays and algorithmic complexity. <https://player.vimeo.com/video/506479208>`_
15+
5.3, `Deques and ring buffers. <https://player.vimeo.com/video/506710190>`_
16+
5.4, `Linked lists. <https://player.vimeo.com/video/506743244>`_
17+
5.5, `The iterator protocol. <https://player.vimeo.com/video/506743250>`_
18+
6.1, `Errors and exceptions. <https://player.vimeo.com/video/509280820>`_
19+
6.2, `Tracebacks. <https://player.vimeo.com/video/509280880>`_
20+
6.3, `The call stack. <https://player.vimeo.com/video/509281576>`_
21+
6.4, `Raising an exception. <https://player.vimeo.com/video/509492490>`_
22+
6.5, `Handling exceptions. <https://player.vimeo.com/video/509492495>`_
23+
6.6, `Further exception handling. <https://player.vimeo.com/video/509492496>`_
24+
7.1, `Inheritance and composition. <https://player.vimeo.com/video/516216973>`_
25+
7.2, `An example from group theory. <https://player.vimeo.com/video/516277973>`_
26+
7.3, `Inheritance. <https://player.vimeo.com/video/516698411>`_
27+
8.1, `Using a graphical debugger. <https://player.vimeo.com/video/520604326>`_
28+
8.2, `Command line debuggers. <https://player.vimeo.com/video/520605730>`_
29+
8.3, `Minimal failing examples and bisection. <https://player.vimeo.com/video/520604328>`_
30+
9.1, `Splat and double splat. <https://player.vimeo.com/video/523477744>`_
31+
9.2, `Tree data structures. <https://player.vimeo.com/video/523477713>`_
32+
9.3, `Tree traversal. <https://player.vimeo.com/video/523477719>`_
33+
9.4, `Evaluating expressions. <https://player.vimeo.com/video/523478799>`_
34+
10.1, `Decorators. <https://player.vimeo.com/video/526946976>`_
35+
10.2, `Abstract base classes. <https://player.vimeo.com/video/526947635>`_
36+
10.3, `Virtual subclasses. <https://player.vimeo.com/video/526947427>`_

doc/source/videos.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Videos
2+
======
3+
4+
This is the full list of videos accompanying Object-oriented Programming in
5+
Python for Mathematicians. The videos are also embedded in the web version of
6+
the book.
7+
8+
.. csv-table::
9+
:file: videos.csv
10+
:widths: auto

0 commit comments

Comments
 (0)