Skip to content

Commit 4571f79

Browse files
Add download links
1 parent e2170dd commit 4571f79

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

catalog/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ def append_record(
155155
}
156156
if include_descriptions:
157157
record["Description"] = game.description
158+
ext = "efg" if game.is_tree else "nfg"
159+
record["Download"] = f":download:`{slug}.{ext} <../catalog/{slug}.{ext}>`"
158160
records.append(record)
159161

160162
# Add all the games stored as EFG/NFG files
@@ -183,7 +185,9 @@ def append_record(
183185
append_record(slug, game)
184186

185187
if include_descriptions:
186-
return pd.DataFrame.from_records(records, columns=["Game", "Title", "Description"])
188+
return pd.DataFrame.from_records(
189+
records, columns=["Game", "Title", "Description", "Download"]
190+
)
187191
return pd.DataFrame.from_records(records, columns=["Game", "Title"])
188192

189193

doc/catalog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ Check out the :ref:`pygambit API reference <pygambit-catalog>` for instructions
77
.. csv-table::
88
:file: catalog.csv
99
:header-rows: 1
10-
:widths: 20, 20, 80
10+
:widths: 20, 20, 80, 20
1111
:class: tight-table

tests/test_catalog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,4 @@ def test_catalog_games_include_descriptions():
170170
"""Test games() function can include descriptions"""
171171
games_with_desc = gbt.catalog.games(include_descriptions=True)
172172
assert "Description" in games_with_desc.columns
173+
assert "Download" in games_with_desc.columns

0 commit comments

Comments
 (0)