core/formatters/record.formatter.ts

core/formatters/record.formatter.ts is a file in Bane's Lab Build Scripts. 34 lines of code and 1 definition.

import {
    ALIASES_LABEL,
    CANONICAL_LABEL,
    CLOSURE_LABEL,
    FORMED_BY_LABEL,
    KIND_LABEL,
    LAYER_LABEL,
    RECORD_LABEL,
    SCOPE_LABEL,
    SEVERITY_LABEL,
} from "@banes-lab/web/strings/ontology.strings";
import { addressLines, blocks, code, heading, quote } from "#core/formatters/markdown.formatter";
import { linkText, placementLine, relationSections } from "#core/formatters/link.formatter";
import type { RecordData } from "#types/record.types";
import { recordText } from "#core/selectors/record.selector";

export const renderRecordLeaf = function renderRecordLeaf(data: RecordData): string {
    return blocks([
        heading(data.name),
        quote(data.summary),
        addressLines([
            [RECORD_LABEL, code(data.ref)],
            [KIND_LABEL, data.kind],
            [LAYER_LABEL, data.layer === null ? null : linkText(data.layer)],
            [SEVERITY_LABEL, recordText(data, "severity")],
            [SCOPE_LABEL, recordText(data, "scope")],
            [ALIASES_LABEL, recordText(data, "aliases")],
            [FORMED_BY_LABEL, recordText(data, "formedBy")],
            [CANONICAL_LABEL, data.href],
            [CLOSURE_LABEL, recordText(data, "closure")],
        ]),
        placementLine(data),
        ...relationSections(data.relations),
    ]);
};