chiark / gitweb /
plugins: make latex2svg work at least partially with dvisvgm 1.9.2.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 7 Jul 2019 09:39:15 +0000 (11:39 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 7 Jul 2019 09:42:24 +0000 (11:42 +0200)
plugins/latex2svgextra.py

index d2b117bdc414b2405252c1575658835f55563a77..2434e016922c5cde2ebf6f0a5f204ed71f91fd4a 100644 (file)
@@ -81,7 +81,10 @@ _class_mapping = {
     ('fill=\'#cafe09\'', 'class=\'m-dim\'')
 }
 
-_patch_src = re.compile(r"""<\?xml version='1\.0' encoding='UTF-8'\?>
+# dvisvgm 1.9.2 (on Ubuntu 16.04) doesn't specify the encoding part. However
+# that version reports broken "depth", meaning inline equations are not
+# vertically aligned properly, so it can't be made to work 100% correct anyway.
+_patch_src = re.compile(r"""<\?xml version='1\.0'( encoding='UTF-8')?\?>
 <!-- This file was generated by dvisvgm \d+\.\d+\.\d+ -->
 <svg height='(?P<height>[^']+)pt' version='1.1' viewBox='(?P<viewBox>[^']+)' width='(?P<width>[^']+)pt' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
 """)