mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
Adjusted code for bad latex commands to pass tests
This commit is contained in:
parent
d8d9bf4dcd
commit
b5f375cc24
1 changed files with 4 additions and 4 deletions
|
@ -78,11 +78,11 @@ def _buildImg(col, latex, fname, model):
|
||||||
latex = latex.encode("utf8")
|
latex = latex.encode("utf8")
|
||||||
# it's only really secure if run in a jail, but these are the most common
|
# it's only really secure if run in a jail, but these are the most common
|
||||||
tmplatex = latex.replace("\\includegraphics", "")
|
tmplatex = latex.replace("\\includegraphics", "")
|
||||||
for bad in ("write18", "\\\\readline", "\\\\input", "\\\\include",
|
for bad in ("\\write18", "\\readline", "\\input", "\\include",
|
||||||
"\\\\catcode", "\\\\openout", "\\\\write", "\\\\loop",
|
"\\catcode", "\\openout", "\\write", "\\loop",
|
||||||
"\\\\def", "\\\\shipout"):
|
"\\def", "\\shipout"):
|
||||||
# don't mind if the sequence is only part of a command
|
# don't mind if the sequence is only part of a command
|
||||||
bad_re = bad + "[^a-zA-Z]"
|
bad_re = "\\" + bad + "[^a-zA-Z]"
|
||||||
if re.search(bad_re, tmplatex):
|
if re.search(bad_re, tmplatex):
|
||||||
return _("""\
|
return _("""\
|
||||||
For security reasons, '%s' is not allowed on cards. You can still use \
|
For security reasons, '%s' is not allowed on cards. You can still use \
|
||||||
|
|
Loading…
Reference in a new issue