sabbath_school_reproducer package
Subpackages
- sabbath_school_reproducer.bin package
- sabbath_school_reproducer.generator package
- Submodules
- sabbath_school_reproducer.generator.css_styles module
- sabbath_school_reproducer.generator.html_generator module
HtmlGeneratorHtmlGenerator.add_section()HtmlGenerator.convert_markdown_to_html()HtmlGenerator.create_back_cover()HtmlGenerator.create_backmatter_html()HtmlGenerator.create_cover_page()HtmlGenerator.create_debug_html_with_css()HtmlGenerator.create_frontmatter_html()HtmlGenerator.create_lesson_html()HtmlGenerator.create_table_of_contents()HtmlGenerator.fix_markdown_lists()HtmlGenerator.generate_html()HtmlGenerator.get_quarter_display()HtmlGenerator.read_svg_file()
- sabbath_school_reproducer.generator.pdf_generator module
- sabbath_school_reproducer.generator.svg_updater module
- Module contents
- sabbath_school_reproducer.utils package
Submodules
sabbath_school_reproducer.aggregator module
Content Aggregator Module for Sabbath School Lessons
This module combines downloaded content into a single markdown file.
- class sabbath_school_reproducer.aggregator.ContentAggregator[source]
Bases:
objectCombines downloaded lesson content into a single markdown file.
- static combine_lesson_content(lesson_data, output_path)[source]
Combine all lesson content into a single markdown file
- Parameters:
lesson_data (dict) – Dictionary containing all downloaded content
output_path (str) – Path to save the combined markdown file
- Returns:
Path to the combined markdown file
- Return type:
str
sabbath_school_reproducer.config module
Configuration Module for Sabbath School Lessons
This module handles loading and validating configuration from a YAML file.
- class sabbath_school_reproducer.config.Config(config_path)[source]
Bases:
objectHandles configuration loading and validation for Sabbath School lessons.
- get_github_paths()[source]
Generate GitHub repository paths based on configuration
- Returns:
Dictionary with GitHub paths
- Return type:
dict
sabbath_school_reproducer.downloader module
GitHub Content Downloader for Sabbath School Lessons
This module handles downloading lesson content from the GitHub repository.
- class sabbath_school_reproducer.downloader.GitHubDownloader(github_paths, config=None)[source]
Bases:
objectDownloads Sabbath School lesson content from GitHub repository.
- static check_existing_file(filename, force_overwrite=False)[source]
Check if the file already exists and prompt for overwrite
- Parameters:
filename (str) – Path to the file
force_overwrite (bool) – Whether to force overwrite without prompting
- Returns:
True if should proceed with download, False otherwise
- Return type:
bool
- download_json(url)[source]
Download and parse JSON from a URL
- Parameters:
url (str) – URL to download JSON from
- Returns:
Parsed JSON, or None if download failed
- Return type:
dict
- download_lesson_data()[source]
Download all lesson data from GitHub repository
- Returns:
Dictionary containing all downloaded content
- Return type:
dict
- Raises:
Exception – If download of contents.json fails
sabbath_school_reproducer.main module
Sabbath School Lesson Downloader and Generator
This script downloads lesson content from GitHub and generates a PDF.
Usage: python3 main.py config.yaml [–debug] [–debug-html-only]
sabbath_school_reproducer.processor module
Markdown Processor for Sabbath School Lessons
This module processes markdown files, extracting lesson content, front matter, and back matter.
- class sabbath_school_reproducer.processor.MarkdownProcessor[source]
Bases:
objectProcesses markdown files to extract structured content.
- static adjust_dates(lessons, config)[source]
Adjust lesson dates based on the quarter_start_date in config
- Parameters:
lessons (list) – List of lesson dictionaries
config (dict) – Configuration dictionary with reproduction settings
- Returns:
Updated list of lesson dictionaries with adjusted dates
- Return type:
list
- static extract_and_remove_date(markdown_text, language_code='en')[source]
Extract date from markdown and return the text with the date removed
- Parameters:
markdown_text (str) – The markdown text to process
language_code (str) – The language code
- Returns:
(extracted_date, cleaned_text)
- Return type:
tuple
- static parse_file_sections(content)[source]
Extract content from different file sections marked with special headers
- Parameters:
content (str) – Combined markdown file content
- Returns:
(lessons_content, frontmatter_content, backmatter_content)
- Return type:
tuple
- static parse_lessons(markdown_content, language_code='en')[source]
Parse the markdown content to extract lessons using a line-by-line approach
- Parameters:
markdown_content (str) – Markdown content containing lessons
language_code (str) – Language code for translations
- Returns:
List of lesson dictionaries
- Return type:
list
- static parse_questions_from_markdown(markdown_content, language_code='en')[source]
Parse questions from markdown content.
- Parameters:
markdown_content (str) – Markdown content containing questions
language_code (str) – Language code for translations
- Returns:
List of question dictionaries
- Return type:
list
sabbath_school_reproducer.setup module
Module contents
Sabbath School Lesson Downloader and PDF Generator Package
This package downloads Sabbath School lessons from the GitHub repository and generates a beautifully formatted PDF using a configurable pipeline.