From c403a245b81f8c9d82bc8ccae08f82d87172dc14 Mon Sep 17 00:00:00 2001 From: buttercat1791 Date: Fri, 14 Mar 2025 08:26:47 -0500 Subject: [PATCH] Move some publication rendering snippets to a separate file --- src/lib/components/Preview.svelte | 45 ++------------------- src/lib/snippets/PublicationSnippets.svelte | 45 +++++++++++++++++++++ 2 files changed, 48 insertions(+), 42 deletions(-) create mode 100644 src/lib/snippets/PublicationSnippets.svelte diff --git a/src/lib/components/Preview.svelte b/src/lib/components/Preview.svelte index f7dfe03..c980b48 100644 --- a/src/lib/components/Preview.svelte +++ b/src/lib/components/Preview.svelte @@ -1,8 +1,9 @@ -{#snippet sectionHeading(title: string, depth: number)} - {#if depth === 0} -

- {title} -

- {:else if depth === 1} -

- {title} -

- {:else if depth === 2} -

- {title} -

- {:else if depth === 3} -

- {title} -

- {:else if depth === 4} -
- {title} -
- {:else} -
- {title} -
- {/if} -{/snippet} - -{#snippet contentParagraph(content: string, publicationType: string)} - {#if publicationType === 'novel'} -

- {@html content} -

- {:else} -

- {@html content} -

- {/if} -{/snippet} -
{:else} - {@render contentParagraph(currentContent, publicationType)} + {@render contentParagraph(currentContent, publicationType, isSectionStart)} {/if} {/key} {:else} diff --git a/src/lib/snippets/PublicationSnippets.svelte b/src/lib/snippets/PublicationSnippets.svelte new file mode 100644 index 0000000..26645fa --- /dev/null +++ b/src/lib/snippets/PublicationSnippets.svelte @@ -0,0 +1,45 @@ + + +{#snippet sectionHeading(title: string, depth: number)} + {#if depth === 0} +

+ {title} +

+ {:else if depth === 1} +

+ {title} +

+ {:else if depth === 2} +

+ {title} +

+ {:else if depth === 3} +

+ {title} +

+ {:else if depth === 4} +
+ {title} +
+ {:else} +
+ {title} +
+ {/if} +{/snippet} + +{#snippet contentParagraph(content: string, publicationType: string, isSectionStart: boolean)} + {#if publicationType === 'novel'} +

+ {@html content} +

+ {:else} +

+ {@html content} +

+ {/if} +{/snippet}