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

Detect and keep aliases that don't match the filename #21

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

quantumgardener
Copy link
Contributor

I set up a query that effectively aliases the name. I wanted to display "Who is the Quantum Gardener?" instead of "Who is the Quantum Gardener". The problem arises because we can't have ? in filenames.

In my vault I use the title property for this so the query was:

<!-- QueryToSerialize: table without id link(file.name, default(title,file.name)) as Note, default(date(updated),date(datetime)) as Date from "notes" sort default(date(updated),date(datetime)) desc limit 50 -->

Native Dataview handles this properly and displayed "Who is the Quantum Gardener?" as an alias for "Who is the Quantum Gardener". Hover over the link with the ? and the correct page displays.

In this plugin, the previous changes to remove the filename stripped out the alias completely. We assumed they were the same. So there was now a link to [[Who is the Quantum Gardener?]] instead of the expected `[[Who is the Quantum Gardener|Who is the Quantum Gardener?]]

This change now checks for a valid alias as one that does not match the filename. If it's valid, the replace is handled differently.

@quantumgardener
Copy link
Contributor Author

I've not changed the code for list because I can't get it to emulate the same behaviour. Within a list link(...) in dataview it returns quite a different beast. Items are displayed as list:alias. Serializer code does the same.

The output is [[Who is the Quantum Gardener]]: [[Who is the Quantum Gardener?]]

It's going to require a check for multiple square brackets and a colon to even determine if this extreme edge case exists.

@dsebastien dsebastien merged commit 70e9f66 into dsebastien:master Sep 23, 2024
1 check failed
@dsebastien
Copy link
Owner

Thanks! I'll release a new version with the change soon

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.

2 participants