@@ -19,13 +19,13 @@ export const caption = blockTag();
1919
2020const captions = ( tag , context ) => blockTag ( ( value ) => bold . blue ( value ) ) ( tag , context ) ;
2121
22- const trVals = ( tr ) => {
22+ const trVals = ( context ) => ( tr ) => {
2323 const theadTds = ! tr || ! tr . childNodes
2424 ? null
2525 : tr . childNodes . filter ( ( tag ) => [ 'td' , 'th' ] . includes ( tag . nodeName ) ) ;
2626
2727 const theadTdsValue = theadTds
28- ? theadTds . map ( ( tag , context ) => {
28+ ? theadTds . map ( ( tag ) => {
2929 const det = tag . nodeName === 'td' ? td ( tag , context ) : th ( tag , context ) ;
3030
3131 const parsedStyle = styleParser ( getAttribute ( tag , 'style' , '' ) ) ;
@@ -50,12 +50,12 @@ const trVals = (tr) => {
5050 return theadTdsValue ;
5151} ;
5252
53- const tbodyVals = ( tbody ) => {
53+ const tbodyVals = ( context ) => ( tbody ) => {
5454 const theadTrs = tbody
5555 ? tbody . childNodes . filter ( ( tag ) => [ 'tr' ] . includes ( tag . nodeName ) )
5656 : null ;
5757
58- const theadTrsVals = theadTrs . map ( trVals ) ;
58+ const theadTrsVals = theadTrs . map ( trVals ( context ) ) ;
5959 return theadTrsVals ;
6060} ;
6161
@@ -79,23 +79,23 @@ export const table = (tag, context) => {
7979 ? null
8080 : thead . childNodes . find ( ( child ) => child . nodeName === 'tr' ) ;
8181
82- const theadsValue = theadTr ? trVals ( theadTr ) : null ;
82+ const theadsValue = theadTr ? trVals ( context ) ( theadTr ) : null ;
8383
8484 if ( theadsValue && theadsValue [ 0 ] ) {
8585 tableArray . push ( theadsValue ) ;
8686 }
8787
8888 const trs = tag . childNodes . filter ( ( child ) => [ 'tbody' ] . includes ( child . nodeName ) ) ;
8989
90- trs . map ( tbodyVals ) . map ( ( value ) => tableArray . push ( ...value ) ) ;
90+ trs . map ( tbodyVals ( context ) ) . map ( ( value ) => tableArray . push ( ...value ) ) ;
9191
9292 const tfoot = tag . childNodes . find ( ( child ) => child . nodeName === 'tfoot' ) ;
9393
9494 const tfootTr = ! tfoot || ! tfoot . childNodes
9595 ? null
9696 : tfoot . childNodes . find ( ( child ) => child . nodeName === 'tr' ) ;
9797
98- const tfootdsValue = tfootTr ? trVals ( tfootTr ) : null ;
98+ const tfootdsValue = tfootTr ? trVals ( context ) ( tfootTr ) : null ;
9999
100100 if ( tfootdsValue && tfootdsValue [ 0 ] ) {
101101 tableArray . push ( tfootdsValue ) ;
0 commit comments