Open 9diov opened 1 week ago
Should be improved in 0.9.3 but some more work is needed. See readme.
Hi, I am trying to do something similar.
On a Medium.com Article page I find the tags which I than |map
and want to prepend "Medium/" to the tags.
Expected output:
tags:
- Medium
- Medium/Cooking
- Medium/Healthy-Lifestyle
I tried a few things and believe this should be close:
Medium, {{selector:a[href*='/tag/']|map:item => item|template:'Medium/${item}'|replace:' ':'-'|join:', '}}
but that gives me Medium, Medium/Medium/Medium/Medium/Medium/
Please help. btw the Clipper is a Godsend, I was trying to get my Medium articles in Obsidian with the unofficial Medium API on RapidAPI but Clipper is gonna be so much cooler!
EDIT: looking better at the OP example I came up with:
Medium, {{selector:a[href*='/tag/']|map:item => {str: item}|template:"Medium/${str}, "|replace:' ':'-'|join}}
It gives me the desired output. Is this correct? Instead of delimiting the comma with |join
do it in the |template
?
My use case is to add a prefix to a list of values, for example I want to extract Genres from a Goodreads page, and turn that into a list of Wikilink like this: ["genres/Nonfiction", "genres/Fitness"]. I thought that it is possible to do this with
map
andtemplate
filters but it turned out they only work with object-based items, not strings.Describe the solution you'd like There are 2 ways transforming list of strings like above can be done:
map
to convert a string to an object then usetemplate
e.g.map:item => {str: item}|template:"genres/${str}"
_item
to refer to the original item e.g.template:"genres/${_item}