2.0 KiB
2.0 KiB
<%* let title = tp.file.title; if (title.startsWith("Untitled")) { title = await tp.system.prompt("Vorname Nachname"); await tp.file.rename(title); } const first_name = title.split(" ")[0] const last_name = title.split(" ")[1] const ref = "person/" + title.replace(" ", "_").toLowerCase() tp.file.move("7 People/" + title) tR += "---" %> title: <%* tR += title %> created_date: <% tp.file.creation_date('YYYY-MM-DD') %> updated_date: <% tp.file.creation_date('YYYY-MM-DD') %> aliases: tags: person person: first_name: <% first_name %> last_name: <% last_name %> birthday: type: hobbies: ref: <% ref %>
<%* tR += title %>
- 🏷️Tags : #<% tp.file.creation_date('MM-YYYY') %> #person
📝 Notes
😺Character
[!Info]+ Whats my estimation of their Character? Red, Green, Blue, Yellow?
🔗 Links
Touchpoints
const pagesWithQuotes = await Promise.all(
dv
.pages("#<%ref%>")
.map(pageWithQuote => new Promise(async (resolve, reject) => {
const content = await dv.io.load(pageWithQuote.file.path);
resolve({
link: pageWithQuote.file.link,
content
});
}))
);
// Create an array of pages containing quotes,
// where each page is:
// {
// quotes: [], // array of quotes
// link: { path: '' } // Link
// }
const quotesByPage = pagesWithQuotes.map(({
link,
content
}) => ({
link,
quotes: content
// Split into paragraphs
.split('- ')
// Get only paragraphs that have the #person/firstname_lastname tag
.filter(content => content.includes('#<%ref%>'))
// Remove the "#person/firstname_lastname" tag from each quote string
.map(content => content.replace('#<%ref%>', ''))
}));
quotesByPage.forEach(
page =>
page.quotes.forEach(
quote => dv.paragraph(`- ${quote} (${page.link})`)
)
);