Skip to content

Commit

Permalink
feat: layout name is now added to statblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Jan 13, 2022
1 parent cb75afe commit 8d73700
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/view/Statblock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
export let plugin: StatBlockPlugin;
export let statblock: StatblockItem[];
export let renderer: StatBlockRenderer;
export let layout: string;
let canExport = monster.export ?? plugin.settings.export;
let canDice =
Expand Down Expand Up @@ -102,14 +103,20 @@
?.toLowerCase()
.replace(/[^A-Za-z0-9\s]/g, "")
.replace(/\s+/g, "-") ?? "no-name";
const layoutName =
layout
.toLowerCase()
.replace(/[^A-Za-z0-9\s]/g, "")
.replace(/\s+/g, "-") ?? "no-layout";
const classes = [name, layoutName].filter((n) => n?.length);
</script>

<div class="container" bind:this={container}>
{#if ready}
<div
class:obsidian-statblock-plugin={true}
class:statblock={true}
class={name}
class={classes.join(" ")}
>
{#if monster}
<Bar />
Expand Down
1 change: 1 addition & 0 deletions src/view/statblock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class StatBlockRenderer extends MarkdownRenderChild {
context: this.context,
monster: this.monster,
statblock: this.layout.blocks,
layout: this.layout.name,
plugin: this.plugin,
renderer: this
}
Expand Down

0 comments on commit 8d73700

Please sign in to comment.