mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-21 21:44:40 +03:00
1 parent
c53a8cb773
commit
700cc2a196
5 files changed
+108
No files matched your search
@@ -97,6 +97,7 @@
|
|||||||
"chatgpt-prompt-splitter": "^1.0.5",
|
"chatgpt-prompt-splitter": "^1.0.5",
|
||||||
"chinesegen": "^0.3.3",
|
"chinesegen": "^0.3.3",
|
||||||
"cidr-tools": "^11.0.2",
|
"cidr-tools": "^11.0.2",
|
||||||
|
"citation-formatter": "^1.0.1",
|
||||||
"colord": "^2.9.3",
|
"colord": "^2.9.3",
|
||||||
"composerize": "^1.7.2",
|
"composerize": "^1.7.2",
|
||||||
"composeverter": "^1.7.4",
|
"composeverter": "^1.7.4",
|
||||||
|
|||||||
Generated
+7
@@ -188,6 +188,9 @@ dependencies:
|
|||||||
cidr-tools:
|
cidr-tools:
|
||||||
specifier: ^11.0.2
|
specifier: ^11.0.2
|
||||||
version: 11.0.2
|
version: 11.0.2
|
||||||
|
citation-formatter:
|
||||||
|
specifier: ^1.0.1
|
||||||
|
version: 1.0.1
|
||||||
colord:
|
colord:
|
||||||
specifier: ^2.9.3
|
specifier: ^2.9.3
|
||||||
version: 2.9.3
|
version: 2.9.3
|
||||||
@@ -8716,6 +8719,10 @@ packages:
|
|||||||
safe-buffer: 5.2.1
|
safe-buffer: 5.2.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/citation-formatter@1.0.1:
|
||||||
|
resolution: {integrity: sha512-cq42634FYQtB/alrsjCDIqLJSFXo1154KsCXkcqAVq318DHEi+7+4+YB09wXWr5fm8WGnhR8eLbtuGmMIAdszg==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/citty@0.1.6:
|
/citty@0.1.6:
|
||||||
resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==}
|
resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
declare module 'citation-formatter' {
|
||||||
|
function APA(citationObject: any): string;
|
||||||
|
function MLA(citationObject: any): string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { APA, MLA } from 'citation-formatter';
|
||||||
|
|
||||||
|
const citationData = ref({
|
||||||
|
authors: [''],
|
||||||
|
title: '',
|
||||||
|
publisher: '',
|
||||||
|
year: '',
|
||||||
|
url: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const style = ref('apa');
|
||||||
|
const formattedCitation = computed(() => {
|
||||||
|
try {
|
||||||
|
const authors = citationData.value.authors.filter(a => a.trim() !== '').map((a) => {
|
||||||
|
const [first, last] = a.split(/,\s*/, 2);
|
||||||
|
return { first, last };
|
||||||
|
});
|
||||||
|
if (!citationData.value.title
|
||||||
|
|| !citationData.value.publisher
|
||||||
|
|| !citationData.value.year
|
||||||
|
|| !authors.length
|
||||||
|
) { return '### Please fill Title, Publisher, Year and authors'; }
|
||||||
|
return (style.value === 'apa' ? APA : MLA)([
|
||||||
|
{
|
||||||
|
authors,
|
||||||
|
title: citationData.value.title,
|
||||||
|
publisher: citationData.value.publisher,
|
||||||
|
year: citationData.value.year,
|
||||||
|
url: citationData.value.url,
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
catch (e: any) {
|
||||||
|
return e.toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<n-card title="Citation Generator" style="max-width: 600px; margin: auto;">
|
||||||
|
<n-form label-placement="left" label-width="150px" :model="citationData">
|
||||||
|
<n-form-item label="Authors (in Last Name, First Name format):" label-placement="top">
|
||||||
|
<n-dynamic-input
|
||||||
|
v-model:value="citationData.authors"
|
||||||
|
placeholder="Enter author name"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="Title:">
|
||||||
|
<n-input v-model:value="citationData.title" placeholder="e.g. Introduction to Vue 3" :status="citationData.title ? 'success' : 'error'" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="Publisher:">
|
||||||
|
<n-input v-model:value="citationData.publisher" placeholder="e.g. O'Reilly Media" :status="citationData.publisher ? 'success' : 'error'" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="Publication Year:">
|
||||||
|
<n-input-number v-model:value="citationData.year" :min="0" :status="citationData.year ? 'success' : 'error'" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="URL (optional):">
|
||||||
|
<n-input v-model:value="citationData.url" placeholder="e.g. https://example.com" />
|
||||||
|
</n-form-item>
|
||||||
|
|
||||||
|
<n-form-item label="Citation Style">
|
||||||
|
<n-select
|
||||||
|
v-model:value="style"
|
||||||
|
:options="[
|
||||||
|
{ label: 'APA', value: 'apa' },
|
||||||
|
{ label: 'MLA', value: 'mla' },
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
|
||||||
|
<n-divider />
|
||||||
|
|
||||||
|
<c-card title="Generated Citation">
|
||||||
|
<textarea-copyable :value="formattedCitation" />
|
||||||
|
</c-card>
|
||||||
|
</n-card>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Book2 } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Citation Generator',
|
||||||
|
path: '/citation-generator',
|
||||||
|
description: 'Generate citation of papers/books in MLA or APA format',
|
||||||
|
keywords: ['citation', 'generator', 'apa', 'mla', 'bibliography'],
|
||||||
|
component: () => import('./citation-generator.vue'),
|
||||||
|
icon: Book2,
|
||||||
|
createdAt: new Date('2025-07-06'),
|
||||||
|
category: 'Text',
|
||||||
|
});
|
||||||
Reference in new issue
Block a user