Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
golopot committed Jan 15, 2022
1 parent 591fe57 commit d6fc611
Show file tree
Hide file tree
Showing 15 changed files with 2,899 additions and 4,782 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
node: true,
webextensions: true,
},
extends: ['eslint:recommended', 'prettier'],
extends: ['eslint:recommended'],
rules: {
eqeqeq: 2,
'no-cond-assign': 0,
Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- "10"
- '10'
script:
- "npm run lint"
- "npm run test"
- 'npm run lint'
- 'npm run test'
after_success:
- "./node_modules/.bin/codecov"
- './node_modules/.bin/codecov'
31 changes: 15 additions & 16 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
1.3.0 / 2019-06-13
===================
* Add iota (#9)(Quelklef)
# 1.3.0 / 2019-06-13

1.2.1 / 2018-01-07
===================
* Make convert in textarea ctrl-z-undoable
- Add iota (#9)(Quelklef)

# 1.2.1 / 2018-01-07

- Make convert in textarea ctrl-z-undoable

1.2.0 /
* Make option "subscript" non-default
* Fix parsing error
* Add a link to change shortcut in web extension

1.1.0 / 2018-07-20
===================
- Make option "subscript" non-default
- Fix parsing error
- Add a link to change shortcut in web extension

# 1.1.0 / 2018-07-20

* Added conversion of subscripts and superscripts
* Changed; Rewrite parser with Parsimmon
- Added conversion of subscripts and superscripts
- Changed; Rewrite parser with Parsimmon

0.0.1 / 2018-01-26
===================
# 0.0.1 / 2018-01-26

* First commit
- First commit
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Firefox Extension: https://addons.mozilla.org/en-US/firefox/addon/tex-to-unicode

## License

[MIT](LICENSE)
[MIT](LICENSE)
4 changes: 2 additions & 2 deletions extension/public/background.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
chrome.commands.onCommand.addListener(command => {
chrome.commands.onCommand.addListener((command) => {
if (command === 'convert') {
chrome.tabs.executeScript(null, {file: '/main.bundle.js'}, result =>
chrome.tabs.executeScript(null, {file: '/main.bundle.js'}, (result) =>
console.log(result)
);
}
Expand Down
11 changes: 6 additions & 5 deletions extension/public/popup.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
chrome.commands.getAll(console.log);

chrome.storage.local.get(['options'], ({options = {}}) => {
Array.from(document.querySelectorAll('.options input')).map(input => {
Array.from(document.querySelectorAll('.options input')).map((input) => {
if (input.name === 'subscripts') {
input.checked = Boolean(options.subscripts);
}
});
});

chrome.commands.getAll(commands => {
chrome.commands.getAll((commands) => {
document.querySelector('.options .shortcut').innerHTML =
commands[1].shortcut || 'unset';
});

document.querySelector('body').addEventListener('click', event => {
document.querySelector('body').addEventListener('click', (event) => {
if (event.target.tagName === 'A') {
chrome.tabs.create({url: event.target.href});
return false;
Expand All @@ -27,8 +27,9 @@ document.querySelector('.options').addEventListener('input', () => {
});

function getOptions() {
const subscripts = document.querySelector('.options [name=subscripts]')
.checked;
const subscripts = document.querySelector(
'.options [name=subscripts]'
).checked;

return {
subscripts,
Expand Down
6 changes: 5 additions & 1 deletion extension/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = {
path: `${__dirname}/dist`,
},
devtool: 'source-map',
plugins: [new CopyWebpackPlugin(['public'])],
plugins: [
new CopyWebpackPlugin({
patterns: [{from: 'public'}],
}),
],
mode: 'production',
};
12 changes: 6 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ function overlaps([a, b], [c, d]) {
* @returns {string}
*/
function convertChunk(str, options = {}) {
const noCurly = x => {
const removeCurly = x =>
const noCurly = (x) => {
const removeCurly = (x) =>
x[0] === '{' && x[x.length - 1] === '}'
? removeCurly(x.slice(1, x.length - 1))
: x;

return removeCurly(x.replace(/ /g, ''));
};

const oneCurly = x => `{${noCurly(x)}}`;
const oneCurly = (x) => `{${noCurly(x)}}`;

if (/^\\mathbb/.test(str)) {
return symbols[`\\mathbb${oneCurly(str.slice(7))}`] || str;
Expand All @@ -50,12 +50,12 @@ function convertChunk(str, options = {}) {
}
if (/^\^.+/.test(str) && options.subscripts) {
return Array.from(noCurly(str.slice(1)))
.map(x => symbols[`^${x}`] || '')
.map((x) => symbols[`^${x}`] || '')
.reduce((a, b) => a + b, '');
}
if (/^_.+/.test(str) && options.subscripts) {
return Array.from(noCurly(str.slice(1)))
.map(x => symbols[`_${x}`] || '')
.map((x) => symbols[`_${x}`] || '')
.reduce((a, b) => a + b, '');
}
if (/^\\[a-zA-Z]+$/.test(str)) {
Expand All @@ -81,7 +81,7 @@ function convertText(text, selectStart, selectEnd, options = {}) {
const chunks = parser.tryParse(text);
const chunkIndexes = (function getChunkIndexes() {
let start = 0;
return chunks.map(chunk => [start, (start += chunk.length)]);
return chunks.map((chunk) => [start, (start += chunk.length)]);
})();
let cursor = -1;
let result = '';
Expand Down
4 changes: 2 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Parsimmon = require('parsimmon');

const Lang = Parsimmon.createLanguage({
Text: r =>
Text: (r) =>
Parsimmon.alt(
r.Superscript,
r.Subscript,
Expand Down Expand Up @@ -29,7 +29,7 @@ const Lang = Parsimmon.createLanguage({
)
).map(([a, b]) => a + b),

UnaryMacro: r =>
UnaryMacro: (r) =>
Parsimmon.seq(
Parsimmon.alt(
Parsimmon.regexp(/\\mathbb(?![a-zA-Z])/),
Expand Down
2 changes: 1 addition & 1 deletion lib/symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function preprocess(obj) {
* @param {string} symbolsStr
* @returns {Record<string, string>}
*/
const readSymbols = symbolsStr => {
const readSymbols = (symbolsStr) => {
const symbols = {};
let match;
const re = /([\\_^][^\t.]+)\t([^(\t\n).]*)/g;
Expand Down
2 changes: 1 addition & 1 deletion lib/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function findLowestCommonAncestor(u, v) {

function findChildrenList(node) {
const list = [];
const find = n => {
const find = (n) => {
if (!n) return;
list.push(n);
for (const child of Array.from(n.childNodes || [])) {
Expand Down
Loading

0 comments on commit d6fc611

Please sign in to comment.