Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change implementation of frontmatter generator (__generate_frontmatter() in EditionParser) to handle all types of frontmatters #62

Closed
kodzonko opened this issue Mar 28, 2022 · 1 comment
Assignees

Comments

@kodzonko
Copy link
Contributor

kodzonko commented Mar 28, 2022

Current implementation only handles /matter/foreword.html, /matter/introduction.html and /matter/acknowledgements.html frontmatter types. For other files it throws ValueError. We need to make it cover all types of frontmatters or be less strict about unknown types (i.e. not raise an error) otherwise we cannot execute the app.

A piese of code which needs to be reworked (sutta_publisher/src/sutta_publisher/edition_parsers/base.py):

for suffix in matter_paths:
    response = requests.get(url.format(matter=suffix, working_dir=working_dir))
    response.raise_for_status()

    match suffix:
        case "/matter/foreword.html":
            matters_dict["foreword"] = response.text

        case "/matter/introduction.html":
            matters_dict["introduction"] = response.text

        case "/matter/acknowledgements.html":
            matters_dict["acknowledgements"] = response.text

        case _:
            raise ValueError("Not supported frontmatter type")

return matters_dict
@kodzonko
Copy link
Contributor Author

kodzonko commented Apr 5, 2022

This will be implemented along with issue #61 on branch 61-Implement-fetching-additional-headers-and-reorganizing-headings-numbers-in-a-base-html.

@kodzonko kodzonko self-assigned this Apr 5, 2022
@kodzonko kodzonko moved this from Todo to In Progress in Publications Apr 5, 2022
@kodzonko kodzonko moved this from In Progress to In Review in Publications Apr 8, 2022
@iseekk iseekk closed this as completed Jun 17, 2022
Repository owner moved this from In Review to Done in Publications Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants