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) {
77 . description ( 'Convert JATS file to MyST mdast json' )
88 . argument ( '[input]' , 'The JATS file' )
99 . 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' ) ,
1413 )
14+ . addOption ( new Option ( '--no-frontmatter' , 'Ignore JATS frontmatter' ) )
1515 . addOption (
1616 new Option (
1717 '--no-doi, --no-dois' ,
Original file line number Diff line number Diff line change @@ -738,7 +738,7 @@ export function jatsConvertTransform(
738738export async function jatsConvert (
739739 session : ISession ,
740740 input ?: string ,
741- opts ?: { frontmatter ?: 'page' | 'project' ; dois ?: boolean ; bibtex ?: boolean } ,
741+ opts ?: { frontmatter ?: 'page' | 'project' | false ; dois ?: boolean ; bibtex ?: boolean } ,
742742) {
743743 const logInfo : Record < string , any > = { jatsVersion : version } ;
744744 if ( ! input ) {
Original file line number Diff line number Diff line change @@ -17,12 +17,19 @@ export async function getBioRxivS3Metadata(
1717 if ( ! resp . ok ) {
1818 throw new Error ( `Bad response from ${ BIORXIV_LOOKUP_URL } ` ) ;
1919 }
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 } ;
2327 }
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 } ` ) ;
2633}
2734
2835export async function downloadAndUnzipBioRxiv (
You can’t perform that action at this time.
0 commit comments