Skip to content

Commit

Permalink
add missing admonition environment merge logic
Browse files Browse the repository at this point in the history
  • Loading branch information
multun committed Jun 17, 2020
1 parent 1d00558 commit 2ff5aa8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/admonition_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ def purge_declare_admonitions(app, env, docname):
]


def env_merge_info(app, env, docnames, other) -> None:
if not hasattr(other, 'custom_admonitions'):
return

if not hasattr(env, 'custom_admonitions'):
env.custom_admonitions = []

env.custom_admonitions.extend(other.custom_admonitions)

def find_custom_admonition(admonitions, name):
for admonition in admonitions:
if admonition["name"] == name:
Expand Down Expand Up @@ -197,6 +206,7 @@ def setup(app):
app.connect('doctree-read', register_admonition_declarations)
app.connect('doctree-resolved', process_canned_admonition_nodes)
app.connect('env-purge-doc', purge_declare_admonitions)
app.connect('env-merge-info', env_merge_info)

return {
'version': '0.1',
Expand Down

0 comments on commit 2ff5aa8

Please sign in to comment.