From c6e19310d143e37fdf8c99fa298e4f45f668d316 Mon Sep 17 00:00:00 2001 From: juancarlosfarah Date: Fri, 28 Feb 2020 14:54:32 +0100 Subject: [PATCH] fix: close div when parsing math --- src/test/fixtures/math.js | 28 ++++++++++++++-------------- src/utils/math.js | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/test/fixtures/math.js b/src/test/fixtures/math.js index 1c3d6c22..f3adc748 100644 --- a/src/test/fixtures/math.js +++ b/src/test/fixtures/math.js @@ -38,35 +38,35 @@ export const output1 = ' \n' + ' t2t_2\n' + ' \n' + - '


\n' + + '


\n' + ' \n' + ' x2x^2\n' + ' \n' + - '


\n' + + '


\n' + ' \n' + ' 1xx21yy21zz2\\begin{matrix} 1 & x & x^2 \\\\ 1 & y & y^2 \\\\ 1 & z & z^2 \\\\ \\end{matrix}\n' + ' \n' + - '


\n' + + '


\n' + ' \n' + ' \\(x^2\n' + ' \n' + - ' \\)


\n' + + ' \\)


\n' + ' \n' + ' x2\\[x2x^2 \\[x^2\n' + ' \n' + - '

\\]


$$y^3$$

'; + '

\\]


$$y^3$$

'; export const output2 = '

Fifty years later! "\n' + ' \n' + ' x2x^2\n' + ' \n' + - ' "

'; + '
"

'; export const output3 = '

\n' + ' \n' + ' x2x^2\n' + ' \n' + - '

'; + '

'; // special outputs export const quadraticOutput = @@ -85,25 +85,25 @@ export const quadraticOutput = 'c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\n' + 'M834 80h400000v40h-400000z\'/>.\n' + ' \n' + - '


'; + '


'; export const cauchyOutput = '

\n' + ' \n' + ' f(a)=12πif(z)zadzf(a) = \\frac{1}{2\\pi i} \\oint\\frac{f(z)}{z-a}dz\n' + ' \n' + - '

'; + '

'; export const cosinesOutput = '

\n' + ' \n' + ' cos(θ+φ)=cos(θ)cos(φ)sin(θ)sin(φ)\\cos(θ+φ)=\\cos(θ)\\cos(φ)−\\sin(θ)\\sin(φ)\n' + ' \n' + - '

'; + '

'; export const gaussOutput = '

\n' + ' \n' + ' D(F)dV=DFndS\\int_D ({\\nabla\\cdot} F)dV=\\int_{\\partial D} F\\cdot ndS\n' + ' \n' + - '

'; + '

'; export const vectorOutput = '

\n' + ' \n' + @@ -121,7 +121,7 @@ export const vectorOutput = 'H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\n' + 'c-16-25.333-24-45-24-59z\'/>=(yFzzFy)i+(zFxxFz)j+(xFyyFx)k\n' + ' \n' + - '

'; + '

'; export const sigmaOutput = '

\n' + ' \n' + @@ -136,10 +136,10 @@ export const sigmaOutput = 'c53.7,-170.3,84.5,-266.8,92.5,-289.5z\n' + 'M1001 80h400000v40h-400000z\'/>\n' + ' \n' + - '

'; + '

'; export const christoffelOutput = '

\n' + ' \n' + ' (XY)k=Xi(iY)k=Xi(Ykxi+ΓimkYm)(\\nabla_X Y)^k = X^i (\\nabla_i Y)^k = X^i \\left( \\frac{\\partial Y^k}{\\partial x^i} + \\Gamma_{im}^k Y^m \\right)\n' + ' \n' + - '

'; + '

'; diff --git a/src/utils/math.js b/src/utils/math.js index cf17b7e6..180360fc 100644 --- a/src/utils/math.js +++ b/src/utils/math.js @@ -30,7 +30,7 @@ const renderToString = (input = '', indicator, regex, div) => { throwOnError: false, })} - <${div}>`; + `; output = output.replace(matched, parsed); }); }