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

specific words cause the plugin to fail #7

Closed
usulpt opened this issue Mar 7, 2024 · 5 comments
Closed

specific words cause the plugin to fail #7

usulpt opened this issue Mar 7, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@usulpt
Copy link

usulpt commented Mar 7, 2024

hello.

whenever I use the word "context" (upper or lowercase) in an alias definition under the frontmatter YAML of an mkdocs.yml file, the build process fails with the following error:

meta_data['alias']['text']
~~~~~~~~~~~~~~~~~~^^^^^^^^

I'm using Python 3.11, mkdocs 1.5.3 with mkdocs-material 9.4.1

thanks!
Jorge

@EddyLuten EddyLuten self-assigned this Mar 7, 2024
@EddyLuten EddyLuten added the bug Something isn't working label Mar 7, 2024
@EddyLuten
Copy link
Owner

Interesting, I'll take a look!

@usulpt
Copy link
Author

usulpt commented Mar 7, 2024

it was really weird because I work with a few hundred files in the same folder and I was processing them automatically through another tool that inserts names of files as aliases in the same file. and everything was running fine until it hit a file called "somethingcontext.md". tested it with several files with the same results and ended up having to rename the alias to something like "ctx". maybe there's a reserved keyword, beats me, but the plugin is really useful (great work!) so I wanted to give you a heads-up anyway :)

@EddyLuten
Copy link
Owner

Nope, a big dumb mistake on my end caused this. It was choking on every instance of an alias with the word "text" in it since I did something like:

if 'text' in alias

Rather than:

if isinstance(alias, dict) and 'text' in alias

D'oh! Aliases can be defined as strings or as dictionaries of strings and their default titles, but I wasn't checking for the correct data type :/

I just fixed this and pushed up a new version to PyPI, v0.7.1. Just pip install it as usual, but add the --upgrade flag, which should pull the latest version.

Please let me know if this fixes the issue, and I'll close the bug!

@usulpt
Copy link
Author

usulpt commented Mar 7, 2024

pretty dumb, yeah, and I should know because I made several of those in my programming life :) I hadn't even checked the code before I opened the issue, shame on me.

just tested 0.7.1 and it works fine now! thank you very much for the fix and for doing it lightning-fast!

@EddyLuten
Copy link
Owner

Awesome, thanks for the report!1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants