Skip to content

Commit

Permalink
Fix bug of Sphinx's .. code:: directive not recognizing :class: option
Browse files Browse the repository at this point in the history
Sphinx's own .. code:: directive (but not docutils') does not recognise
the :class: option but only the :classes: option.  This is probably due
to an oversight that the user-visible option is called ``:class:`` while
the Python attribute is called ``classes`` (to not collide with the
keyword ``class``).

Fix it by checking for the option ``class`` instead of ``classes``.
  • Loading branch information
latosha-maltba committed Sep 30, 2021
1 parent c1f8afa commit b7b36a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -38,6 +38,7 @@ Bugs fixed
* #9670: html: Fix download file with special characters
* #9649: HTML search: when objects have the same name but in different domains,
return all of them as result instead of just one.
* Fix bug ``.. code::`` not recognising ``:classes:`` option instead of ``:class:`` option. The new behaviour is only to accept ``:class:``.

Testing
--------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/directives/patches.py
Expand Up @@ -154,7 +154,7 @@ def run(self) -> List[Node]:

code = '\n'.join(self.content)
node = nodes.literal_block(code, code,
classes=self.options.get('classes', []),
classes=self.options.get('class', []),
force='force' in self.options,
highlight_args={})
self.add_name(node)
Expand Down

0 comments on commit b7b36a2

Please sign in to comment.