File tree Expand file tree Collapse file tree 5 files changed +28
-10
lines changed Expand file tree Collapse file tree 5 files changed +28
-10
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' jats-fetch ' : patch
3
+ ---
4
+
5
+ Enable v# suffixed bioRxiv dois
Original file line number Diff line number Diff line change
1
+ ---
2
+ ' jats-convert ' : minor
3
+ ' jats-cli ' : minor
4
+ ---
5
+
6
+ Update jats convert frontmatter default
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ function makeConvertCLI(program: Command) {
7
7
. description ( 'Convert JATS file to MyST mdast json' )
8
8
. argument ( '[input]' , 'The JATS file' )
9
9
. addOption (
10
- new Option (
11
- '--frontmatter <frontmatter>' ,
12
- 'Treat JATS frontmatter fields as page or project, or ignore if not specified' ,
13
- ) . choices ( [ 'page' , 'project' ] ) ,
10
+ new Option ( '--frontmatter <frontmatter>' , 'Treat JATS frontmatter fields as page or project' )
11
+ . choices ( [ 'page' , 'project' ] )
12
+ . default ( 'project' ) ,
14
13
)
14
+ . addOption ( new Option ( '--no-frontmatter' , 'Ignore JATS frontmatter' ) )
15
15
. addOption (
16
16
new Option (
17
17
'--no-doi, --no-dois' ,
Original file line number Diff line number Diff line change @@ -738,7 +738,7 @@ export function jatsConvertTransform(
738
738
export async function jatsConvert (
739
739
session : ISession ,
740
740
input ?: string ,
741
- opts ?: { frontmatter ?: 'page' | 'project' ; dois ?: boolean ; bibtex ?: boolean } ,
741
+ opts ?: { frontmatter ?: 'page' | 'project' | false ; dois ?: boolean ; bibtex ?: boolean } ,
742
742
) {
743
743
const logInfo : Record < string , any > = { jatsVersion : version } ;
744
744
if ( ! input ) {
Original file line number Diff line number Diff line change @@ -17,12 +17,19 @@ export async function getBioRxivS3Metadata(
17
17
if ( ! resp . ok ) {
18
18
throw new Error ( `Bad response from ${ BIORXIV_LOOKUP_URL } ` ) ;
19
19
}
20
- const bioRxivMeta = ( await resp . json ( ) ) as { versions : { s3Bucket : string ; s3Key : string } [ ] } ;
21
- if ( ! bioRxivMeta . versions ?. length ) {
22
- throw new Error ( `Bad response from ${ BIORXIV_LOOKUP_URL } - no versions found for ${ input } ` ) ;
20
+ const bioRxivMeta = ( await resp . json ( ) ) as {
21
+ versions ?: { s3Bucket : string ; s3Key : string } [ ] ;
22
+ s3Bucket ?: string ;
23
+ s3Key ?: string ;
24
+ } ;
25
+ if ( bioRxivMeta . s3Bucket && bioRxivMeta . s3Key ) {
26
+ return { bucketName : bioRxivMeta . s3Bucket , filePath : bioRxivMeta . s3Key } ;
23
27
}
24
- const { s3Bucket, s3Key } = bioRxivMeta . versions [ bioRxivMeta . versions . length - 1 ] ;
25
- return { bucketName : s3Bucket , filePath : s3Key } ;
28
+ if ( bioRxivMeta . versions ?. length ) {
29
+ const { s3Bucket, s3Key } = bioRxivMeta . versions [ bioRxivMeta . versions . length - 1 ] ;
30
+ return { bucketName : s3Bucket , filePath : s3Key } ;
31
+ }
32
+ throw new Error ( `Bad response from ${ BIORXIV_LOOKUP_URL } - no s3 bucket info found for ${ input } ` ) ;
26
33
}
27
34
28
35
export async function downloadAndUnzipBioRxiv (
You can’t perform that action at this time.
0 commit comments