@@ -540,20 +540,29 @@ <h1 class="post-title">Integer Sequences and LODA Programs</h1>
540540
541541 buttonsContainer . appendChild ( editButton ) ;
542542
543- // Show PARI button only if 'loda-formula' keyword is present
544- if ( keywords && Array . isArray ( keywords ) && keywords . includes ( 'loda-formula' ) ) {
545- const pariButton = document . createElement ( 'button' ) ;
543+ // Show PARI button only if 'loda-pari' keyword is present
544+ let pariButton = null ;
545+ let leanButton = null ;
546+ if ( keywords && Array . isArray ( keywords ) && keywords . includes ( 'loda-pari' ) ) {
547+ pariButton = document . createElement ( 'button' ) ;
546548 pariButton . className = CSS_CLASSES . LODA_BUTTON ;
547549 pariButton . textContent = BUTTON_STATES . PARI_COLLAPSED ;
548550 buttonsContainer . appendChild ( pariButton ) ;
549-
550- const leanButton = document . createElement ( 'button' ) ;
551+ }
552+
553+ // Show LEAN button only if 'loda-lean' keyword is present
554+ if ( keywords && Array . isArray ( keywords ) && keywords . includes ( 'loda-lean' ) ) {
555+ leanButton = document . createElement ( 'button' ) ;
551556 leanButton . className = CSS_CLASSES . LODA_BUTTON ;
552557 leanButton . textContent = BUTTON_STATES . LEAN_COLLAPSED ;
553558 buttonsContainer . appendChild ( leanButton ) ;
554-
555- // Set up onclick handlers with cross-references
559+ }
560+
561+ // Set up onclick handlers with cross-references, guarding missing buttons
562+ if ( pariButton ) {
556563 pariButton . onclick = ( ) => togglePariExport ( sequenceId , pariButton , leanButton , programContainer , code ) ;
564+ }
565+ if ( leanButton ) {
557566 leanButton . onclick = ( ) => toggleLeanExport ( sequenceId , leanButton , pariButton , programContainer , code ) ;
558567 }
559568
0 commit comments