diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b8c433..fa3b804 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added a `2dpyramids` koan type (rectangular grid of pyramids). * Added 45-degree rotations to the pyramids (`NE`, `SE`, `SW`, `NW`). * Added 1d and 2d playing card koans. +* Added download button for SVG koans (buggy with playing cards). ### Changed diff --git a/src/lib/Game/ViewKoan.svelte b/src/lib/Game/ViewKoan.svelte index 3147a9a..591cd9e 100644 --- a/src/lib/Game/ViewKoan.svelte +++ b/src/lib/Game/ViewKoan.svelte @@ -60,6 +60,15 @@ svgResults = process1dCards(koanStr); } else if ($game.koanType === "2dcards") { svgResults = process2dCards(koanStr); + } else if ($game.koanType === "graphviz") { + svgResults = "Rendering..."; + graphviz.dot(koanStr, "svg") + .then((svg) => { + svgResults = svg; + }) + .catch((err) => { + svgResults = err; + }); } let modalDelete = ""; @@ -120,13 +129,7 @@ {:else if $game.koanType === "graphviz"}
- {#await graphviz.dot(koanStr, "svg")} - Rendering... - {:then svg} - {@html svg} - {:catch err} - Error: {err} - {/await} + {@html svgResults}
{:else}
@@ -157,6 +160,15 @@ {/if} + {#if ( ($game.koanType === "1dpyramids") || ($game.koanType === "2dpyramids") || ($game.koanType === "1dcards") || ($game.koanType === "2dcards") || ($game.koanType === "dotmatrix") || ($game.koanType === "graphviz"))} + + {/if} {/if} diff --git a/src/lib/ViewKoanSupport/Cards.ts b/src/lib/ViewKoanSupport/Cards.ts index 04b9268..b95bacb 100644 --- a/src/lib/ViewKoanSupport/Cards.ts +++ b/src/lib/ViewKoanSupport/Cards.ts @@ -52,10 +52,10 @@ const cardSymbols = new Map([ ["TD", ``], ["TH", ``], ["TS", ``], - ["BJ", ` JokerJoker`], - ["RJ", `JokerJoker`], + ["BJ", ` JokerJoker`], + ["RJ", `JokerJoker`], ["BKR", ``], - ["BKB", ``], + ["BKB", ``], ]); export const process1dCards = (koanStr: string): string => { diff --git a/src/lib/ViewKoanSupport/DotMatrix.ts b/src/lib/ViewKoanSupport/DotMatrix.ts index 1e31979..b04e9c7 100644 --- a/src/lib/ViewKoanSupport/DotMatrix.ts +++ b/src/lib/ViewKoanSupport/DotMatrix.ts @@ -24,7 +24,7 @@ export const processDotMatrixSVG = (koanStr: string): string => { let svgStr = `${koanStr}`; // Just add all nine colours every time, used or not for (let i = 0; i < colours.length; i++) { - svgStr += ``; + svgStr += ``; } svgStr += ``;