shabegom / buttons

Buttons in Obsidian
The Unlicense
478 stars 50 forks source link

Unable to Add Template with Hyphens in Name #4

Closed SlRvb closed 3 years ago

SlRvb commented 3 years ago

I can't seem to get the button plugin to work if my template has a - hyphen in the name, it just says that it can't find the specified template.

Could you add something like "" quotations to pull the file names so I wouldn't have to rename files?

shabegom commented 3 years ago

I will take a look at why it is failing. Do you have a example file name so I can reproduce?

Mainly wondering if it is

action My - Template

Or

action My-Template

shabegom commented 3 years ago

Ah it is My - Template. I'll take a look tomorrow at why that might be failing. If I can't fix I'll support wrapping in "".

SlRvb commented 3 years ago

Not sure if maybe - or spaces and -, but the title of my template was Tuning-Standard Template and this wasn't really loading in.

shabegom commented 3 years ago

Can you paste in the whole button code when you have a moment? I just tried:

Tuning-Standard Template

And it loaded in the note contents.

SlRvb commented 3 years ago

Oof if this is user error, that's embarrassing but this is what I put:

name Tab
type prepend template
action Tuning-Standard Template
shabegom commented 3 years ago

I'm going to add a "add button template" command and do some better handling of arguments to try and reduce potential errors in the future. LMK if you have any other issues.

SlRvb commented 3 years ago

Actually I think I realized what the error is! It's not the hyphen -, I have some templates in subfolders inside the template folder. Any of those files in a subfolder bring up the error, regardless of name.

I guess I have to put in the full file path for it to find the correct file.