fix: reference中的journal终于搞定

This commit is contained in:
liuweiqing 2024-02-12 22:54:53 +08:00
parent 2573950ad8
commit 67212d6a85

View File

@ -95,6 +95,16 @@ function ReferenceList({ editor, lng }: ReferenceListProps) {
} }
}, [references]); }, [references]);
function formatReference(reference) {
if (reference.journal) {
return `${reference.journal}. `;
} else if (reference.journalReference) {
return `${reference.journalReference}`;
} else {
return `${reference.venue}, ${reference.year}.`;
}
}
return ( return (
<div className=" mx-auto p-4"> <div className=" mx-auto p-4">
{/* 引用列表显示区域 */} {/* 引用列表显示区域 */}
@ -108,13 +118,14 @@ function ReferenceList({ editor, lng }: ReferenceListProps) {
<span className="font-bold mr-2">[{index + 1}].</span> <span className="font-bold mr-2">[{index + 1}].</span>
{reference.author}. {reference.title}.{" "} {reference.author}. {reference.title}.{" "}
{/* 判断 journal 字段是否存在 */} {/* 判断 journal 字段是否存在 */}
{reference.journal ? ( {/* {reference.journal ? (
<span>reference.journal. </span> <span>reference.journal. </span>
) : ( ) : (
<span> <span>
{reference.venue}, {reference.year}. {reference.venue}, {reference.year}.
</span> </span>
)} )} */}
<span>{formatReference(reference)}</span>
{reference.url && ( {reference.url && (
<a <a
href={reference.url} href={reference.url}