49 lines
987 B
Markdown
49 lines
987 B
Markdown
|
|
```dataviewjs
|
|
const files = app.vault.getFiles()
|
|
.filter(file =>
|
|
file.path.includes("Thèse/Séminaires") &&
|
|
file.extension === "md"
|
|
);
|
|
|
|
const rows = [];
|
|
|
|
for (const file of files) {
|
|
|
|
const content = await app.vault.cachedRead(file);
|
|
|
|
// Extract frontmatter block
|
|
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
|
|
let fm = {};
|
|
|
|
if (match) {
|
|
fm = obsidian.parseYaml(match[1]) ?? {};
|
|
}
|
|
|
|
function getFields(content) {
|
|
const fields = {};
|
|
const regex = /^\*\*(.+?)\*\*::[ \t]*([^\n\r]*)$/gm;
|
|
let match;
|
|
while ((match = regex.exec(content)) !== null) {
|
|
fields[match[1]] = match[2].trim();
|
|
}
|
|
return fields;
|
|
}
|
|
const fields = getFields(content)
|
|
|
|
rows.push([
|
|
fields.Titre,
|
|
fields.Speaker,
|
|
fields.Date,
|
|
fields.Contribution,
|
|
fields.Lieu,
|
|
dv.fileLink(file.path)
|
|
]);
|
|
}
|
|
|
|
dv.table(
|
|
["Title", "Speaker", "Date", "Contrib.", "Lieu","File"],
|
|
rows
|
|
);
|
|
```
|