Skip to content

Commit

Permalink
added more poets
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Dec 13, 2023
1 parent fe925b7 commit af1a526
Show file tree
Hide file tree
Showing 6 changed files with 464 additions and 151 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
poems
-----

All of the poems in here are good, or interesting. There are currently 6,902 poems by 433 poets.
All of the poems in here are good, or interesting. There are currently 6,920 poems by 440 poets.


usage
Expand Down
16 changes: 10 additions & 6 deletions poemsfromtom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ class Author():
def dates(self) -> str:

# this assumes no one born before Christ is still alive
if self.death == "": return f"(born {self.birth})"
if not self.death:
if not self.birth:
return ""
else:
return f"(born {self.birth})"

birth_is_circa = True if "~" in self.birth else False
death_is_circa = True if "~" in self.death else False
Expand Down Expand Up @@ -93,14 +97,14 @@ def html_lines(self):
parsed_lines = []
for line in body_text.split("\n"):
if len(line) > 0:
parsed_lines.append(f'<div class="opus-line">{line.strip()}</div>')
parsed_lines.append(f'<div class="poem-line">{line.strip()}</div>')
else:
parsed_lines.append(f'<div class="opus-line-blank">&#8203;</div>')
parsed_lines.append(f'<div class="poem-line-blank">&#8203;</div>')

if "translator" in self.metadata.keys():
parsed_lines.append(f'<div class="opus-line-blank">&#8203;</div>')
parsed_lines.append(f'<div class="opus-line-blank">&#8203;</div>')
parsed_lines.append(f'<div class="opus-line"><i>Translated by {self.metadata["translator"]}</i></div>')
parsed_lines.append(f'<div class="poem-line-blank">&#8203;</div>')
parsed_lines.append(f'<div class="poem-line-blank">&#8203;</div>')
parsed_lines.append(f'<div class="poem-line"><i>Translated by {self.metadata["translator"]}</i></div>')

return "\n".join(parsed_lines)

Expand Down
Loading

0 comments on commit af1a526

Please sign in to comment.