Add a notion of "retired" books, for recording stuff I'll never read
authorAlex Chan <alex@alexwlchan.net>
Sat, 29 Feb 2020 11:50:46 +0000 (11:50 +0000)
committerAlex Chan <alex@alexwlchan.net>
Sat, 29 Feb 2020 11:50:46 +0000 (11:50 +0000)
scripts/render_html.py
src/plans/the-students-introduction-to-mathematica.md [deleted file]
src/will_never_read/the-students-introduction-to-mathematica.md [new file with mode: 0644]
templates/_inline_book_list.html [new file with mode: 0644]
templates/list_plans.html
templates/list_will_never_read.html [new file with mode: 0644]

index b68ae98..ac0e5ad 100755 (executable)
@@ -115,7 +115,7 @@ def get_plan_entry_from_path(path):
     post = frontmatter.load(path)
 
     book = Book(**post["book"])
-    plan = Plan(**post["plan"], text=post.content)
+    plan = Plan(date_added=post["plan"]["date_added"], text=post.content)
 
     return PlanEntry(path=path, book=book, plan=plan)
 
@@ -274,6 +274,25 @@ def main():
     out_path.parent.mkdir(exist_ok=True, parents=True)
     out_path.write_text(html)
 
+    # Render the "never going to read this page"
+
+    all_retired = list(
+        get_entries(dirpath="src/will_never_read", constructor=get_plan_entry_from_path)
+    )
+
+    all_retired = sorted(
+        all_retired, key=lambda plan: plan.plan.date_added, reverse=True
+    )
+
+    template = env.get_template("list_will_never_read.html")
+    html = template.render(
+        all_retired=all_retired, title="books i&rsquo;m never going to read"
+    )
+
+    out_path = pathlib.Path("_html") / "will-never-read/index.html"
+    out_path.parent.mkdir(exist_ok=True, parents=True)
+    out_path.write_text(html)
+
     # Render the front page
 
     index_template = env.get_template("index.html")
diff --git a/src/plans/the-students-introduction-to-mathematica.md b/src/plans/the-students-introduction-to-mathematica.md
deleted file mode 100644 (file)
index fb08cd7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
----
-book:
-  author: Bruce F. Torrence
-  cover_image: the-students-introduction-to-mathematica-r.jpg
-  publication_year: '2009'
-  title: The Student's Introduction to Mathematica
-plan:
-  date_added: '2019-08-14'
----
diff --git a/src/will_never_read/the-students-introduction-to-mathematica.md b/src/will_never_read/the-students-introduction-to-mathematica.md
new file mode 100644 (file)
index 0000000..1ff3a14
--- /dev/null
@@ -0,0 +1,19 @@
+---
+book:
+  author: Bruce F. Torrence
+  cover_image: the-students-introduction-to-mathematica-r.jpg
+  publication_year: '2009'
+  title: The Student's Introduction to Mathematica
+plan:
+  date_added: '2019-08-14'
+retired:
+  date_retired: '2020-02-29'
+---
+
+I got a copy of this book when I was a student, because the university gave us copies of Mathematica and I was using it for my coursework.
+I dipped into it, but I've never read it cover to cover.
+
+It's been six years since I left university, I no longer use or have access to Mathematica, and if I had any serious maths to do, I'd probably use scientific Python.
+(And the book has been revised by then; who knows if Mathematica still looks like what it describes.)
+
+It turns out I tried to sell this book on Amazon years ago, and didn't get any takers, so I'm donating it to the local charity bookshop.
diff --git a/templates/_inline_book_list.html b/templates/_inline_book_list.html
new file mode 100644 (file)
index 0000000..a7e671f
--- /dev/null
@@ -0,0 +1,27 @@
+{% for book_entry in all_books %}
+<div class="reading">
+  <div class="reading_inner">
+    <div class="book_thumbnail">
+      {% set book = book_entry.book %}
+      {% include "_book_cover.html" %}
+    </div>
+
+    <div class="book_metadata">
+      <p class="title">{{ book_entry.book.title | smartypants | safe }}</p>
+      <p>
+        <small>
+          by {{ book_entry.book.author }}
+          {%- if book_entry.book.publication_year %}
+            ({{ book_entry.book.publication_year}})
+          {%- endif -%}
+        </small>
+      </p>
+    </div>
+  </div>
+  {% if book_entry.plan.text %}
+  <div class="note">
+    {{ book_entry.plan.text | render_markdown | safe }}
+  </div>
+  {% endif %}
+</div>
+{% endfor %}
index c43fcfa..ac41dd0 100644 (file)
@@ -9,31 +9,6 @@
 
   <h2>books i want to read</h2>
 
-  {% for plan_entry in all_plans %}
-  <div class="reading">
-    <div class="reading_inner">
-      <div class="book_thumbnail">
-        {% set book = plan_entry.book %}
-        {% include "_book_cover.html" %}
-      </div>
-
-      <div class="book_metadata">
-        <p class="title">{{ plan_entry.book.title | smartypants | safe }}</p>
-        <p>
-          <small>
-            by {{ plan_entry.book.author }}
-            {%- if plan_entry.book.publication_year %}
-              ({{ plan_entry.book.publication_year}})
-            {%- endif -%}
-          </small>
-        </p>
-      </div>
-    </div>
-    {% if plan_entry.plan.text %}
-    <div class="note">
-      {{ plan_entry.plan.text | render_markdown | safe }}
-    </div>
-    {% endif %}
-  </div>
-  {% endfor %}
+  {% set all_books = all_plans %}
+  {% include "_inline_book_list.html" %}
 {% endblock %}
\ No newline at end of file
diff --git a/templates/list_will_never_read.html b/templates/list_will_never_read.html
new file mode 100644 (file)
index 0000000..e4d5866
--- /dev/null
@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+
+{% block content %}
+  <p class="nav">
+    <a href="/reviews">read</a> /
+    <a href="/reading">reading</a> /
+    <a href="/to-read">to read</a>
+  </p>
+
+  <h2>books i wanted to read once, but never will</h2>
+
+  <p>
+    This page is a list of books that I thought I might read at some point, but I realised I&rsquo;d never get to and I removed from my TBR pile.
+  </p>
+
+  {% set all_books = all_retired %}
+  {% include "_inline_book_list.html" %}
+{% endblock %}