This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.parse as parse | |
def to_canvas(latex, inline = False): | |
'''Converts Latex expression to canvas used <img> class.''' | |
model = '<img class="equation_image" title="{0}" src="/equation_images/{1}" alt="Latex: {0}" data-equation-content="{0}" />' | |
out = model.format(latex.replace('&','&'),parse.quote(parse.quote(latex.replace('&','&'), safe='()'), safe='()&')) | |
if not inline: | |
out = '</p>' + out + '</p>' | |
return out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.parse as parse | |
import sys | |
infile = sys.argv[1] | |
def to_canvas(latex, inline = False): | |
'''Converts Latex expression to canvas used <img> class.''' | |
modelo = '<img class="equation_image" title="{0}" src="/equation_images/{1}" alt="Latex: {0}" data-equation-content="{0}" />' | |
out = modelo.format(latex.replace('&','&'),parse.quote(parse.quote(latex.replace('&','&'), safe='()'), safe='()&')) | |
if not inline: |