From 9f2aebfe4c95515ba21248ed51d4b860a187b616 Mon Sep 17 00:00:00 2001 From: limina1 Date: Sun, 26 Oct 2025 19:39:25 -0400 Subject: [PATCH] Fix tag rendering for all event types in preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed regex bug in attribute parsing (\s instead of \\s) - Section-specific tags now extracted correctly from AsciiDoc attributes - Added tag display for index events (30040) in preview - Removed duplicate document header/tags rendering - Tags now show for all 30040 and 30041 events at all parse levels 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/lib/components/ZettelEditor.svelte | 69 +++++++++------------ src/lib/utils/publication_tree_processor.ts | 2 +- 2 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/lib/components/ZettelEditor.svelte b/src/lib/components/ZettelEditor.svelte index 450fbab..04c107c 100644 --- a/src/lib/components/ZettelEditor.svelte +++ b/src/lib/components/ZettelEditor.svelte @@ -922,37 +922,6 @@ Start typing to see the preview... {:else} - - {#if contentType === "article" && publicationResult?.metadata.title} -
-

- {publicationResult.metadata.title} -

- - {#if publicationResult.metadata.attributes.tags} - {@const tagsList = - publicationResult.metadata.attributes.tags - .split(",") - .map((t: string) => t.trim())} - {#if tagsList.length > 0} -
- {#each tagsList as tag} - - #{tag} - - {/each} -
- {/if} - {/if} -
- {/if} -
{#if contentType === "article" && publicationResult?.metadata.title} @@ -977,17 +946,35 @@ class="mb-6 pb-6 border-b border-gray-200 dark:border-gray-700 last:border-0" > {#if section.isIndex} - -
- Index Event (30040) + +
+ +
+ Index Event (30040) +
+ + +

+ {section.title} +

+ + + {#if section.tags && section.tags.length > 0} +
+ {#each section.tags as tag} + + #{tag[1]} + + {/each} +
+ {/if}
-

- {section.title} -

{:else}
diff --git a/src/lib/utils/publication_tree_processor.ts b/src/lib/utils/publication_tree_processor.ts index 7922bf8..c714d52 100644 --- a/src/lib/utils/publication_tree_processor.ts +++ b/src/lib/utils/publication_tree_processor.ts @@ -319,7 +319,7 @@ function parseSegmentContent( for (let i = 1; i < sectionLines.length; i++) { const line = sectionLines[i].trim(); if (line.startsWith(":") && line.includes(":")) { - const match = line.match(/^:([^:]+):\\s*(.*)$/); + const match = line.match(/^:([^:]+):\s*(.*)$/); if (match) { attributes[match[1]] = match[2]; contentStartIdx = i + 1;