Skip to content

Commit

Permalink
🐛 Fix the spell classList to be only class names
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Oct 14, 2023
1 parent b5d57a4 commit 94b442e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion examples/templates/tools5e/images-spell2md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ tags:
- {tag}
{/for}
{/if}
{#if resource.classes }
classes:
{#each resource.classList}
- {it}
{/each}
{/if}
aliases: ["{resource.name}"]
---
# {resource.name}
Expand All @@ -33,7 +39,7 @@ aliases: ["{resource.name}"]
{/if}{/each}

{/if}{#if resource.classes }
**Classes**: {#each resource.classList}{it} {#if it_hasNext}, {/if}{/each}
**Classes**: {resource.classes}

{/if}
*Source: {resource.source}*
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.ebullient.convert.tools.dnd5e.qute;

import java.util.List;
import java.util.stream.Stream;

import dev.ebullient.convert.qute.ImageRef;
import dev.ebullient.convert.tools.Tags;
Expand Down Expand Up @@ -54,10 +55,12 @@ public QuteSpell(Tools5eSources sources, String name, String source, String leve
this.fluffImages = fluffImages;
}

/** List of links to classes that can use this spell. May be incomplete or empty. */
/** List of class names that can use this spell. May be incomplete or empty. */
public List<String> getClassList() {
return classes == null || classes.isEmpty()
? List.of()
: List.of(classes.split(",\\s*"));
: Stream.of(classes.split(",\\s*"))
.map(s -> s.replaceAll("\\[(.*?)\\].*", "$1"))
.toList();
}
}

0 comments on commit 94b442e

Please sign in to comment.