From 7dd9344f58cfe669aee88a0ca5d659552ba002a3 Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Fri, 13 Oct 2023 16:11:03 +0200
Subject: [PATCH] add a Ref component

---
 components/content/ArticleDoi.vue |  1 +
 components/content/Ref.vue        | 13 +++++++++++++
 composables/useFetchArticle.ts    |  3 ++-
 content/3.defense-systems/abia.md |  8 +++++---
 4 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 components/content/Ref.vue

diff --git a/components/content/ArticleDoi.vue b/components/content/ArticleDoi.vue
index 3cd6c619..ea79d240 100644
--- a/components/content/ArticleDoi.vue
+++ b/components/content/ArticleDoi.vue
@@ -28,6 +28,7 @@ const articleAbstract = computed(() => {
 <template>
   <v-list-item
     :href="article?.href"
+    :id="props.doi"
     :target="article?.target"
     density="compact"
     class="px-1"
diff --git a/components/content/Ref.vue b/components/content/Ref.vue
new file mode 100644
index 00000000..7031d3ae
--- /dev/null
+++ b/components/content/Ref.vue
@@ -0,0 +1,13 @@
+<script setup lang="ts">
+
+export interface Props {
+    doi: string;
+}
+const props = withDefaults(defineProps<Props>(), {});
+const { article } = useFetchArticle(props.doi);
+</script>
+<template>
+    <v-chip variant="text" :href="`#${props.doi}`" class="pa-0 text-caption font-italic">({{ article?.author[0]?.family ?? 'test' }} et al, {{
+        article.year
+    }})</v-chip>
+</template>
\ No newline at end of file
diff --git a/composables/useFetchArticle.ts b/composables/useFetchArticle.ts
index af26e93a..a829bc4a 100644
--- a/composables/useFetchArticle.ts
+++ b/composables/useFetchArticle.ts
@@ -25,6 +25,7 @@ export interface Article {
     DOI: string
     title: string
     subtitle: string
+    author: Array<{ family: string; given: string }>
     containerTitle: string
     abstract: string
     year: string
@@ -74,6 +75,7 @@ export function useFetchArticle(doi: string) {
                 DOI,
                 title: sanitizedTitle,
                 subtitle: toAuthorsString(author || []),
+                author,
                 containerTitle: sanitizedContainerTitle,
                 abstract: sanitizedAbstract,
                 year: published?.["date-parts"][0][0] ?? issued?.["date-parts"][0][0] ?? '',
@@ -89,7 +91,6 @@ export function useFetchArticle(doi: string) {
 
         if (store.articles.size === 0) {
             const localArticles = await queryContent('/_partials/_articles').where({ _partial: true }).findOne()
-            console.log(localArticles)
             if (localArticles?.articles && store.articles.size <= 0) {
                 for (const article of localArticles.articles) {
                     store.add(article)
diff --git a/content/3.defense-systems/abia.md b/content/3.defense-systems/abia.md
index 3e5d554c..fffc9c8a 100644
--- a/content/3.defense-systems/abia.md
+++ b/content/3.defense-systems/abia.md
@@ -11,7 +11,7 @@ tableColumns:
     PFAM: PF00078, PF18160, PF18732
 ---
 
-# AbiA
+# AbiA 
 The AbiA system have been describe in a total of 2 subsystems.
 
 Here is some example found in the RefSeq database:
@@ -24,9 +24,11 @@ AbiA_large subsystem in the genome of *Lactobacillus amylovorus* (GCF_002706375.
 
 AbiA_small subsystem in the genome of *Mesobacillus foraminis* (GCF_003667765.1) is composed of 2 proteins: AbiA_small (WP_121614402.1)and, AbiA_SLATT (WP_121614403.1).
 
-## Distribution of the system among prokaryotes
+## Distribution of the system among prokaryotes 
+
+The AbiA system is present in a total of 35 different species :ref{doi=10.1023/A:1002027321171}.
+
 
-The AbiA system is present in a total of 35 different species.
 
 Among the 22k complete genomes of RefSeq, this system is present in 50 genomes (0.2 %).
 
-- 
GitLab