seethroughdev / obsidian-recipe-grabber

MIT License
53 stars 7 forks source link

Some changes #25

Closed Lanjelin closed 5 months ago

Lanjelin commented 5 months ago

Made changes to avoid issues with properties when using obsidian-recipe-view.

Improved image grabbing #10

Added handlebar functions for

seethroughdev commented 5 months ago

This looks incredible @Lanjelin. Thanks for taking the time to do this! I'll take some time over the next couple days and look through the PR closer, but there appears to be a lot great fixes in here. How closely did you test these changes locally?

Lanjelin commented 5 months ago

So far I've been testing the changes with 10 different recipes from 5 sites, in hope to catch everything that could go wrong.
Will be doing some more tinkering and testing over the next few days.
Trying to get a one-in-all date formatter function working.

Lanjelin commented 5 months ago

Couldn't leave the code alone, and came up with a handlebar function to handle much of what one could want including time and dates.
It would replace prettyTime and savedAt included in this PR with a single magicTime, and extend functionability to include re-formatting date/time, to use with eg. datePublished.

Currently having these changes live at a test repo here, and you can install them using Obsidian BRAT (current version of the plugin needs to be removed though)
The function can be viewed here

I'll push these changes here if you want, it would simplify stuff, but I believe it might need some more testing.

Using the following template produces.

---
DateSaved: {{magicTime}}
DateSaved2: {{magicTime "dd-mm-yyyy HH:MM"}}
PrepTime: {{magicTime prepTime}}
CookTime: {{magicTime cookTime}}
TotalTime: {{magicTime totalTime}}
DatePublished1: {{magicTime datePublished}}
DatePublished2: {{magicTime datePublished "dd-mm-yyyy HH:MM"}}
DateModified: {{magicTime dateModified}}
DateModified2: {{magicTime dateModified "d-m-yy HH:MM"}}
---

https://leitesculinaria.com/7759/recipes-pasteis-de-nata.html image https://tasty.co/recipe/the-best-chewy-chocolate-chip-cookies image https://www.godt.no/oppskrifter/pasta/8529/kremet-kyllingpasta image

seethroughdev commented 5 months ago

Really incredible work. I like magicTime, obviously introduces come complexity into the function, but makes the api for users a lot simpler. I'm good with it.

If you feel its good for merging, i'll try and do some last minute testing and get it out there.

Also please let me know if I can make you a contributor on the project. You and @Flxp49 have really improved things here.

Lanjelin commented 5 months ago

LGTM!

We should add your .prettierrc file to the repo so the formatting changes stay consistent. I don't have strong preferences on any of the rules.

I can add an npm task and run it on all files to to make sure we don't have to deal with those in the future too.

Just recently moved from VSCode to AstroNVIM with some custom settings, forcing me to learn nvim more properly.
I've found where the formatting is executed (as in where I can stop it from happening=, but not where the formatting rules are.

Really incredible work. I like magicTime, obviously introduces come complexity into the function, but makes the api for users a lot simpler. I'm good with it.

If you feel its good for merging, i'll try and do some last minute testing and get it out there.

I've been running my main vault on the beta version I've linked to, and so far so good.
One can never be too safe when releasing to the masses though. Also please let me know if I can make you a contributor on the project. You and @Flxp49 have really improved things here.

Sure thing, might come up with a few more interesting things, if I can keep the steam up.

seethroughdev commented 5 months ago

This all looks good. Let me know if you have more to add, or if its ready to merge.

Lanjelin commented 5 months ago

This all looks good. Let me know if you have more to add, or if its ready to merge.

It's ready to merge.

seethroughdev commented 4 months ago

Merged this in @Lanjelin . Thanks again for the work. I squashed the release commits so you may want to replace main branch in the event you're inspired to make any other changes :)