diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..aca273a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,39 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "overrides": [ + { + "env": { + "node": true + }, + "files": [ + ".eslintrc.{js,cjs}" + ], + "parserOptions": { + "sourceType": "script" + } + } + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], + // to enforce using type for object type definitions, can be type or interface + "@typescript-eslint/consistent-type-definitions": ["error", "interface"], + // force === and !== instead of == and != + "eqeqeq": ["error", "always"], + "prefer-const": ["error", {"destructuring" : "all"}] + } +} diff --git a/README.md b/README.md index 55a331e..dae6a4e 100644 --- a/README.md +++ b/README.md @@ -146,4 +146,4 @@ This line should come before you add anything else and will do the same thing as ## To Build Yourself -Clone the repo, make sure you have nodejs, then `npm run build` . This will generate the 'siunitx.js' file that's already in the root folder. +Clone the repo, make sure you have nodejs, then `npm run build` . This will generate the 'siunitx.js' file that's already in the root folder. \ No newline at end of file diff --git a/index.html b/index.html index ef7510e..50a5d9e 100644 --- a/index.html +++ b/index.html @@ -12,9 +12,11 @@ //color is required for color options //cancel is required for cancelation of units inlineMath: { '[+]': [['$', '$']] }, - /* global options can go here, see IOptions in options.ts for properties */ + /* global options for siunitx can go in the siunitx object on tex, see IOptions in options.ts for properties */ // Uncomment example below: - //perMode: 'fraction' + // siunitx: { + // perMode: 'fraction' + // } }, options:{ enableEnrichment:true, @@ -32,10 +34,14 @@ const mml = await MathJax.tex2mmlPromise(arr[capt], {}); var regex = /(?:data-semantic-speech=")(.*?)(?:")/g; var matches = [...mml.matchAll(regex)]; + if (matches[0] === undefined) { + break; // accessibility is not turned on yet + } table.rows[capt + 1].cells[2].innerText = matches[0][1]; } } + await fillTableWithSpeech('angTable', ang); await fillTableWithSpeech('numTable', num); await fillTableWithSpeech('complexnumTable', complexnum); @@ -118,8 +124,10 @@
0&&n.uncertainty[0].fractional.length>n.fractional.length&&(n.decimal||(n.decimal="."),n.fractional=n.fractional.padEnd(n.uncertainty[0].fractional.length,"0")),t["drop-uncertainty"]&&n.uncertainty.splice(0,n.uncertainty.length),t["drop-exponent"]&&(n.exponentMarker="",n.exponentSign="",n.exponent=""),_.get(t["round-mode"])(e,n,t),t["drop-zero-decimal"]&&0==+n.fractional&&(n.fractional="",n.decimal=""),t["minimum-integer-digits"]>0){var r=t["minimum-integer-digits"]-n.whole.length;if(r>0)for(var i=0;i