Skip to content

Commit

Permalink
英文書誌情報のフォーマット修正
Browse files Browse the repository at this point in the history
  • Loading branch information
dccommon committed Apr 1, 2024
1 parent 5a4abe6 commit c1df291
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions src/components/page/researchDetail/ResearchDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,28 @@ export const ResearchDetail: FC<PaperModel> = ({
}, [publication.firstPage, publication.lastPage]);

const quotation = useMemo(() => {
const authorsString = authors.map((author) => `${author.familyName.ja}${author.givenName.ja}`).join(", ");
const year = new Date(publishDateStr).getFullYear();

const parts = [
`${authorsString}.`,
`${title}.`,
journalTitle ? `${journalTitle},` : null,
publication.volume ? `Vol.${publication.volume},` : null,
publication.issue ? `No.${publication.issue},` : null,
pages ? `pp.${pages},` : null,
`${year}.`,
].filter(Boolean);

return parts.join(" ");
}, [authors, title, journalTitle, publication.volume, publication.issue, pages, publishDateStr]);
const authorsString = authors.map((author) => {
if (publication.language === "english") {
return `${author.givenName.en} ${author.familyName.en}`;
} else {
return `${author.familyName.ja}${author.givenName.ja}`;
}
}).join(", ");

const year = new Date(publishDateStr).getFullYear();

const parts = [
`${authorsString}.`,
`${title}.`,
journalTitle ? `${journalTitle},` : null,
publication.volume ? `Vol.${publication.volume},` : null,
publication.issue ? `No.${publication.issue},` : null,
pages ? `pp.${pages},` : null,
`${year}.`,
].filter(Boolean);

return parts.join(" ");
}, [authors, title, journalTitle, publication.volume, publication.issue, pages, publishDateStr, publication.language]);

return (
<div>
Expand Down

0 comments on commit c1df291

Please sign in to comment.