Skip to content

Commit

Permalink
Fix formatting for single day workshops
Browse files Browse the repository at this point in the history
  • Loading branch information
zhzhang committed Mar 8, 2022
1 parent a0eedf7 commit 1c576af
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: install test
test:
PYTHONPATH=. python3 -m pytest

2 changes: 2 additions & 0 deletions aclpub2/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ def get_conference_dates(conference) -> str:
start_month = start_date.strftime("%B")
end_month = end_date.strftime("%B")
if start_month == end_month:
if start_date.day == end_date.day:
return f"{start_month} {start_date.day}"
return f"{start_month} {start_date.day}-{end_date.day}"
return f"{start_month} {start_date.day} - {end_month} {end_date.day}"

Expand Down
2 changes: 1 addition & 1 deletion aclpub2/templates/proceedings.tex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

\vspace*{65mm}

{\bf\LARGE \VAR{conference.start_date.year} \VAR{conference.name}}
{\bf\LARGE \VAR{conference.name}}

\vspace*{5cm}

Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
28 changes: 28 additions & 0 deletions tests/test_generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from aclpub2.generate import get_conference_dates
import yaml


def test_get_conference_dates():
conference = yaml.safe_load(
"""
start_date: 2020-01-01
end_date: 2020-01-01
"""
)
assert get_conference_dates(conference) == "January 1"

conference = yaml.safe_load(
"""
start_date: 2020-01-01
end_date: 2020-01-02
"""
)
assert get_conference_dates(conference) == "January 1-2"

conference = yaml.safe_load(
"""
start_date: 2020-01-01
end_date: 2020-02-02
"""
)
assert get_conference_dates(conference) == "January 1 - February 2"

0 comments on commit 1c576af

Please sign in to comment.