Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Exirel committed Jul 6, 2021
2 parents 7b5cf9d + 64cfee6 commit 586fb82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = sopel-help
version = 0.2.0
version = 0.3.0
description = Help plugin for Sopel
keywords = sopel plugin help bot irc
long_description = file: README.rst
Expand All @@ -12,7 +12,7 @@ license = Eiffel Forum License, version 2
license_file = LICENSE.txt
platforms = Linux x86, x86-64
classifiers =
Development Status :: 1 - Planning
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: System Administrators
License :: Eiffel Forum License (EFL)
Expand All @@ -22,6 +22,7 @@ classifiers =
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Communications :: Chat :: Internet Relay Chat

[options]
Expand Down
7 changes: 6 additions & 1 deletion sopel_help/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ def generate_help_commands(self, command_groups):
for category, commands in sorted(command_groups.items()):
# adjust category label to the max length

title = html.escape(category)
anchor = 'plugin-%s' % title.lower()

lines = [
'<h2>%s</h2>' % html.escape(category).upper(),
'<h2 id="{anchor}">'
'<a href="#{anchor}">{title}</a>'
'</h2>'.format(anchor=anchor, title=title.upper()),
'<ul>'
] + [
'<li>%s</li>' % html.escape(command)
Expand Down
9 changes: 6 additions & 3 deletions tests/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ def test_html_generator_generate_help_commands():
}))

assert result == [
'<h2>GROUP_A</h2><ul><li>command_a_a</li><li>command_a_b</li></ul>',
'<h2>GROUP_B</h2><ul><li>command_b_a</li><li>command_b_b</li></ul>',
'<h2>GROUP_C</h2><ul><li>command_c_a</li><li>command_c_b</li></ul>',
'<h2 id="plugin-group_a"><a href="#plugin-group_a">GROUP_A</a></h2>'
'<ul><li>command_a_a</li><li>command_a_b</li></ul>',
'<h2 id="plugin-group_b"><a href="#plugin-group_b">GROUP_B</a></h2>'
'<ul><li>command_b_a</li><li>command_b_b</li></ul>',
'<h2 id="plugin-group_c"><a href="#plugin-group_c">GROUP_C</a></h2>'
'<ul><li>command_c_a</li><li>command_c_b</li></ul>',
]

0 comments on commit 586fb82

Please sign in to comment.