fix: remove math format converter as not possible right now

This commit is contained in:
ShareVB committed 2024-12-15 22:10:03 +01:00
1 parent a77ebf8309
commit 0e66063150
3 files changed
-99

No files matched your search

-2
View File
@@ -45,7 +45,6 @@ import { tool as phpArrayToJson } from './php-array-to-json';
import { tool as jsonSizeAnalyzer } from './json-size-analyzer';
import { tool as jsonToCsharp } from './json-to-csharp';
import { tool as luhnValidator } from './luhn-validator';
import { tool as mathFormatsConverter } from './math-formats-converter';
import { tool as mathOcr } from './math-ocr';
import { tool as markdownTocGenerator } from './markdown-toc-generator';
import { tool as passphraseGenerator } from './passphrase-generator';
@@ -494,7 +493,6 @@ export const toolsByCategory: ToolCategory[] = [
mathEvaluator,
etaCalculator,
percentageCalculator,
mathFormatsConverter,
mathOcr,
dataTransferRateConverter,
dataStorageUnitConverter,
-12
View File
@@ -1,12 +0,0 @@
import { EqualNot } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Math Formats Converter',
path: '/math-formats-converter',
description: 'Convert mathematical expression between formats',
keywords: ['math', 'formats', 'converter', 'latex', 'mathml', 'asciimath', 'omml', 'html'],
component: () => import('./math-formats-converter.vue'),
icon: EqualNot,
createdAt: new Date('2024-05-11'),
});
@@ -1,85 +0,0 @@
<script setup lang="ts">
import Plurimath from '@plurimath/plurimath';
import { useQueryParamOrStorage } from '@/composable/queryParams';
const formats = [
{ value: 'asciimath', label: 'AsciiMath' },
{ value: 'latex', label: 'Latex' },
{ value: 'mathml', label: 'MathML' },
{ value: 'html', label: 'Html' },
{ value: 'omml', label: 'OOML' },
];
const source = ref('');
const sourceFormat = useQueryParamOrStorage({ name: 'src', storageName: 'math-fmts-conv:src', defaultValue: 'latex' });
const targetFormat = useQueryParamOrStorage({ name: 'target', storageName: 'math-fmts-conv:target', defaultValue: 'mathml' });
const target = computedAsync(async () => {
const sourceValue = source.value;
const sourceFormatValue = sourceFormat.value;
const targetFormatValue = targetFormat.value;
if (sourceValue === '') {
return '';
}
if (sourceFormatValue === targetFormatValue) {
return sourceValue;
}
return new Promise<string>((resolve, _reject) => {
try {
const formula = new Plurimath(sourceValue, sourceFormatValue);
let result;
switch (targetFormatValue) {
case 'asciimath':
result = formula.toAsciimath();
break;
case 'latex':
result = formula.toLatex();
break;
case 'mathml':
result = formula.toMathml();
break;
case 'html':
result = formula.toHtml();
break;
case 'omml':
result = formula.toOmml();
break;
default:
result = '# unknown format';
break;
}
resolve(result);
}
catch (e: any) {
resolve(`# error converting formula: ${e.toString()}`);
}
});
});
</script>
<template>
<div>
<c-input-text
v-model:value="source"
multiline
placeholder="Put your math expression here..."
rows="5"
label="Mathematical expression to convert"
raw-text
mb-5
/>
<c-select
v-model:value="sourceFormat"
:options="formats"
placeholder="Source format"
/>
<n-divider />
<c-select
v-model:value="targetFormat"
:options="formats"
placeholder="Source format"
/>
<textarea-copyable v-if="target !== ''" :value="target" :language="targetFormat" />
</div>
</template>