YAML into symbols

What I’m trying to do

In my movie vault i give the rating like this:

rating: 5

in my note i use =this.rating , but i want it to know if there is a way to transform this number into symbols, to show up the rating in stars, like this “☆☆☆☆☆”, but keeping the YAML the same. I tried to create a cssclass but i couldnt link the frontmatter to it. Sorry for my bad english, and thank you all for the help

this code is vile, but it does sort of do what you want:

=choice(this.rating = 5,"☆☆☆☆☆",choice(this.rating = 4,"☆☆☆☆",choice(this.rating = 3,"☆☆☆",choice(this.rating = 2,"☆☆",choice(this.rating = 1,"☆","")))))

… and this is a million times better =this.rating*"☆"

2 Likes

wow thank you so much, it worked perfectly. im kinda new in this, how did you discovered that? there is some kind of documentation?

1 Like

I never leave home without it Functions - Dataview

1 Like

oh wow thank you man, you helped me so much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.