chiark / gitweb /
m.dox: properly clear everything on init().
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 4 Nov 2018 11:30:05 +0000 (12:30 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 4 Nov 2018 12:00:03 +0000 (13:00 +0100)
It's not usual that init() is called more than once. Except in tests,
there it breaks stuff.

pelican-plugins/m/dox.py

index 8cda075c2b34f23dfc0a7624415674a6b4243f3e..00427d5425195a1ba95b0a53acd2b3740fa942ee 100644 (file)
@@ -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<title>.*) <(?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)]