Render titles with smartypants
authorAlex Chan <alex@alexwlchan.net>
Sun, 2 Feb 2020 23:28:51 +0000 (23:28 +0000)
committerAlex Chan <alex@alexwlchan.net>
Sun, 2 Feb 2020 23:28:51 +0000 (23:28 +0000)
requirements.in
requirements.txt
scripts/render_html.py
templates/base.html
templates/list_plans.html
templates/list_reading.html
templates/list_reviews.html
templates/review.html

index 70b9797..376c7c5 100644 (file)
@@ -4,4 +4,5 @@ inquirer
 jinja2
 Markdown
 python-frontmatter
+smartypants
 unidecode
index bb0caed..bc0e278 100644 (file)
@@ -17,6 +17,7 @@ python-frontmatter==0.5.0
 pyyaml==5.3               # via python-frontmatter
 readchar==2.0.1           # via inquirer
 six==1.14.0               # via blessings, python-frontmatter
+smartypants==2.0.1
 unidecode==1.1.1
 
 # The following packages are considered to be unsafe in a requirements file:
index 14bbd53..8f98231 100755 (executable)
@@ -10,9 +10,10 @@ import sys
 
 import attr
 import frontmatter
+from jinja2 import Environment, FileSystemLoader, select_autoescape
 import markdown
 from markdown.extensions.smarty import SmartyExtension
-from jinja2 import Environment, FileSystemLoader, select_autoescape
+import smartypants
 
 
 def rsync(dir1, dir2):
@@ -162,6 +163,7 @@ if __name__ == "__main__":
 
     env.filters["render_markdown"] = render_markdown
     env.filters["render_date"] = render_date
+    env.filters["smartypants"] = smartypants.smartypants
 
     rsync("src/covers/", "_html/covers/")
     rsync("static/", "_html/static/")
index d97c92e..07b2586 100644 (file)
@@ -6,7 +6,7 @@
 
     <link rel="stylesheet" href="/static/style.css">
 
-    <title>{% if title %}{{ title | safe }} {% endif %}📚 lexie&rsquo;s book tracker</title>
+    <title>{% if title %}{{ title | smartypants | safe }} {% endif %}📚 lexie&rsquo;s book tracker</title>
   </head>
   <body>
     {% include "_header.html" %}
index 3a695f9..c43fcfa 100644 (file)
@@ -18,7 +18,7 @@
       </div>
 
       <div class="book_metadata">
-        <p class="title">{{ plan_entry.book.title }}</p>
+        <p class="title">{{ plan_entry.book.title | smartypants | safe }}</p>
         <p>
           <small>
             by {{ plan_entry.book.author }}
index 6f8baf6..62ad46c 100644 (file)
@@ -18,7 +18,7 @@
       </div>
 
       <div class="book_metadata">
-        <p class="title">{{ reading_entry.book.title }}</p>
+        <p class="title">{{ reading_entry.book.title | smartypants | safe }}</p>
         <p>
           <small>
             by {{ reading_entry.book.author }}
index 399bd62..47a69b0 100644 (file)
@@ -45,7 +45,7 @@
         </div>
 
         <div class="book_metadata">
-          <p class="title">{{ review_entry.book.title }}</p>
+          <p class="title">{{ review_entry.book.title | smartypants | safe }}</p>
           <p>
             <small>
               by {{ review_entry.book.author }}
index 88f910b..98746f0 100644 (file)
@@ -8,7 +8,7 @@
     </div>
   {% endif %}
 
-  <h1>My review of <span class="book-title">{{ review_entry.book.title }}</span></h1>
+  <h1>My review of <span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span></h1>
 
   <table class="book_metadata">
     <tr>