shabegom / buttons

Buttons in Obsidian
The Unlicense
455 stars 47 forks source link

`templater true` doesn't leave templates in `type` #82

Closed ThisGuyCodes closed 5 months ago

ThisGuyCodes commented 2 years ago

With the following button:

```button
name Event
type line(<% tp.file.content.split(/\r\n|\r|\n/).length %>) template
action bullet/event
templater true

^button-event


After pressing the button once It's now:
name Event
type line(23) template
action bullet/event
templater true

^button-event



My expectation is the `type` line would still have the template in it.
shabegom commented 2 years ago

That should be working. I need to figure out a better way to handle templater in buttons so it is more reliable. Try reloading obsidian and see if that fixes the issue.

ThisGuyCodes commented 2 years ago

Try reloading obsidian and see if that fixes the issue.

no dice, same behavior; happy to do any debugging you send my way

shabegom commented 2 years ago

I think I'll need to rewrite this feature unfortunately. I've seen it fail too many times.

tot0 commented 2 years ago

@shabegom do you have some clues/ideas as to what's going wrong when using templater in buttons? I've also been seeing inconsistent behavior, sometimes works no problems, sometimes the template is replaced in the button. My use case is creating new notes in a folder that are given a unique id:

```button
name New Action
type note(300 🚰 Pipelines/320 🛠 Actions/<% tp.date.now("YYYYMMDDhhmmss") %>, split) template
action 🛠 New Action
color purple
templater true
class dataview-button
\```

I'd be interested in where the issue lies/starting direction for a fix as this will be core to my workflow and having the button make itself unusable and even sometimes mangle the note it's inside, rather than only effect the new note, is quite frustrating.