diff --git a/.istanbul.yml b/.istanbul.yml deleted file mode 100644 index a5269c0..0000000 --- a/.istanbul.yml +++ /dev/null @@ -1,2 +0,0 @@ -instrumentation: - excludes: ['lib/parser.js'] \ No newline at end of file diff --git a/lib/texutil.js b/lib/texutil.js index 4e4d16b..596f2df 100644 --- a/lib/texutil.js +++ b/lib/texutil.js @@ -696,9 +696,9 @@ module.exports.fun_ar1 = arr2set([ '\\vec', '\\widehat', '\\widetilde', - '\\xcancel', - '\\xleftarrow', - '\\xrightarrow' + '\\xcancel' + // '\\xleftarrow', // moved to fun_ar1nb + // '\\xrightarrow' // moved to fun_ar1nb ]); module.exports.fun_mhchem = arr2set([ @@ -718,7 +718,9 @@ module.exports.fun_ar1nb = arr2set([ '\\mathbb', '\\mathbf', '\\mathrm', - '\\underbrace' + '\\underbrace', + '\\xleftarrow', + '\\xrightarrow' ]); module.exports.fun_ar1opt = arr2set([ @@ -756,11 +758,11 @@ module.exports.declh_function = arr2set([ '\\bf' ]); -module.exports.left_function = arr2set([ '\\left' ]); -module.exports.right_function = arr2set([ '\\right' ]); -module.exports.hline_function = arr2set([ '\\hline' ]); -module.exports.definecolor_function = arr2set([ '\\definecolor' ]); -module.exports.color_function = arr2set([ '\\color', '\\pagecolor' ]); +module.exports.left_function = arr2set(['\\left']); +module.exports.right_function = arr2set(['\\right']); +module.exports.hline_function = arr2set(['\\hline']); +module.exports.definecolor_function = arr2set(['\\definecolor']); +module.exports.color_function = arr2set(['\\color', '\\pagecolor']); // ------------------------------------------------------ // Package dependencies for various allowed commands. diff --git a/package.json b/package.json index 854fde0..80d93de 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "mathoid-texvcjs", - "version": "0.3.8", - "description": "A TeX/LaTeX validator for mediawiki.", + "version": "0.3.9", + "description": "A TeX/LaTeX validator for MediaWiki.", "main": "lib/index.js", "scripts": { "build": "node -e 'require(\"./lib/build-parser\")'", - "cover": "nyc --reporter=lcov _mocha", + "cover": "nyc --reporter=lcov --exclude lib/parser.js_mocha ", "lint": "eslint --max-warnings 0 --ext .js .", "test": "node -e 'require(\"./lib/build-parser\")' && npm run lint && mocha", "report-coverage": "cat ./coverage/lcov.info | coveralls" @@ -26,14 +26,13 @@ "url": "https://phabricator.wikimedia.org/project/profile/1771/" }, "dependencies": { - "commander": "~4.1.1" + "commander": "~5.0.0" }, "devDependencies": { "coveralls": "^3.0.11", "nyc": "^15.0.0", "eslint-config-wikimedia": "^0.15.0", - "istanbul": "^0.4.5", - "mocha": "~7.0.1", + "mocha": "~7.1.1", "mocha-lcov-reporter": "^1.3.0", "pegjs": "~0.10.0" }, diff --git a/test/all.js b/test/all.js index b2918b5..01584bd 100644 --- a/test/all.js +++ b/test/all.js @@ -299,7 +299,7 @@ describe('Comprehensive test cases', function () { '\\overline{A}\\overrightarrow{A}\\pmod{A}\\sqrt{A}' + '\\textbf{A}\\textit{A}\\textrm{A}\\textsf{A}\\texttt{A}' + '\\tilde{A}\\underline{A}\\vec{A}\\widehat{A}\\widetilde{A}' + - '\\xcancel{A}\\xleftarrow{A}\\xrightarrow{A}', + '\\xcancel{A}', output: '{\\acute {A}}{\\bar {A}}{\\bcancel {A}}{\\bmod {A}}' + '{\\boldsymbol {A}}{\\breve {A}}{\\cancel {A}}{\\check {A}}' + @@ -313,8 +313,7 @@ describe('Comprehensive test cases', function () { '{\\overrightarrow {A}}{\\pmod {A}}{\\sqrt {A}}' + '{\\textbf {A}}{\\textit {A}}{\\textrm {A}}{\\textsf {A}}' + '{\\texttt {A}}{\\tilde {A}}{\\underline {A}}{\\vec {A}}' + - '{\\widehat {A}}{\\widetilde {A}}{\\xcancel {A}}' + - '{\\xleftarrow {A}}{\\xrightarrow {A}}', + '{\\widehat {A}}{\\widetilde {A}}{\\xcancel {A}}', skipOcaml: 'double spacing and extra braces' }, 'FUN_AR1 (2)': { @@ -336,6 +335,10 @@ describe('Comprehensive test cases', function () { input: '\\overbrace {A} _{b}^{c}\\underbrace {C} _{d}^{e}', skipOcaml: 'ocaml bug' }, + 'FUN_AR1NB (4)': { + input: '\\xleftarrow{A}\\xrightarrow{A}', + output: '\\xleftarrow {A} \\xrightarrow {A} ' + }, FUN_AR1OPT: { input: '\\sqrt{2}\\sqrt[3]{2}' + @@ -343,8 +346,8 @@ describe('Comprehensive test cases', function () { '\\xrightarrow{above}\\xrightarrow[below]{above}', output: '{\\sqrt {2}}{\\sqrt[{3}]{2}}' + - '{\\xleftarrow {above}}{\\xleftarrow[{below}]{above}}' + - '{\\xrightarrow {above}}{\\xrightarrow[{below}]{above}}', + '\\xleftarrow {above} {\\xleftarrow[{below}]{above}}' + + '\\xrightarrow {above} {\\xrightarrow[{below}]{above}}', skipOcaml: 'spacing' }, FUN_AR2: {