Skip to content

Commit

Permalink
Added first readings and second to views.
Browse files Browse the repository at this point in the history
  • Loading branch information
folkien committed Apr 24, 2023
1 parent d08279b commit 1281cc5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
17 changes: 16 additions & 1 deletion models/Readings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
from datetime import date


def CompactString(string: str):
def CompactString(string: str) -> str:
''' Compact string '''
if (string is None):
return None

return string.replace(' ', '')\
.replace('\n', '')\
.replace('\t', '')\
Expand Down Expand Up @@ -49,6 +52,18 @@ def __post_init__(self):
if (isinstance(self.creationDate, str)):
self.creationDate = date.fromisoformat(self.creationDate)

# Compact first reading
self.first_reading = CompactString(self.first_reading)

# Compact psalm
self.psalm = CompactString(self.psalm)

# Compact second reading
self.second_reading = CompactString(self.second_reading)

# Compact gospel
self.gospel = CompactString(self.gospel)

# Compacted version of evangelium
self.evangelium = CompactString(self.evangelium)

Expand Down
10 changes: 7 additions & 3 deletions views/ViewPost.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ def View(post: Post) -> str:
content = ''
content += f'# Tytuł : {post.commentary.title} / {post.readings.creationDate.strftime("%d %B")}, {post.readings.liturgical_info}\n\n'
content += f" '''{post.commentary.quote_with_author}'''\n\n"
content += f'# Streszczenie \n\n'
content += f'# Co dzisiaj w Ewangelii? \n\n'
content += f'Miejsce akcji : {post.commentary.action_place}\n'
content += f'Osoby : {post.commentary.people_names}\n\n'
for index, point in enumerate(post.commentary.points):
content += f'{index + 1}. {point}\n'
content += f'\n\n'
content += f'# Ewangelia na dziś (pobrano ze strony {post.readings.url})\n\n {post.readings.evangelium}\n\n'
content += f'# Komentarz\n\n {post.commentary.comment}\n\n'
content += f'# Czytania na dziś (pobrano ze strony {post.readings.url})\n\n'
content += f' {post.readings.first_reading}\n\n'
if (post.readings.second_reading is not None):
content += f' {post.readings.second_reading}\n\n'
content += f' {post.readings.evangelium}\n\n'
content += f'# Komentarz do Ewangelii.\n\n {post.commentary.comment}\n\n'
content += f'# Wnioski\n\n'
for index, point in enumerate(post.commentary.conclusions):
content += f' - {point}\n'
Expand Down

0 comments on commit 1281cc5

Please sign in to comment.