Skip to content

Commit

Permalink
additional export formats
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen authored and thostetler committed Dec 6, 2024
1 parent 401cc10 commit 9a020df
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/api/export/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import { IADSApiSearchParams, IDocsEntity } from '@/api/search/types';
export enum ExportApiFormatKey {
aastex = 'aastex',
ads = 'ads',
agu = 'agu',
ams = 'ams',
bibtex = 'bibtex',
bibtexabs = 'bibtexabs',
custom = 'custom',
dcxml = 'dcxml',
endnote = 'endnote',
gsa = 'gsa',
icarus = 'icarus',
ieee = 'ieee',
jatsxml = 'jatsxml',
Expand Down
21 changes: 21 additions & 0 deletions src/components/CitationExporter/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ export const exportFormats: Record<ExportApiFormatKey, ExportFormat> = {
ext: 'txt',
value: 'ads',
},
agu: {
id: ExportApiFormatKey.agu,
label: 'AGU',
help: 'American Geophysical Union format',
ext: 'txt',
value: 'agu',
},
ams: {
id: ExportApiFormatKey.ams,
label: 'AMS',
help: 'American Meteorological Society format',
ext: 'txt',
value: 'ams',
},
bibtex: {
id: ExportApiFormatKey.bibtex,
label: 'BibTeX',
Expand Down Expand Up @@ -53,6 +67,13 @@ export const exportFormats: Record<ExportApiFormatKey, ExportFormat> = {
ext: 'enw',
value: 'endnote',
},
gsa: {
id: ExportApiFormatKey.gsa,
label: 'GSA',
help: 'The Geological Society of America format',
ext: 'txt',
value: 'GSA',
},
icarus: {
id: ExportApiFormatKey.icarus,
label: 'Icarus',
Expand Down
5 changes: 3 additions & 2 deletions src/components/ResultList/Item/ItemResourceDropdowns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IDocsEntity } from '@/api/search/types';
import { useGetExportCitation } from '@/api/export/export';
import { useSettings } from '@/lib/useSettings';
import { exportFormats } from '@/components/CitationExporter/models';
import { values } from 'ramda';
import { ExportApiFormatKey } from '@/api/export/types';

export interface IItemResourceDropdownsProps {
doc: IDocsEntity;
Expand All @@ -33,7 +33,8 @@ export const ItemResourceDropdowns = ({ doc }: IItemResourceDropdownsProps): Rea

const { data: citationData } = useGetExportCitation(
{
format: values(exportFormats).find((f) => f.label === defaultExportFormat).id,
// format: values(exportFormats).find((f) => f.label === defaultExportFormat).id,
format: ExportApiFormatKey.agu,
customFormat: defaultExportFormat === exportFormats.custom.label ? customFormats[0].code : undefined,
bibcode: [doc.bibcode],
},
Expand Down

0 comments on commit 9a020df

Please sign in to comment.