mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-04-29 17:20:21 -05:00
Filters frontmatter includes for single chapters
Simplifies frontmatter inclusion logic to retain only 'index.qmd' when building single chapter books, removing unnecessary checks for other frontmatter files.
This commit is contained in:
30
binder
30
binder
@@ -381,8 +381,8 @@ class BookBinder:
|
||||
# Keep the target chapter
|
||||
new_lines.append(line)
|
||||
target_found = True
|
||||
elif any(essential in line for essential in ['index.qmd', 'foreword.qmd', 'about/', 'acknowledgements/']):
|
||||
# Keep essential frontmatter
|
||||
elif 'index.qmd' in line:
|
||||
# Keep only index.qmd from frontmatter
|
||||
new_lines.append(line)
|
||||
else:
|
||||
# Comment out other chapters
|
||||
@@ -472,8 +472,8 @@ class BookBinder:
|
||||
# Keep target chapters
|
||||
new_lines.append(line)
|
||||
targets_found += 1
|
||||
elif any(essential in line for essential in ['index.qmd', 'foreword.qmd', 'about/', 'acknowledgements/']):
|
||||
# Keep essential frontmatter
|
||||
elif 'index.qmd' in line:
|
||||
# Keep only index.qmd from frontmatter
|
||||
new_lines.append(line)
|
||||
else:
|
||||
# Comment out other chapters
|
||||
@@ -763,17 +763,17 @@ class BookBinder:
|
||||
if success:
|
||||
console.print(f"[green] ✅ Fast build complete: {self.get_output_dir(format_type)}/[/green]")
|
||||
|
||||
# Automatically open the output file if HTML and requested
|
||||
if format_type == "html" and output and open_browser:
|
||||
# Check user preference for auto-open
|
||||
preferences = self.get_user_preferences()
|
||||
auto_open = preferences.get('auto_open', True)
|
||||
|
||||
if auto_open:
|
||||
self.open_output_file(output)
|
||||
else:
|
||||
console.print(f"[blue]📄 Output ready: {output}[/blue]")
|
||||
console.print("[dim]💡 Set auto-open preference with './binder setup'[/dim]")
|
||||
# Automatically open the output file if HTML and requested
|
||||
if format_type == "html" and output and open_browser:
|
||||
# Check user preference for auto-open
|
||||
preferences = self.get_user_preferences()
|
||||
auto_open = preferences.get('auto_open', True)
|
||||
|
||||
if auto_open:
|
||||
self.open_output_file(output)
|
||||
else:
|
||||
console.print(f"[blue]📄 Output ready: {output}[/blue]")
|
||||
console.print("[dim]💡 Set auto-open preference with './binder setup'[/dim]")
|
||||
else:
|
||||
console.print("[red] ❌ Build failed[/red]")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user