//CONFIG
const path = '"1. General/Historic Events"'
const title = "Historic Events"
//FUNCTIONS
function genMermaidLine(page, begin, end) {
return ;
}
function checkfrontmatter(page){
if (typeof page.gantt != "undefined")
{
if (typeof page.gantt.begin != "undefined" && typeof page.gantt.end != "undefined")
{
return true;
}
if (typeof page.gantt.milestone != "undefined")
{
return true;
}
}
return false;
}
function loopPages(pages) {
let mermaid = '';
console.log(pages)
pages = pages.filter(page => checkfrontmatter(page))
console.log(pages)
//sort pages by gantt.begin
for (let page of pages) {
//log to console
console.log("Processing:"+ page.file.name)
console.log(page)
//check if gantt.begin and gantt.end object exists in page
if (typeof page.gantt != "undefined"){
if (typeof page.gantt.begin != "undefined" && typeof page.gantt.end != "undefined") {
let identifier = page.file.name.replace(/ /g, "_");
//create mermaid line
mermaid += page.file.name + ' : ' + identifier + ", " + page.gantt.begin + ', ' + page.gantt.end + '\n';
//make clickable
mermaid += 'click ' + identifier + ' href "obsidian://open?vault=obsidian&file=' + page.file.path + '"\n';
}
//milestone if gantt.milestone exists
//format:
// A task :milestone, identifier, 2014-01-01, 2014-01-01
if (typeof page.gantt.milestone != "undefined") {
console.log("milestone:"+ page.file.name)
let identifier = page.file.name.replace(/ /g, "_");
//create mermaid line
mermaid += page.file.name + ' :milestone, ' + identifier + ", " + page.gantt.milestone + ', ' + page.gantt.milestone + '\n';
//make clickable
mermaid += 'click ' + identifier + ' href "obsidian://open?vault=obsidian&file=' + page.file.path + '"\n';
}
}
}
return mermaid;
}
//dates are not related to the actual date but a fantasy date system
//deactivate todayMarker and start with year 0
const Mermaid = `gantt
title `+title+`
todayMarker off
dateFormat DD-MM-YYYY
axisFormat %Y
`;
const pages = dv.pages(path)
dv.paragraph('```mermaid\n' + Mermaid +loopPages(pages)+ '\n```');
Those are the most important facts about the War between the Defilers and the League of Arathor:
The initial attack on Lichtachte occurred in the year 3014. The attackers were a horde of zombies. The zombies overwhelmed the city's defenses, and many people were killed. To regain the casualties Malachi spread her Plague to rescue the citizens. This is what caused the great divide in The Basin.
The Zombies were controlled by Naruun who instigated the attack with his last bit of power to get Malachi to use her Ritual. Naruun, General Malachi, instigate, power, Ritual
Comments
We'd love to hear how you've used this content in your own campaigns! Share your anecdotes and examples in the comments below to inspire and help other readers imagine the possibilities. Your input can also help us refine and improve the note structure for future adventure modules.