Skip to content

Commit b12a5ac

Browse files
committed
add clickable on-hover anchor things, thanks Kim
fix cosmicpython/book#295
1 parent e58edcf commit b12a5ac

23 files changed

+479
-252
lines changed

book/appendix_csvs.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313

1414
/* customisations by harry */
1515

16+
h1, h2, h3, h4, h5, h6 {
17+
position: relative;
18+
}
19+
20+
a.anchor {
21+
top: 0;
22+
}
23+
1624
/* hide inline ditaa/plantuml source listings for images */
1725
.image-source {
1826
display: none
@@ -70,7 +78,9 @@
7078

7179
/* Text styles */
7280
h1{color:var(--primarycolor) !important;}
81+
7382
h2,h3,h4,h5,h6{color:var(--secondarycolor) !important;}
83+
7484
.title{color:var(--tertiarycolor) !important; font-family:"Noto Sans",sans-serif !important;font-style: normal !important; font-weight: normal !important;}
7585
p{font-family: "Noto Sans",sans-serif !important}
7686

@@ -128,7 +138,7 @@
128138
</div>
129139
<div id="content">
130140
<div class="sect1">
131-
<h2 id="appendix_csvs">Appendix C: Swapping Out the Infrastructure: Do Everything with CSVs</h2>
141+
<h2 id="appendix_csvs">Appendix C: Swapping Out the Infrastructure: Do Everything with CSVs<a class="anchor" href="#appendix_csvs"></a>Appendix A: Swapping Out the Infrastructure: </h2>
132142
<div class="sectionbody">
133143
<div class="paragraph">
134144
<p>
@@ -309,7 +319,7 @@ <h2 id="appendix_csvs">Appendix C: Swapping Out the Infrastructure: Do Everythin
309319
with CSVs underlying them instead of a database. And as you&#8217;ll see, it really is relatively straightforward.</p>
310320
</div>
311321
<div class="sect2">
312-
<h3 id="_implementing_a_repository_and_unit_of_work_for_csvs">Implementing a Repository and Unit of Work for CSVs</h3>
322+
<h3 id="_implementing_a_repository_and_unit_of_work_for_csvs"><a class="anchor" href="#_implementing_a_repository_and_unit_of_work_for_csvs"></a>Implementing a Repository and Unit of Work for CSVs</h3>
313323
<div class="paragraph">
314324
<p>
315325
Here&#8217;s what a CSV-based repository could look like. It abstracts away all the

book/appendix_django.html

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313

1414
/* customisations by harry */
1515

16+
h1, h2, h3, h4, h5, h6 {
17+
position: relative;
18+
}
19+
20+
a.anchor {
21+
top: 0;
22+
}
23+
1624
/* hide inline ditaa/plantuml source listings for images */
1725
.image-source {
1826
display: none
@@ -70,7 +78,9 @@
7078

7179
/* Text styles */
7280
h1{color:var(--primarycolor) !important;}
81+
7382
h2,h3,h4,h5,h6{color:var(--secondarycolor) !important;}
83+
7484
.title{color:var(--tertiarycolor) !important; font-family:"Noto Sans",sans-serif !important;font-style: normal !important; font-weight: normal !important;}
7585
p{font-family: "Noto Sans",sans-serif !important}
7686

@@ -128,7 +138,7 @@
128138
</div>
129139
<div id="content">
130140
<div class="sect1">
131-
<h2 id="appendix_django">Appendix D: Repository and Unit of Work Patterns with Django</h2>
141+
<h2 id="appendix_django">Appendix D: Repository and Unit of Work Patterns with Django<a class="anchor" href="#appendix_django"></a>Appendix A: Repository and Unit of Work </h2>
132142
<div class="sectionbody">
133143
<div class="paragraph">
134144
<p>
@@ -197,7 +207,7 @@ <h2 id="appendix_django">Appendix D: Repository and Unit of Work Patterns with D
197207
</table>
198208
</div>
199209
<div class="sect2">
200-
<h3 id="_repository_pattern_with_django">Repository Pattern with Django</h3>
210+
<h3 id="_repository_pattern_with_django"><a class="anchor" href="#_repository_pattern_with_django"></a>Repository Pattern with Django</h3>
201211
<div class="paragraph">
202212
<p>
203213

@@ -302,7 +312,7 @@ <h3 id="_repository_pattern_with_django">Repository Pattern with Django</h3>
302312
some custom methods for translating to and from our domain model.<sup class="footnote">[<a id="_footnoteref_1" class="footnote" href="#_footnotedef_1" title="View footnote.">1</a>]</sup></p>
303313
</div>
304314
<div class="sect3">
305-
<h4 id="_custom_methods_on_django_orm_classes_to_translate_tofrom_our_domain_model">Custom Methods on Django ORM Classes to Translate to/from Our Domain Model</h4>
315+
<h4 id="_custom_methods_on_django_orm_classes_to_translate_tofrom_our_domain_model"><a class="anchor" href="#_custom_methods_on_django_orm_classes_to_translate_tofrom_our_domain_model"></a>Custom Methods on Django ORM Classes to Translate to/from Our Domain Model</h4>
306316
<div class="paragraph">
307317
<p>
308318

@@ -388,7 +398,7 @@ <h4 id="_custom_methods_on_django_orm_classes_to_translate_tofrom_our_domain_mod
388398
</div>
389399
</div>
390400
<div class="sect2">
391-
<h3 id="_unit_of_work_pattern_with_django">Unit of Work Pattern with Django</h3>
401+
<h3 id="_unit_of_work_pattern_with_django"><a class="anchor" href="#_unit_of_work_pattern_with_django"></a>Unit of Work Pattern with Django</h3>
392402
<div class="paragraph">
393403
<p>
394404

@@ -502,7 +512,7 @@ <h3 id="_unit_of_work_pattern_with_django">Unit of Work Pattern with Django</h3>
502512
</div>
503513
</div>
504514
<div class="sect2">
505-
<h3 id="_api_django_views_are_adapters">API: Django Views Are Adapters</h3>
515+
<h3 id="_api_django_views_are_adapters"><a class="anchor" href="#_api_django_views_are_adapters"></a>API: Django Views Are Adapters</h3>
506516
<div class="paragraph">
507517
<p>
508518

@@ -552,7 +562,7 @@ <h3 id="_api_django_views_are_adapters">API: Django Views Are Adapters</h3>
552562
</div>
553563
</div>
554564
<div class="sect2">
555-
<h3 id="_why_was_this_all_so_hard">Why Was This All So Hard?</h3>
565+
<h3 id="_why_was_this_all_so_hard"><a class="anchor" href="#_why_was_this_all_so_hard"></a>Why Was This All So Hard?</h3>
556566
<div class="paragraph">
557567
<p>
558568
OK, it works, but it does feel like more effort than Flask/SQLAlchemy. Why is
@@ -587,7 +597,7 @@ <h3 id="_why_was_this_all_so_hard">Why Was This All So Hard?</h3>
587597
</div>
588598
</div>
589599
<div class="sect2">
590-
<h3 id="_what_to_do_if_you_already_have_django">What to Do If You Already Have Django</h3>
600+
<h3 id="_what_to_do_if_you_already_have_django"><a class="anchor" href="#_what_to_do_if_you_already_have_django"></a>What to Do If You Already Have Django</h3>
591601
<div class="paragraph">
592602
<p>
593603
So what should you do if you want to apply some of the patterns in this book
@@ -628,7 +638,7 @@ <h3 id="_what_to_do_if_you_already_have_django">What to Do If You Already Have D
628638
</div>
629639
</div>
630640
<div class="sect2">
631-
<h3 id="_steps_along_the_way">Steps Along the Way</h3>
641+
<h3 id="_steps_along_the_way"><a class="anchor" href="#_steps_along_the_way"></a>Steps Along the Way</h3>
632642
<div class="paragraph">
633643
<p>
634644
Suppose you&#8217;re working on a Django project that you&#8217;re not sure is going

book/appendix_ds1_table.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313

1414
/* customisations by harry */
1515

16+
h1, h2, h3, h4, h5, h6 {
17+
position: relative;
18+
}
19+
20+
a.anchor {
21+
top: 0;
22+
}
23+
1624
/* hide inline ditaa/plantuml source listings for images */
1725
.image-source {
1826
display: none
@@ -70,7 +78,9 @@
7078

7179
/* Text styles */
7280
h1{color:var(--primarycolor) !important;}
81+
7382
h2,h3,h4,h5,h6{color:var(--secondarycolor) !important;}
83+
7484
.title{color:var(--tertiarycolor) !important; font-family:"Noto Sans",sans-serif !important;font-style: normal !important; font-weight: normal !important;}
7585
p{font-family: "Noto Sans",sans-serif !important}
7686

@@ -128,7 +138,7 @@
128138
</div>
129139
<div id="content">
130140
<div class="sect1">
131-
<h2 id="appendix_ds1_table">Appendix A: Summary Diagram and Table</h2>
141+
<h2 id="appendix_ds1_table">Appendix A: Summary Diagram and Table<a class="anchor" href="#appendix_ds1_table"></a>Appendix A: Summary Diagram and Table</h2>
132142
<div class="sectionbody">
133143
<div class="paragraph">
134144
<p>

book/appendix_project_structure.html

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313

1414
/* customisations by harry */
1515

16+
h1, h2, h3, h4, h5, h6 {
17+
position: relative;
18+
}
19+
20+
a.anchor {
21+
top: 0;
22+
}
23+
1624
/* hide inline ditaa/plantuml source listings for images */
1725
.image-source {
1826
display: none
@@ -70,7 +78,9 @@
7078

7179
/* Text styles */
7280
h1{color:var(--primarycolor) !important;}
81+
7382
h2,h3,h4,h5,h6{color:var(--secondarycolor) !important;}
83+
7484
.title{color:var(--tertiarycolor) !important; font-family:"Noto Sans",sans-serif !important;font-style: normal !important; font-weight: normal !important;}
7585
p{font-family: "Noto Sans",sans-serif !important}
7686

@@ -128,7 +138,7 @@
128138
</div>
129139
<div id="content">
130140
<div class="sect1">
131-
<h2 id="appendix_project_structure">Appendix B: A Template Project Structure</h2>
141+
<h2 id="appendix_project_structure">Appendix B: A Template Project Structure<a class="anchor" href="#appendix_project_structure"></a>Appendix A: A Template Project Structure</h2>
132142
<div class="sectionbody">
133143
<div class="paragraph">
134144
<p>
@@ -257,7 +267,7 @@ <h2 id="appendix_project_structure">Appendix B: A Template Project Structure</h2
257267
<p>Let&#8217;s look at a few of these files and concepts in more detail.</p>
258268
</div>
259269
<div class="sect2">
260-
<h3 id="_env_vars_12_factor_and_config_inside_and_outside_containers">Env Vars, 12-Factor, and Config, Inside and Outside Containers</h3>
270+
<h3 id="_env_vars_12_factor_and_config_inside_and_outside_containers"><a class="anchor" href="#_env_vars_12_factor_and_config_inside_and_outside_containers"></a>Env Vars, 12-Factor, and Config, Inside and Outside Containers</h3>
261271
<div class="paragraph">
262272
<p>The basic problem we&#8217;re trying to solve here is that we need different
263273
config settings for the following:</p>
@@ -283,7 +293,7 @@ <h3 id="_env_vars_12_factor_and_config_inside_and_outside_containers">Env Vars,
283293
</div>
284294
</div>
285295
<div class="sect2">
286-
<h3 id="_config_py">Config.py</h3>
296+
<h3 id="_config_py"><a class="anchor" href="#_config_py"></a>Config.py</h3>
287297
<div class="paragraph">
288298
<p>Whenever our application code needs access to some config, it&#8217;s going to
289299
get it from a file called <em>config.py</em>. Here are a couple of examples from our
@@ -347,7 +357,7 @@ <h3 id="_config_py">Config.py</h3>
347357
</div>
348358
</div>
349359
<div class="sect2">
350-
<h3 id="_docker_compose_and_containers_config">Docker-Compose and Containers Config</h3>
360+
<h3 id="_docker_compose_and_containers_config"><a class="anchor" href="#_docker_compose_and_containers_config"></a>Docker-Compose and Containers Config</h3>
351361
<div class="paragraph">
352362
<p>We use a lightweight Docker container orchestration tool called <em>docker-compose</em>.
353363
It&#8217;s main configuration is via a YAML file (sigh):<sup class="footnote">[<a id="_footnoteref_5" class="footnote" href="#_footnotedef_5" title="View footnote.">5</a>]</sup></p>
@@ -448,7 +458,7 @@ <h3 id="_docker_compose_and_containers_config">Docker-Compose and Containers Con
448458
</div>
449459
</div>
450460
<div class="sect2">
451-
<h3 id="_installing_your_source_as_a_package">Installing Your Source as a Package</h3>
461+
<h3 id="_installing_your_source_as_a_package"><a class="anchor" href="#_installing_your_source_as_a_package"></a>Installing Your Source as a Package</h3>
452462
<div class="paragraph">
453463
<p>All our application code (everything except tests, really) lives inside an
454464
<em>src</em> folder:</p>
@@ -501,7 +511,7 @@ <h3 id="_installing_your_source_as_a_package">Installing Your Source as a Packag
501511
</div>
502512
</div>
503513
<div class="sect2">
504-
<h3 id="_dockerfile">Dockerfile</h3>
514+
<h3 id="_dockerfile"><a class="anchor" href="#_dockerfile"></a>Dockerfile</h3>
505515
<div class="paragraph">
506516
<p>Dockerfiles are going to be very project-specific, but here are a few key stages
507517
you&#8217;ll expect to see:</p>
@@ -573,7 +583,7 @@ <h3 id="_dockerfile">Dockerfile</h3>
573583
</div>
574584
</div>
575585
<div class="sect2">
576-
<h3 id="_tests">Tests</h3>
586+
<h3 id="_tests"><a class="anchor" href="#_tests"></a>Tests</h3>
577587
<div class="paragraph">
578588
<p>
579589
Our tests are kept alongside everything else, as shown here:</p>
@@ -611,7 +621,7 @@ <h3 id="_tests">Tests</h3>
611621
</div>
612622
</div>
613623
<div class="sect2">
614-
<h3 id="_wrap_up">Wrap-Up</h3>
624+
<h3 id="_wrap_up"><a class="anchor" href="#_wrap_up"></a>Wrap-Up</h3>
615625
<div class="paragraph">
616626
<p>These are our basic building blocks:</p>
617627
</div>

0 commit comments

Comments
 (0)