Skip to content

Commit 2d371d1

Browse files
committed
improve citation parsing slightly
1 parent 1cd9f7e commit 2d371d1

File tree

17 files changed

+404
-348
lines changed

17 files changed

+404
-348
lines changed

apps/converter-frontend/components/conversion/conversion.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
import React, { useEffect, useState } from 'react'
1+
import { useState } from 'react'
22
import {
3-
AppShell,
4-
Box,
5-
Burger,
63
Button,
74
Code,
85
Container,
96
Group,
10-
Header,
11-
MediaQuery,
12-
Navbar,
137
Select,
148
Text,
159
Title,
16-
useMantineTheme,
1710
} from '@mantine/core'
18-
import { HStack, VStack } from '../stack/stack'
11+
import { HStack } from '../stack/stack'
1912
import SelectItem from '../select-item/select-item'
2013
import { AiOutlineUpload } from 'react-icons/ai'
2114
import { JATSIcon, TexIcon, WordIcon } from '../ext-icon/ext-icon'
@@ -26,7 +19,6 @@ import ConvertedBlockLocal from '../converted-block-local/converted-block-local'
2619
import { jatsToTexConverter } from '../../utils/converters/jatsToTex'
2720
import { docxToTexConverter } from '../../utils/converters/docxToTex'
2821
import { docxToJatsConverter } from '../../utils/converters/docxToJats'
29-
import Settings from '../settings/settings'
3022
import { useStore } from '../../utils/store'
3123

3224
/* eslint-disable-next-line */

apps/converter-frontend/components/publications-list/citations.tsx

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export const Citations = ({
1717
const url =
1818
process.env.NODE_ENV === 'production'
1919
? '/api/style'
20-
: process.env.NEXT_PUBLIC_STYLE_DEV_URL || 'http://localhost:8000/api/style'
20+
: process.env.NEXT_PUBLIC_STYLE_DEV_URL ||
21+
'http://localhost:8000/api/style'
2122
const splitextra = extra
2223
?.replace(/\\r/g, '')
2324
?.replace(/\n([A-Z])/gm, '\n\n\n$1')
@@ -51,31 +52,39 @@ export const Citations = ({
5152
const bibtex = cite.format('bibtex')
5253
const ris = cite.format('ris')
5354
const csl = data
55+
console.log({
56+
biblatex,
57+
bibtex,
58+
ris,
59+
csl,
60+
value,
61+
})
5462
return (
55-
<Prism.Tabs>
56-
<Prism.Tab
57-
withLineNumbers
58-
language="actionscript"
59-
label="Rich Text"
60-
sx={{ whiteSpace: 'pre-wrap', maxWidth: '70vw' }}
61-
>
62-
{value?.join('\n')}
63-
{/* {value?.map((cite) => (
64-
<Text key={cite} dangerouslySetInnerHTML={{ __html: cite }} />
65-
))} */}
66-
</Prism.Tab>
67-
<Prism.Tab withLineNumbers language="clike" label="biblatex">
68-
{biblatex}
69-
</Prism.Tab>
70-
<Prism.Tab withLineNumbers language="clike" label="bibtex">
71-
{bibtex}
72-
</Prism.Tab>
73-
<Prism.Tab withLineNumbers language="jsx" label="ris">
74-
{ris}
75-
</Prism.Tab>
76-
<Prism.Tab withLineNumbers language="json" label="csl">
77-
{JSON.stringify(csl, null, 2)}
78-
</Prism.Tab>
79-
</Prism.Tabs>
63+
// <Prism.Tabs defaultValue="Rich Text">
64+
// <Prism.Tab
65+
// withLineNumbers
66+
// language="actionscript"
67+
// value="Rich Text"
68+
// sx={{ whiteSpace: 'pre-wrap', maxWidth: '70vw' }}
69+
// >
70+
// {value?.join('\n') ?? ' '}
71+
// {/* {value?.map((cite) => (
72+
// <Text key={cite} dangerouslySetInnerHTML={{ __html: cite }} />
73+
// ))} */}
74+
// </Prism.Tab>
75+
// <Prism.Tab withLineNumbers language="clike" value="biblatex">
76+
// {biblatex ?? ' '}
77+
// </Prism.Tab>
78+
// <Prism.Tab withLineNumbers language="clike" value="bibtex">
79+
// {bibtex ?? ' '}
80+
// </Prism.Tab>
81+
// <Prism.Tab withLineNumbers language="jsx" value="ris">
82+
// {ris ?? ' '}
83+
// </Prism.Tab>
84+
// <Prism.Tab withLineNumbers language="json" value="csl">
85+
// {JSON.stringify(csl, null, 2) ?? ' '}
86+
// </Prism.Tab>
87+
// </Prism.Tabs>
88+
<div />
8089
)
8190
}

apps/converter-frontend/components/publications-list/file-reel.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ export const FileReel = (props: {
7272
//console.log(stageInt)
7373
//console.log(data)
7474
return (
75-
<Tabs.Tab label={stagesss[stageInt]} key={stagesss[stageInt]}>
75+
<Tabs.Tab
76+
value={stagesss[stageInt] ?? 'production'}
77+
key={stagesss[stageInt]}
78+
>
7679
<FileStage
7780
{...{
7881
submissionId: id!,

apps/converter-frontend/components/publications-list/publication-data.tsx

Lines changed: 73 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import {
55
Box,
66
TextInput,
77
Textarea,
8-
InputWrapper,
98
Paper,
109
Button,
1110
} from '@mantine/core'
12-
import { useForm } from '@mantine/hooks'
11+
import { useForm } from '@mantine/form'
1312
import { useStore } from '../../utils/store'
1413
import { paths, definitions } from 'ojs-client'
1514
import React, { useEffect } from 'react'
@@ -33,14 +32,14 @@ export const PublicationData = (props: {
3332

3433
const form = useForm({
3534
initialValues: {
36-
documentclassname: 'article',
37-
documentclassopt: 'twocolumn, authordate',
35+
documentclassname: 'jote-new-article',
36+
documentclassopt: 'authordate, editorial',
3837
title: '',
3938
keywordsabstract: '',
4039
abstract: '',
4140
runningauthor: '',
4241
jname: '',
43-
jyear: '2022',
42+
jyear: new Date().getFullYear(),
4443
acknowledgments: '',
4544

4645
funding: '',
@@ -60,7 +59,7 @@ export const PublicationData = (props: {
6059
],
6160
paperaccepted: '',
6261
paperpublished: '',
63-
jwebsite: 'https://jtrialerror.com',
62+
jwebsite: 'https://journal.trialanderror.org',
6463
},
6564
})
6665

@@ -105,11 +104,11 @@ export const PublicationData = (props: {
105104
},
106105
[]
107106
),
108-
jname: 'Journal of Trial and Error',
109-
jyear: data.copyrightYear || '2022',
107+
jname: 'Journal of Trial \\& Error',
108+
jyear: data.copyrightYear || new Date().getFullYear(),
110109
doi: data['pub-id::doi'],
111-
jvolume: '2',
112-
jissue: '1',
110+
jvolume: '',
111+
jissue: '',
113112
jpages: data.pages || '',
114113
paperreceived: pub.dateSubmitted || '',
115114
paperaccepted: '',
@@ -171,75 +170,71 @@ export const PublicationData = (props: {
171170
<VStack>
172171
{form?.values?.authors?.map((author, index) => {
173172
return (
174-
<InputWrapper
175-
label={`Author ${index + 1}`}
176-
key={author.familyName}
173+
<Paper
174+
shadow="sm"
175+
padding="md"
176+
radius="md"
177+
key={author.givenName}
178+
sx={{
179+
display: 'flex',
180+
alignItems: 'flex-start',
181+
flexWrap: 'wrap',
182+
flexDirection: 'column',
183+
}}
177184
>
178-
<Paper
179-
shadow="sm"
180-
padding="md"
181-
radius="md"
182-
sx={{
183-
display: 'flex',
184-
alignItems: 'flex-start',
185-
flexWrap: 'wrap',
186-
flexDirection: 'column',
187-
}}
188-
>
189-
<HStack spacing={10}>
190-
<TextInput
191-
labelProps={{
192-
style: { color: 'red', fontWeight: 'bold' },
193-
}}
194-
label="givenname"
195-
value={author.givenName}
196-
onChange={(value) => {
197-
const authors = form.values.authors
198-
authors[index].givenName = value.target.value
199-
form.setFieldValue('authors', authors)
200-
}}
201-
></TextInput>
202-
<TextInput
203-
label="familyname"
204-
value={author.familyName}
205-
onChange={(value) => {
206-
const authors = form.values.authors
207-
authors[index].familyName = value.target.value
208-
form.setFieldValue('authors', authors)
209-
}}
210-
></TextInput>
211-
</HStack>
212-
<HStack spacing={10}>
213-
<TextInput
214-
label="email"
215-
value={author.email}
216-
onChange={(value) => {
217-
const authors = form.values.authors
218-
authors[index].email = value.target.value
219-
form.setFieldValue('authors', authors)
220-
}}
221-
></TextInput>
222-
<TextInput
223-
label="orcid"
224-
value={author.orcid}
225-
onChange={(value) => {
226-
const authors = form.values.authors
227-
authors[index].orcid = value.target.value
228-
form.setFieldValue('authors', authors)
229-
}}
230-
></TextInput>
231-
<TextInput
232-
label="affil"
233-
value={author.affiliation}
234-
onChange={(value) => {
235-
const authors = form.values.authors
236-
authors[index].affiliation = value.target.value
237-
form.setFieldValue('authors', authors)
238-
}}
239-
></TextInput>
240-
</HStack>
241-
</Paper>
242-
</InputWrapper>
185+
<HStack spacing={10}>
186+
<TextInput
187+
labelProps={{
188+
style: { color: 'red', fontWeight: 'bold' },
189+
}}
190+
label="givenname"
191+
value={author.givenName}
192+
onChange={(value) => {
193+
const authors = form.values.authors
194+
authors[index].givenName = value.target.value
195+
form.setFieldValue('authors', authors)
196+
}}
197+
></TextInput>
198+
<TextInput
199+
label="familyname"
200+
value={author.familyName}
201+
onChange={(value) => {
202+
const authors = form.values.authors
203+
authors[index].familyName = value.target.value
204+
form.setFieldValue('authors', authors)
205+
}}
206+
></TextInput>
207+
</HStack>
208+
<HStack spacing={10}>
209+
<TextInput
210+
label="email"
211+
value={author.email}
212+
onChange={(value) => {
213+
const authors = form.values.authors
214+
authors[index].email = value.target.value
215+
form.setFieldValue('authors', authors)
216+
}}
217+
></TextInput>
218+
<TextInput
219+
label="orcid"
220+
value={author.orcid}
221+
onChange={(value) => {
222+
const authors = form.values.authors
223+
authors[index].orcid = value.target.value
224+
form.setFieldValue('authors', authors)
225+
}}
226+
></TextInput>
227+
<TextInput
228+
label="affil"
229+
value={author.affiliation}
230+
onChange={(value) => {
231+
const authors = form.values.authors
232+
authors[index].affiliation = value.target.value
233+
form.setFieldValue('authors', authors)
234+
}}
235+
></TextInput>
236+
</HStack>
237+
</Paper>
243238
)
244239
})}
245240

apps/converter-frontend/components/publications-list/publications-list.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,3 @@ export function PublicationsList(props: PublicationsListProps) {
7979
}
8080

8181
export default PublicationsList
82-
83-
// https://submit.jtrialerror.com/index.php/jote/api/v1
84-
const Files = {}

0 commit comments

Comments
 (0)