feat(template): adds support for an ooc note in the template
This commit is contained in:
parent
85b87f8140
commit
63e8178fb0
4 changed files with 12 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
<description>The standard record format used by a majority of players.</description>
|
||||
|
||||
<record type="public">
|
||||
<note>Basic identification information visible on all records.</note>
|
||||
<field label="Name" type="text" required="true" />
|
||||
<field label="Species" type="species" required="true" />
|
||||
<field label="Subspecies" type="subspecies" />
|
||||
|
|
|
|||
|
|
@ -34,8 +34,15 @@
|
|||
/>
|
||||
<div class="flex-1 min-w-0">
|
||||
<span class="font-medium capitalize">{record.type}</span>
|
||||
{#if record.preamble}
|
||||
<span class="block text-xs truncate" style="color: var(--text-muted);">{record.preamble}</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}
|
||||
<span class="block text-xs" style="color: var(--text-muted);">{record.preamble}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="text-sm tabular-nums" style="color: var(--text-muted);">
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ export function parseTemplate(xml: string, id: string): Template {
|
|||
const records: RecordDef[] = root.record.map((r: any) => ({
|
||||
type: r['@_type'],
|
||||
preamble: r.preamble?.trim(),
|
||||
note: r.note?.trim(),
|
||||
fields: r.field.map(parseField)
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ export type FieldDef =
|
|||
export interface RecordDef {
|
||||
type: string;
|
||||
preamble?: string;
|
||||
note?: string;
|
||||
fields: FieldDef[];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue