Skip to content

Commit

Permalink
Add the Download parameter to the [Game] section
Browse files Browse the repository at this point in the history
  • Loading branch information
skoolkid committed Sep 6, 2024
1 parent aad5372 commit a815e22
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
4 changes: 4 additions & 0 deletions skoolkit/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
Copyright=
Created=Created using <a href="https://skoolkit.ca">SkoolKit</a> #VERSION.
DisassemblyTableNumCols=5
Download=
; Font=
; Game=
InputRegisterTableHeader=Input
Expand Down Expand Up @@ -556,6 +557,9 @@
<div class="release">{Game[Release]}</div>
<div class="copyright">{Game[Copyright]}</div>
<div class="created">{Game[Created]}</div>
<# if(Game[Download]) #>
<div class="download">{Game[Download]}</div>
<# endif #>
</footer>
"""

Expand Down
3 changes: 3 additions & 0 deletions sphinx/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Changelog
variable
* Added support to the :ref:`LET` macro for setting individual key-value pairs
in dictionary variables
* Added the ``Download`` parameter to the :ref:`ref-Game` section (for
specifying a download message/link to appear in the :ref:`t_footer` of every
page)
* Added the ``LinkInternalOperandsMinDistance`` parameter to the
:ref:`ref-Game` section (for avoiding hyperlinks to nearby instructions)
* Fixed how the 'ADC A,*', 'SBC A,*', 'ADC HL,rr' and 'SBC HL,rr' instructions
Expand Down
4 changes: 4 additions & 0 deletions sphinx/source/html-templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ To see the default ``footer`` template, run the following command::

$ skool2html.py -r Template:footer

.. versionchanged:: 9.4
Added the download message/link specified by the ``Download`` parameter in
the :ref:`ref-Game` section.

.. versionadded:: 5.0

.. _t_home:
Expand Down
5 changes: 4 additions & 1 deletion sphinx/source/ref-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ Recognised parameters are:
* ``DisassemblyTableNumCols`` - the number of columns in the disassembly table
on disassembly pages (default: 5); this value is used by the :ref:`t_asm` and
:ref:`t_asm_single_page` templates
* ``Download`` - the download message/link that appears in the footer of every
page (default: '')
* ``Font`` - the base name of the font file to use (default: None); multiple
font files can be declared by separating their names with semicolons
* ``Game`` - the name of the game, which appears in the title of every page,
Expand Down Expand Up @@ -324,7 +326,8 @@ hexadecimal addresses if the ``--hex`` option is used with
+---------+-------------------------------------------------------------------+
| Version | Changes |
+=========+===================================================================+
| 9.4 | Added the ``LinkInternalOperandsMinDistance`` parameter |
| 9.4 | Added the ``Download`` and ``LinkInternalOperandsMinDistance`` |
| | parameters |
+---------+-------------------------------------------------------------------+
| 8.7 | Added the ``AudioFormats`` parameter |
+---------+-------------------------------------------------------------------+
Expand Down
25 changes: 25 additions & 0 deletions tests/test_skoolhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -6181,6 +6181,31 @@ def test_parameter_DisassemblyTableNumCols(self):
def test_parameter_DisassemblyTableNumCols_containing_skool_macro(self):
self._test_Game_parameter_containing_skool_macro('DisassemblyTableNumCols')

def test_parameter_Download(self):
ref = """
[Game]
Created=
Download=Get the <a href="http://example.org/download">source</a>
[Template:Asm]
<# include(footer) #>
"""
skool = "c32768 RET"
writer = self._get_writer(ref=ref, skool=skool)
writer.write_asm_entries()
exp_html = """
<footer>
<div class="release"></div>
<div class="copyright"></div>
<div class="created"></div>
<div class="download">Get the <a href="http://example.org/download">source</a></div>
</footer>
"""
self._assert_content_equal(dedent(exp_html).strip(), 'asm/32768.html')

def test_parameter_Download_containing_skool_macro(self):
self._test_Game_parameter_containing_skool_macro('Download')

def test_parameter_Expand(self):
skool = """
; Routine
Expand Down

0 comments on commit a815e22

Please sign in to comment.