diff --git a/htmd/site.py b/htmd/site.py index e6b655d..b562757 100644 --- a/htmd/site.py +++ b/htmd/site.py @@ -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', diff --git a/tests/test_post_dates.py b/tests/test_post_dates.py index d2a43b6..8236659 100644 --- a/tests/test_post_dates.py +++ b/tests/test_post_dates.py @@ -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