Skip to content

Commit

Permalink
Fix posts published in March to September
Browse files Browse the repository at this point in the history
  • Loading branch information
Siecje committed Jan 27, 2024
1 parent b41f3dc commit f90335c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
14 changes: 7 additions & 7 deletions htmd/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ def truncate_post_html(post_html: str) -> str:
MONTHS = {
'01': 'January',
'02': 'February',
'3': 'March',
'4': 'April',
'5': 'May',
'6': 'June',
'7': 'July',
'8': 'August',
'9': 'September',
'03': 'March',
'04': 'April',
'05': 'May',
'06': 'June',
'07': 'July',
'08': 'August',
'09': 'September',
'10': 'October',
'11': 'November',
'12': 'December',
Expand Down
19 changes: 19 additions & 0 deletions tests/test_post_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,22 @@ def test_build_without_published() -> None:
count += 1

assert count == 1


def test_build_with_post_in_each_month() -> None:
runner = CliRunner()
with runner.isolated_filesystem():
runner.invoke(start)
post_path = Path('posts') / 'example.md'
with post_path.open('r') as post_file:
lines = post_file.readlines()
for month in range(1, 13):
with post_path.open('w') as post_file:
for line in lines:
if 'published' in line:
post_file.write(f'published: 2014-{month:02}-03\n')
else:
post_file.write(line)

result = runner.invoke(build)
assert result.exit_code == 0

0 comments on commit f90335c

Please sign in to comment.