@@ -177,6 +177,7 @@ def generate_index(self) -> None:
177177 'SQL' : '\U0001F5C3 \uFE0F ' ,
178178 }
179179 total_count = sum (len (v ) for v in structure .values ())
180+ domain_count = len (sorted_categories )
180181 current_time = datetime .datetime .now (datetime .timezone .utc ).strftime ("%Y-%m-%d %H:%M:%S UTC" )
181182
182183 # HTML Template — "Refined Lab" デザイン
@@ -598,7 +599,7 @@ def generate_index(self) -> None:
598599 \U0001F9EA Algorithm Study
599600 <span class="title-accent">Index</span>
600601 </h1>
601- <p class="site-subtitle">{total_count} interactive lessons across 6 domains</p>
602+ <p class="site-subtitle">{total_count} interactive lessons across {domain_count} domains</p>
602603 </header>
603604
604605 <div class="search-container">
@@ -677,17 +678,20 @@ def generate_index(self) -> None:
677678
678679 function renderPaginationControls(tabId, totalPages, currentPage) {{
679680 const tab = document.getElementById(tabId);
680- let container = tab.querySelector('.pagination');
681+ const existing = tab.querySelector('.pagination');
681682
682- if (!container) {{
683- container = document.createElement('div');
683+ if (totalPages <= 1) {{
684+ if (existing) existing.remove();
685+ return;
686+ }}
687+
688+ const container = existing || document.createElement('div');
689+ if (!existing) {{
684690 container.className = 'pagination';
685691 tab.appendChild(container);
686692 }}
687693 while (container.firstChild) container.removeChild(container.firstChild);
688694
689- if (totalPages <= 1) return;
690-
691695 const prevBtn = document.createElement('button');
692696 prevBtn.className = 'page-button';
693697 prevBtn.textContent = '\u00AB Prev';
@@ -755,7 +759,9 @@ def generate_index(self) -> None:
755759 input.value = '';
756760 document.getElementById('searchClear').style.display = 'none';
757761 document.getElementById('searchCount').textContent = '';
758- clearSearchFilter(categoryName);
762+ document.querySelectorAll('.tab-content').forEach(tc => {{
763+ clearSearchFilter(tc.id);
764+ }});
759765 }}
760766
761767 currentPages[categoryName] = currentPages[categoryName] || 1;
@@ -865,7 +871,9 @@ def generate_index(self) -> None:
865871 file_list_html = '<ul class="file-list">\n '
866872 for title , path in files :
867873 encoded_path = urllib .parse .quote (path )
868- item_html = f'<li class="file-item" data-category="{ css_cat } "><a class="file-link" href="{ encoded_path } "><span class="card-header"><span class="card-icon">{ icon } </span><span class="card-title">{ title } </span></span><span class="file-path">{ path } </span></a></li>\n '
874+ safe_title = html .escape (title )
875+ safe_path = html .escape (path )
876+ item_html = f'<li class="file-item" data-category="{ css_cat } "><a class="file-link" href="{ encoded_path } "><span class="card-header"><span class="card-icon">{ icon } </span><span class="card-title">{ safe_title } </span></span><span class="file-path">{ safe_path } </span></a></li>\n '
869877 file_list_html += item_html
870878 all_files_html += item_html
871879 file_list_html += '</ul>'
@@ -878,6 +886,7 @@ def generate_index(self) -> None:
878886 tab_contents = tab_contents_html ,
879887 timestamp = current_time ,
880888 total_count = total_count ,
889+ domain_count = domain_count ,
881890 )
882891
883892 output_index_path = os .path .join (output_dir , index_file )
0 commit comments