From: Vladimír Vondruš Date: Wed, 13 Jun 2018 10:20:07 +0000 (+0200) Subject: Make the latex2svg caching fully optional. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=1f6fb21362b214f65ea0075ca3c9146e4c2a7380;p=blog.git Make the latex2svg caching fully optional. --- diff --git a/pelican-plugins/latex2svgextra.py b/pelican-plugins/latex2svgextra.py index 7187e83c..2ffc33c6 100644 --- a/pelican-plugins/latex2svgextra.py +++ b/pelican-plugins/latex2svgextra.py @@ -76,11 +76,13 @@ _cache = None def fetch_cached_or_render(formula): global _cache - # unpickle_cache() should be called first - assert _cache + # Cache not used, pass through + if not _cache: + out = latex2svg.latex2svg(formula, params=params) + return out['depth'], out['svg'] hash = sha1(formula.encode('utf-8')).digest() - if not _cache or not hash in _cache[2]: + if not hash in _cache[2]: out = latex2svg.latex2svg(formula, params=params) _cache[2][hash] = (_cache[1], out['depth'], out['svg']) else: