From c894f5ef3546e3d6d5bb2a24d52ead1826662a6c Mon Sep 17 00:00:00 2001 From: Fabien Basmaison Date: Wed, 26 May 2021 13:21:06 +0200 Subject: [PATCH] Update subtitle behaviour: - on Book - Remove problematic punctuation (locale and multiple punctuation if the title ends with `?`, `!` or similar). - Update view. - Use proper semantic to split combined title into `name`, `alternativeHeadline` and series-related microdata. - The author is not a subtitle, just data. - Use parenthesis in the `get_title` filter instead of punctuation. --- bookwyrm/templates/book/book.html | 39 ++++++++++++++++++------------ bookwyrm/templatetags/utilities.py | 2 +- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index af223020..94f326e6 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -8,28 +8,35 @@
-

- - {{ book.title }}{% if book.subtitle %}: - {{ book.subtitle }} +

+ {{ book.title }} +

+ + {% if book.subtitle or book.series %} +

+ {% if book.subtitle %} + + + {{ book.subtitle }} {% endif %} - - {% if book.series %} - - + {% if book.series %} + + - ({{ book.series }} {% if book.series_number %} #{{ book.series_number }}{% endif %}) - -
- {% endif %} -

+ {% endif %} +

+ {% endif %} + {% if book.authors %} -

- {% trans "by" %} {% include 'snippets/authors.html' with book=book %} -

+
+ {% trans "by" %} {% include 'snippets/authors.html' with book=book %} +
{% endif %}
diff --git a/bookwyrm/templatetags/utilities.py b/bookwyrm/templatetags/utilities.py index 68befa54..ae66ca6e 100644 --- a/bookwyrm/templatetags/utilities.py +++ b/bookwyrm/templatetags/utilities.py @@ -25,7 +25,7 @@ def get_title(book): return "" title = book.title if len(title) < 6 and book.subtitle: - title = "{:s}: {:s}".format(title, book.subtitle) + title = "{:s} ({:s})".format(title, book.subtitle) return title