feat(template): adds support for an ooc note in the template

This commit is contained in:
Lewis Wynne 2026-03-23 19:03:50 +00:00
parent 85b87f8140
commit 63e8178fb0
4 changed files with 12 additions and 2 deletions

View file

@ -3,6 +3,7 @@
<description>The standard record format used by a majority of players.</description> <description>The standard record format used by a majority of players.</description>
<record type="public"> <record type="public">
<note>Basic identification information visible on all records.</note>
<field label="Name" type="text" required="true" /> <field label="Name" type="text" required="true" />
<field label="Species" type="species" required="true" /> <field label="Species" type="species" required="true" />
<field label="Subspecies" type="subspecies" /> <field label="Subspecies" type="subspecies" />

View file

@ -34,8 +34,15 @@
/> />
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0">
<span class="font-medium capitalize">{record.type}</span> <span class="font-medium capitalize">{record.type}</span>
{#if record.note || record.preamble}
<div class="flex flex-col{record.note && record.preamble ? ' gap-1' : ''}">
{#if record.note}
<span class="block text-xs" style="color: var(--text-muted);">{record.note}</span>
{/if}
{#if record.preamble} {#if record.preamble}
<span class="block text-xs truncate" style="color: var(--text-muted);">{record.preamble}</span> <span class="block text-xs" style="color: var(--text-muted);">{record.preamble}</span>
{/if}
</div>
{/if} {/if}
</div> </div>
<span class="text-sm tabular-nums" style="color: var(--text-muted);"> <span class="text-sm tabular-nums" style="color: var(--text-muted);">

View file

@ -103,6 +103,7 @@ export function parseTemplate(xml: string, id: string): Template {
const records: RecordDef[] = root.record.map((r: any) => ({ const records: RecordDef[] = root.record.map((r: any) => ({
type: r['@_type'], type: r['@_type'],
preamble: r.preamble?.trim(), preamble: r.preamble?.trim(),
note: r.note?.trim(),
fields: r.field.map(parseField) fields: r.field.map(parseField)
})); }));

View file

@ -92,6 +92,7 @@ export type FieldDef =
export interface RecordDef { export interface RecordDef {
type: string; type: string;
preamble?: string; preamble?: string;
note?: string;
fields: FieldDef[]; fields: FieldDef[];
} }