File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 44- Correctly interpret cell metadata with ` false ` values
55- Render text/latex outputs consisting entirely of $ math as markdown math
66- Use IPython 7.14 import syntax in ` ojs_define `
7+ - Correct handling of multiple attachments in Jupyter Notebook classic
78
89## OJS
910
Original file line number Diff line number Diff line change @@ -755,13 +755,15 @@ export function mdFromContentCell(
755755 if ( options && cell . attachments && cell . source ) {
756756 // close source so we can modify it
757757 const source = ld . cloneDeep ( cell . source ) as string [ ] ;
758- // process each file attachment
759- Object . keys ( cell . attachments ) . forEach ( ( file ) => {
758+ // process each file attachment (ensure we have a cell id for uniqueness)
759+ const cellId = cell . id || shortUuid ( ) ;
760+ Object . keys ( cell . attachments ) . forEach ( ( file , index ) => {
760761 const attachment = cell . attachments ! [ file ] ;
761762 for ( const mimeType of Object . keys ( attachment ) ) {
762763 if ( extensionForMimeImageType ( mimeType , undefined ) ) {
763764 // save attachment in the figures dir
764- const imageFile = options . assets . figures_dir + "/" + file ;
765+ const imageFile = options . assets . figures_dir +
766+ `/${ cellId } -${ index + 1 } -${ file } ` ;
765767 const outputFile = join ( options . assets . base_dir , imageFile ) ;
766768 ensureDirSync ( dirname ( outputFile ) ) ;
767769 const data = attachment [ mimeType ] ;
You can’t perform that action at this time.
0 commit comments