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

Add support for compound file extensions. #2969

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

holden-nelson
Copy link

@holden-nelson holden-nelson commented Jan 7, 2022

Created a new class ReaderTree that is an infinitely
nested defaultdict containing components of the extension.
See comments on PR #2816.

Pull Request Checklist

Resolves: #issue-number-here

  • Ensured tests pass and (if applicable) updated functional test output
  • Conformed to code style guidelines by running appropriate linting tools
  • Added tests for changed code
  • Updated documentation for changed code

@avaris
Copy link
Member

avaris commented Jan 8, 2022

I'll go over it in more detail when I have more time but glanced over it briefly and this looks promising, thank you :). I think Generators._include_file also needs some adjustment to support compound extensions. Otherwise I don't think it would include foo.bar.baz even if there was a reader for bar.baz. Building on the endswith idea, this might do the trick:

if extensions is False or basename.endswith(extensions):
    return True

@holden-nelson
Copy link
Author

Mmh. Right. Forgot about __include_file. I see how that would work. I'll edit my PR.

@holden-nelson
Copy link
Author

Edited.

@holden-nelson
Copy link
Author

Hello,

Poking around the source code I believe there is another location that is affected by this change.

In the contents.py file, the __init__ method of the Content class generates a slug. If the SLUGIFY_SOURCE is set to basename it uses everything to the left of the last dot to create the slug. So for a file ending in .md.html the .md will be passed into the slugify function.

Additionally, the SourceFileGenerator class grabs the basename of the source files in the same way.

Should I continue working on my PR and write code to account for these issues?

Created a new class ReaderTree that is an infinitely
nested defaultdict containing components of the extension.
See comments on PR getpelican#2816.
@holden-nelson
Copy link
Author

Also pushed a small change that should fix the linter failing :)

@justinmayer justinmayer requested a review from avaris August 4, 2022 12:47
@justinmayer justinmayer requested a review from a team July 27, 2023 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants