mbakeranalecta / sam

Semantic Authoring Markdown
Other
79 stars 8 forks source link

Simplify record syntax? #59

Closed mbakeranalecta closed 8 years ago

mbakeranalecta commented 8 years ago

Do we really need the two layer structure for things like this:

        history:
            revision:: date, author, comment, status
                2014-06-23, mbaker, New\, Topic, In progress
        index:
            entry:: type, term
                feature, fragment
                feature, fragments

In other words, do we need to say that the entries of a history are revisions or that those of an index are entries?

Seem like the following would be clearer to read:

        history:: date, author, comment, status
                2014-06-23, mbaker, New\, Topic, In progress
        index:: type, term
                feature, fragment
                feature, fragments

In XML, this would still need a name for the row, but why not "entry" each time?

 <history>
    <entry>
       <date>2014-06-23</date>
       <author>mbaker</author>
       <comment>New, Topic</comment>
       <status>In progress</status>
    </entry>
 </history>
 <index>
    <entry>
       <type>feature</type>
       <term>fragment</term>
    </entry>
    <entry>
       <type>feature</type>
       <term>fragments</term>
    </entry>
 </index>

You can still use context to rename "entry" to "revision" down the road if you want to.

This would change the use of records as a table shortcut:

        table:(*my-table ?foobat #zombie) An important table
            row:: cell, cell, cell
                foo, bar, baz
                a, b, c
                hi, lo, med

But this could be replaced with:

        table:(*my-table ?foobat #zombie) An important table
            body:: cell, cell, cell
                foo, bar, baz
                a, b, c
                hi, lo, med

This would then produce:

<table id="my-table" conditions="foobat" name="zombie">
    <title>An important table</title>
    <body>
        <entry>
            <cell>foo</cell>
            <cell>bar</cell>
            <cell>baz</cell>
        </entry>
        <entry>
            <cell>a</cell>
            <cell>b</cell>
            <cell>c</cell>
        </entry>
        <entry>
            <cell>hi</cell>
            <cell>lo</cell>
            <cell>med</cell>
        </entry>
    <body>
</table>

Or we just call the default entry element "row" rather than "entry", which seems perfectly semantically acceptable. The we would get:

<table id="my-table" conditions="foobat" name="zombie">
    <title>An important table</title>
    <body>
        <row>
            <cell>foo</cell>
            <cell>bar</cell>
            <cell>baz</cell>
        </row>
        <row>
            <cell>a</cell>
            <cell>b</cell>
            <cell>c</cell>
        </row>
        <row>
            <cell>hi</cell>
            <cell>lo</cell>
            <cell>med</cell>
        </row>
    <body>
</table>

And:

 <history>
    <row>
       <date>2014-06-23</date>
       <author>mbaker</author>
       <comment>New, Topic</comment>
       <status>In progress</status>
    </row>
 </history>
 <index>
    <row>
       <type>feature</type>
       <term>fragment</term>
    </row>
    <row>
       <type>feature</type>
       <term>fragments</term>
    </row>
 </index>
mbakeranalecta commented 8 years ago

There is also an argument for calling the entry/row "record", since this is a record set. Then again, the container is not called "recordset", so maybe it is moot. recordset is a SAM concept that translates into an XML structure: does the term record and recordset need to occur in that structure?

You could create the same structure with blocks, so really, recordset is syntactic sugar rather than a distinct structure.

mbakeranalecta commented 8 years ago

Implemented with row as the record tag.