Skip to content

Commit 76b0358

Browse files
test
1 parent c914730 commit 76b0358

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

build_site.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ def markdown_to_html(md_content, base_path='.'):
292292

293293
return html
294294

295+
def normalize_anchor(filename):
296+
"""Normalize filename to create consistent anchor."""
297+
anchor = filename.replace('/', '-').replace('.md', '').replace('&', '-').replace(' ', '-')
298+
# Replace multiple dashes with single dash
299+
while '--' in anchor:
300+
anchor = anchor.replace('--', '-')
301+
# Remove leading/trailing dashes
302+
anchor = anchor.strip('-')
303+
return anchor
304+
295305
def build_navigation(structure):
296306
"""Build navigation HTML from book structure."""
297307
nav_items = []
@@ -304,13 +314,13 @@ def build_navigation(structure):
304314
nav_items.append(f'<div class="part-title">{part_title}</div>')
305315
nav_items.append('<ul>')
306316
for chapter_file, chapter_title in chapters:
307-
anchor = chapter_file.replace('/', '-').replace('.md', '').replace('&', '-').replace(' ', '-')
317+
anchor = normalize_anchor(chapter_file)
308318
nav_items.append(f'<li><a href="#{anchor}">{chapter_title}</a></li>')
309319
nav_items.append('</ul>')
310320
else:
311321
# It's a single chapter
312322
chapter_file, chapter_title = item
313-
anchor = chapter_file.replace('/', '-').replace('.md', '').replace('&', '-').replace(' ', '-')
323+
anchor = normalize_anchor(chapter_file)
314324
nav_items.append(f'<li><a href="#{anchor}">{chapter_title}</a></li>')
315325

316326
return '\n'.join(nav_items)
@@ -332,7 +342,7 @@ def build_content(structure, base_path='.'):
332342
md_content = f.read()
333343

334344
_, content = extract_frontmatter(md_content)
335-
anchor = chapter_file.replace('/', '-').replace('.md', '').replace('&', '-').replace(' ', '-')
345+
anchor = normalize_anchor(chapter_file)
336346
html_content = markdown_to_html(content, base_path)
337347
content_sections.append(f'<section id="{anchor}">')
338348
content_sections.append(f'<h2>{chapter_title}</h2>')
@@ -347,7 +357,7 @@ def build_content(structure, base_path='.'):
347357
md_content = f.read()
348358

349359
_, content = extract_frontmatter(md_content)
350-
anchor = chapter_file.replace('/', '-').replace('.md', '').replace('&', '-').replace(' ', '-')
360+
anchor = normalize_anchor(chapter_file)
351361
html_content = markdown_to_html(content, base_path)
352362
content_sections.append(f'<section id="{anchor}">')
353363
content_sections.append(f'<h1>{chapter_title}</h1>')

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
<nav class="sidebar">
194194
<h1>RNA-seq DE Workshop</h1>
195195
<li><a href="#index">Introduction</a></li>
196-
<li><a href="#welcome---setup">Welcome and Setup</a></li>
196+
<li><a href="#welcome-setup">Welcome and Setup</a></li>
197197
<li><a href="#schedule">Schedule</a></li>
198198
<li><a href="#useful_links">Useful Links</a></li>
199199
<div class="part-title">Day 1</div>
@@ -214,7 +214,7 @@ <h1>RNA-seq DE Workshop</h1>
214214
<div class="part-title">Day 3</div>
215215
<ul>
216216
<li><a href="#Day-3-01-differential-expression-analysis">Differential Expression Analysis</a></li>
217-
<li><a href="#Day-3-02-annotation---visulaization">Annotation & Visualization</a></li>
217+
<li><a href="#Day-3-02-annotation-visulaization">Annotation & Visualization</a></li>
218218
<li><a href="#Day-3-03-putting-it-together">Putting It Together</a></li>
219219
<li><a href="#Day-3-further-reading">Further Reading</a></li>
220220
</ul>
@@ -227,7 +227,7 @@ <h1 id="welcome">Welcome</h1>
227227
<p>Welcome to the RNA-seq Differential Expression Analysis Workshop. This workshop covers statistical methods and R/Bioconductor tools for analyzing differential gene expression from RNA-seq data.</p>
228228
<p>Use the navigation menu on the left to explore the workshop materials organized by day.</p>
229229
</section>
230-
<section id="welcome---setup">
230+
<section id="welcome-setup">
231231
<h1>Welcome and Setup</h1>
232232
<h1 id="welcome-set-up-instructions">Welcome &amp; set-up instructions</h1>
233233
<p>Welcome to the Data Analytics Core (DAC) bulk RNA-seq differential expression analysis workshop. Before you attend the workshop, we ask that you familiarize yourself with the dataset we will be using, and install the software we will be using.</p>
@@ -3138,7 +3138,7 @@ <h4 id="how-does-independent-filtering-work">How does Independent filtering work
31383138
<span class="nf">saveRDS</span><span class="p">(</span><span class="n">dds</span><span class="p">,</span><span class="w"> </span><span class="n">file</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;DESeq2.rds&quot;</span><span class="p">)</span>
31393139
</code></pre></div>
31403140
</section>
3141-
<section id="Day-3-02-annotation---visulaization">
3141+
<section id="Day-3-02-annotation-visulaization">
31423142
<h2>Annotation & Visualization</h2>
31433143
<h1 id="results-annotation-visualization">Results annotation &amp; visualization</h1>
31443144
<h3 id="learning-objectives">Learning objectives:</h3>

0 commit comments

Comments
 (0)