sytone / obsidian-queryallthethings

Query all your data stored in Obsidian, this plugin allows SQL based queries against the data collections available in Obsidian and Dataview. Output can then be rendered by Handlebars
https://sytone.github.io/obsidian-queryallthethings/
MIT License
120 stars 2 forks source link

I need some example for customJSForHandlebars #25

Open x1brn opened 1 month ago

x1brn commented 1 month ago

Example for customJSForSql works fine. but I cannot write code for customJSForHandlebars. could you give me some examples?

sytone commented 1 month ago

Let me look for a example I had, I do not use this often at the moment so need to check as I moved all the handlebars I needed to the code :)

Also apologies for delay the notifications were not getting sent to my email and were being blocked.

sytone commented 1 month ago

I have done a hunt and I have not got a reference for this, I also have not rewired the calls since the last code rewrite so it would not work anyway. I will need to create a dummy one and get it flowing through.

What are y ou wanting in a handlebars helper?

x1brn commented 1 month ago

for example, simple "eq" helper.

{{#eq value1 value2}}
  <!-- When the two values are equal -->
  <p>The values are equal.</p>
{{else}}
  <!-- When the two values are not equal -->
  <p>The values are not equal.</p>
{{/eq}}

ref. https://gist.github.com/tracend/7522125

sytone commented 1 month ago

These looked handy, I just committed a change adding them with examples and tests. Thanks for the reference. The wire up of the custom items will take a while so hope this helps in the interim. Ill release a new version later today with this feature.

RitchieMatt commented 1 month ago

I find handlebars indispensable for note creation automation, therefore the use of Handlebars Helpers. I've found the JSON importer plugin does this very well. Obsidian JSON Importer

It implements the entire Handlebars Helpers CI library Handlebars Helpers CI Git. It has pretty much everything I need already made with documentation.

Perhaps you could checkout the code for both of these and see if you can implement it in your plugin somehow?

sytone commented 1 month ago

If I remember correctly I tried to add the library but it ended up exploding into little pieces at the time. Ill have a look again to see if I can get it integrated.