From: Vladimír Vondruš Date: Sun, 4 Nov 2018 11:30:05 +0000 (+0100) Subject: m.dox: properly clear everything on init(). X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=d5ebaceffed0344a972c243cfde093238480cdaf;p=blog.git m.dox: properly clear everything on init(). It's not usual that init() is called more than once. Except in tests, there it breaks stuff. --- diff --git a/pelican-plugins/m/dox.py b/pelican-plugins/m/dox.py index 8cda075c..00427d54 100644 --- a/pelican-plugins/m/dox.py +++ b/pelican-plugins/m/dox.py @@ -36,10 +36,6 @@ import logging logger = logging.getLogger(__name__) -symbol_mapping = {} -symbol_prefixes = [''] -tagfile_basenames = [] - # Modified from __init__ to add support for queries and hashes link_regexp = re.compile(r'(?P.*) <(?P<link>[^?#]+)(?P<hash>[?#].+)?>') @@ -59,7 +55,11 @@ def init(pelicanobj): tagfiles = pelicanobj.settings.get('M_DOX_TAGFILES', []) - # Pre-round to populate subclasses + # Pre-round to populate subclasses. Clear everything in case we init'd + # before already. + tagfile_basenames = [] + symbol_mapping = {} + symbol_prefixes = [''] for tagfile, path, prefixes in tagfiles: tagfile_basenames += [(os.path.splitext(os.path.basename(tagfile))[0], path)]