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 generated_by attribute to page.file #20

Merged
merged 3 commits into from
Apr 27, 2023

Conversation

timvink
Copy link
Contributor

@timvink timvink commented Nov 28, 2022

This PR adds an attribute to generated files.

Currently, mkdocs-gen-files and mkdocs-git-revision-date-localized-plugin are incompatible.

Using this new attribute, this PR can add support: timvink/mkdocs-git-revision-date-localized-plugin#102

More details in timvink/mkdocs-git-revision-date-localized-plugin#101

Copy link
Owner

@oprypin oprypin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I suppose the src_path attributes are untruthful coming from mkdocs-gen-files.
Perhaps un-setting the src_path would be the cooler solution, but it's also likely to break something else.
So, nice.

@timvink
Copy link
Contributor Author

timvink commented Dec 5, 2022

Can you give me a pointer on how to solve the style error?

mkdocs_gen_files/editor.py:48: error: "File" has no attribute "generated_by"  [attr-defined]

@timvink
Copy link
Contributor Author

timvink commented Dec 12, 2022

Fixed it.. after a bit of search I released it was a mypy error (I'm not familiar with hatch), # type: ignore fixed it.

@timvink
Copy link
Contributor Author

timvink commented Dec 12, 2022

This time it was black. I needed to upgrade also.

p.s. A small section on 'contributing' and how to run the hatch commands would be a nice addition :)

@timvink
Copy link
Contributor Author

timvink commented Mar 2, 2023

Hi @oprypin , any blockers to merging this PR? Seems ready to go :)

@pawamoy
Copy link

pawamoy commented Apr 26, 2023

I'm interested in this as well (would like to to use mkdocs-git-revision-date-localized-plugin 😉). Let me know if I can be of any help!

Copy link
Owner

@oprypin oprypin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@oprypin oprypin merged commit 61233e6 into oprypin:master Apr 27, 2023
@oprypin
Copy link
Owner

oprypin commented Apr 27, 2023

And released. Sorry for the huge delay.

@squidfunk
Copy link

Sorry for necroposting, but could we add generated_by to MkDocs' File class? That would allow for better plugin inter-op. Currently, it's added as an anonymous attribute and you can't be sure that it's there. One improvement might be to add the plugin instance to generated_by, so other plugins might even be able to access public state in plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants