specific words cause the plugin to fail #7

Closed
opened 2024-03-07 11:47:41 +01:00 by usulpt · 5 comments
usulpt commented 2024-03-07 11:47:41 +01:00 (Migrated from github.com)

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

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 commented 2024-03-07 17:45:26 +01:00 (Migrated from github.com)

Interesting, I'll take a look!

Interesting, I'll take a look!
usulpt commented 2024-03-07 17:55:12 +01:00 (Migrated from github.com)

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 :)

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 commented 2024-03-07 18:00:50 +01:00 (Migrated from github.com)

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!

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: ```python if 'text' in alias ```` Rather than: ```python 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](https://github.com/EddyLuten/mkdocs-alias-plugin/releases/tag/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 commented 2024-03-07 18:19:23 +01:00 (Migrated from github.com)

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!

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 commented 2024-03-07 18:20:35 +01:00 (Migrated from github.com)

Awesome, thanks for the report!1

Awesome, thanks for the report!1
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
luten/mkdocs-alias-plugin#7
No description provided.