Browse Source

Revert "handle missing tags"

This reverts commit ad250d011d.
main
cellarspoon 3 years ago
parent
commit
332fd85b5a
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 14
      temp_index.py

14
temp_index.py

@ -52,8 +52,6 @@ def make_cards(filepath, db_path, side_a, side_b):
def select_fields(fields, content, styles, book):
appended = True
if "title" in fields:
tag = "<font size=12>{}</font>".format(strip_tags(book.title))
ptitle = Paragraph(tag, styles["Italic"])
@ -89,14 +87,13 @@ def select_fields(fields, content, styles, book):
if "tags" in fields:
format_string = "<font size=10>{}</font>"
all_tags = [strip_tags(tag.name) for tag in book.tags]
if not all_tags:
appended = False
tags_glued_together = format_string.format(", ".join(all_tags))
p = Paragraph(tags_glued_together, styles["Normal"])
content.append(p)
content.append(Spacer(6, 12))
return content, appended
return content
def get_fields(db_path, side_a, side_b):
@ -106,11 +103,10 @@ def get_fields(db_path, side_a, side_b):
session = init_session(db_path)
for book in session.query(Book).all():
content, _ = select_fields(side_a, content, styles, book)
content = select_fields(side_a, content, styles, book)
content.append(PageBreak())
content = select_fields(side_b, content, styles, book)
content.append(PageBreak())
content, appended = select_fields(side_b, content, styles, book)
if appended:
content.append(PageBreak())
return content

Loading…
Cancel
Save