diff --git a/src/lib/components/util/TocToggle.svelte b/src/lib/components/util/TocToggle.svelte
new file mode 100644
index 0000000..7bee061
--- /dev/null
+++ b/src/lib/components/util/TocToggle.svelte
@@ -0,0 +1,124 @@
+
+
+{#if showTocButton && !showToc}
+
+{/if}
+
+
\ No newline at end of file
diff --git a/src/lib/parser.ts b/src/lib/parser.ts
index b9f9545..6450ebf 100644
--- a/src/lib/parser.ts
+++ b/src/lib/parser.ts
@@ -121,6 +121,11 @@ export default class Pharos {
*/
private eventsByLevelMap: Map = new Map();
+ /**
+ * A map of blog entries
+ */
+ private blogEntries: Map = new Map();
+
/**
* When `true`, `getEvents()` should regenerate the event tree to propagate updates.
*/
@@ -177,6 +182,14 @@ export default class Pharos {
this.parse(content);
}
+ getBlogEntries() {
+ return this.blogEntries;
+ }
+
+ getIndexMetadata(): IndexMetadata {
+ return this.rootIndexMetadata;
+ }
+
/**
* Generates and stores Nostr events from the parsed AsciiDoc document. The events can be
* modified via the parser's API and retrieved via the `getEvents()` method.
@@ -617,6 +630,23 @@ export default class Pharos {
tags.map(tag => this.ndk.fetchEventFromTag(tag, event))
);
+ // if a blog, save complete events for later
+ if (event.getMatchingTags("type")[0][1] === 'blog') {
+ childEvents.forEach(child => {
+ if (child) {
+ this.blogEntries.set(child?.getMatchingTags("d")?.[0]?.[1], child);
+ }
+ })
+ }
+
+ // populate metadata
+ if (event.created_at) {
+ this.rootIndexMetadata.publicationDate = new Date(event.created_at * 1000).toDateString();
+ }
+ if (event.getMatchingTags('image')) {
+ this.rootIndexMetadata.coverImage = event.getMatchingTags('image')[0][1];
+ }
+
// Michael J - 15 December 2024 - This could be further parallelized by recursively fetching
// children of index events before processing them for content. We won't make that change now,
// as it would increase complexity, but if performance suffers, we can revisit this option.