From 1f6fb21362b214f65ea0075ca3c9146e4c2a7380 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 13 Jun 2018 12:20:07 +0200 Subject: [PATCH] Make the latex2svg caching fully optional. --- pelican-plugins/latex2svgextra.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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: -- 2.30.2