• Operand
  • ./bin/ganged/upon.

gram: page

> ./src/schema.js

Lenses
(coming soon!)


import { SchemaAdapter } from "@automerge/prosemirror"

// import {Schema} from "prosemirror-model"

var bill_dtd = new SchemaAdapter({
  nodes: {
    doc: {
      content: 'bill',
    },
    bill: {
      content: 'metadata form legis_body endorsement',
      toDOM: () => (['div', { class: 'bill' }, 0]),
      parseDOM: [ { tag: 'div', class: 'bill' }, ],
      automerge: { block: "paragraph" },
    },

    metadata: {
      content: 'dublin_core?',
      toDOM: () => ['span', { class: 'metadata' }, 0],
      parseDOM: [{ tag: 'span', class: 'metadata' }],
      automerge: { block: "paragraph" },
    },
    dublin_core: {
      content: '',
      toDOM: () => ['span', { class: 'dublinCore' }, 0],
      parseDOM: [{ tag: 'span', class: 'dublinCore' }],
      automerge: { block: "paragraph" },
    },

    form: {
      /*`
      distribution_code?
      calendar?
      congress
      session
      associated_doc
      current_chamber
      action*
      legis_type
      official_title
      `,*/
      content: `legis_num`,
      toDOM: () => (['div', { class: 'form' }, 0]),
      parseDOM: [ { tag: 'div', class: 'form' }, ],
      automerge: { block: "paragraph" },
    },

    legis_num: {
      content: '',
      toDOM: () => (['h1', { class: 'legis-num' }, 0]),
      parseDOM: [ { tag: 'h1', class: 'legis-num' } ],
      automerge: { block: "paragraph" },
    },

    legis_body: {
      content: 'section*',
      toDOM: () => (['div', { class: 'legis-body' }, 0]),
      parseDOM: [ { tag: 'div', class: 'legis-body' } ],
      automerge: { block: "paragraph" },
    },

    endorsement: {
      content: 'action_date action_desc',
      toDOM: () => ['div', { class: 'endorsement' } ],
      parseDOM: [{ tag: 'div', class: 'endorsement' }],
      automerge: { block: "paragraph" },
    },

    section: {
      content: 'enum header text_model',
      toDOM: () => (['section', 0]),
      parseDOM: [ { tag: 'section' } ],
      automerge: { block: "paragraph" },
    },
    enum: {
      inline: true,
      content: 'text*',
      toDOM: () => ['span', { class: 'enum' }, 0],
      parseDOM: [{ tag: 'span', class: 'enum' }],
      automerge: { block: "paragraph" },
    },
    header: {
      inline: true,
      content: 'text*',
      toDOM: () => ['span', { class: 'header' }, 0],
      parseDOM: [{ tag: 'span', class: 'header' }],
      automerge: { block: "paragraph" },
    },

    action_date: {
      content: 'text*',
      toDOM: () => (['div', { class: 'action-date' }, 0]),
      parseDOM: [ { tag: 'div', class: 'action-date' } ],
      automerge: { block: "paragraph" },
    },
    action_desc: {
      content: 'text*',
      toDOM: () => (['div', { class: 'action-desc' }, 0]),
      parseDOM: [ { tag: 'div', class: 'action-desc' } ],
      automerge: { block: "paragraph" },
    },

    quote: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'quote' }, 0]),
      parseDOM: [ { tag: 'span', class: 'quote' } ],
      automerge: { block: "paragraph" },
    },
    subsection: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'subsection' }, 0]),
      parseDOM: [ { tag: 'span', class: 'subsection' } ],
      automerge: { block: "paragraph" },
    },

    short_title: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'short-title' }, 0]),
      parseDOM: [ { tag: 'span', class: 'short-title' } ],
      automerge: { block: "paragraph" },
    },

    italic: {
      content: 'text*',
      toDOM() { return ["i", 0] },
      parseDOM: [{tag: "i"}],
      automerge: { block: "paragraph" },
    },

    paragraph: {
      content: '(text_model | subparagraph)*',
      toDOM() { return ["p", 0] },
      parseDOM: [{tag: "p"}],
      automerge: { block: "paragraph" },
    },
    subparagraph: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'subparagraph' }, 0]),
      parseDOM: [ { tag: 'span', class: 'subparagraph' } ],
      automerge: { block: "paragraph" },
    },

    quoted_block: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'quoted-block' }, 0]),
      parseDOM: [ { tag: 'span', class: 'quoted-block' } ],
      automerge: { block: "paragraph" },
    },

    after_quoted_block: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'after-quoted-block' }, 0]),
      parseDOM: [ { tag: 'span', class: 'after-quoted-block' } ],
      automerge: { block: "paragraph" },
    },

    external_xref: {
      inline: true,
      content: 'text*',
      toDOM: () => (['span', { class: 'external-xref' }, 0]),
      parseDOM: [ { tag: 'span', class: 'external-xref' } ],
      automerge: { block: "paragraph" },
    },

    text_model: {
      inline: true,
      content: '(text | quote | subsection | external_xref)*',
      toDOM: () => ['span', { class: 'text_model' }, 0],
      parseDOM: [{ tag: 'span', class: 'text_model' }],
      automerge: { block: "paragraph" },
    },

    text: { automerge: { block: "span" } },

    ambiguous: {
      automerge: { unknownBlock: true },
      group: "text",
      content: "text+",
      parseDOM: [{ tag: "div", attrs: { "data-unknown-block": "true" } }],
      toDOM() {
        return ["div", { "data-unknown-block": "true" }, 0]
      },
    },
  },
})

export { bill_dtd }