dependencies: Upgrade katex from 0.10.2 to 0.11.1.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-11-08 18:53:32 -08:00 committed by Tim Abbott
parent ffe8ec3450
commit cce85f6ec7
5 changed files with 33 additions and 21 deletions

View File

@ -34,7 +34,7 @@
"jquery": "^3.4.1",
"jquery-caret-plugin": "^1.5.2",
"jquery-validation": "^1.19.0",
"katex": "^0.10.2",
"katex": "^0.11.1",
"mini-css-extract-plugin": "^0.6.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.25",

View File

@ -26,4 +26,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
PROVISION_VERSION = '63.0'
PROVISION_VERSION = '64.0'

View File

@ -6573,10 +6573,10 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"
katex@^0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.10.2.tgz#39973edbb65eda5b6f9e7f41648781e557dd4932"
integrity sha512-cQOmyIRoMloCoSIOZ1+gEwsksdJZ1EW4SWm3QzxSza/QsnZr6D4U1V9S4q+B/OLm2OQ8TCBecQ8MaIfnScI7cw==
katex@^0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.11.1.tgz#df30ca40c565c9df01a466a00d53e079e84ffaa2"
integrity sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==
dependencies:
commander "^2.19.0"

View File

@ -14,6 +14,7 @@ import os
import html
import time
import functools
from io import StringIO
import ujson
import xml.etree.cElementTree as etree
from xml.etree.cElementTree import Element
@ -1311,7 +1312,18 @@ class Tex(markdown.inlinepatterns.Pattern):
def handleMatch(self, match: Match[str]) -> Element:
rendered = render_tex(match.group('body'), is_inline=True)
if rendered is not None:
return etree.fromstring(rendered.encode('utf-8'))
# We need to give Python-Markdown an ElementTree object, but if we
# give it one with correctly stored XML namespaces, it will mangle
# everything when serializing it. So we play this stupid game to
# store xmlns as a normal attribute. :-[
assert ' zulip-xmlns="' not in rendered
rendered = rendered.replace(' xmlns="', ' zulip-xmlns="')
parsed = etree.iterparse(StringIO(rendered))
for event, elem in parsed:
if 'zulip-xmlns' in elem.attrib:
elem.attrib['xmlns'] = elem.attrib.pop('zulip-xmlns')
root = elem
return root
else: # Something went wrong while rendering
span = markdown.util.etree.Element('span')
span.set('class', 'tex-error')

File diff suppressed because one or more lines are too long