mbakeranalecta / sam

Semantic Authoring Markdown
Other
79 stars 8 forks source link

A thought about how we could do spanning cells in grids #128

Closed mbakeranalecta closed 6 years ago

mbakeranalecta commented 7 years ago
 +++
     Paper Title | Performance Measure                                    ||| Image Type
          _      | Evaluation Metric | Proposed Method | traditional method |      _
                 | DC                | 0.0019          | 0.0021             | 
                 | JS                | 0.9975          | 0.9916             | 
                 | DSC               | 0.9987          | 0.9958             | 
mbakeranalecta commented 7 years ago

Rules here are, horizontal spanning is indicated by bunching the pipe characters together with no space between them . Vertical spanning is indicated by placing one underscore in the cell. The alignment of the pipes is not significant.

mbakeranalecta commented 7 years ago

For reference, here is a fully explicit way of handing the same thing. Note that in this case the application layer has to interpret the #vsapn and #hspan. #empty is really just semantic sugar.

table:
    header:
        row:
            cell: Paper Title
            cell: Performance Measure
            cell: #hspan
            cell: #hspan
            cell: Image Type
        row: 
            cell: #vspan
            cell: Evaluation Metric
            cell: Proposed Method
            cell: traditional method
            cell: #vspan
    body:
        row:
            cell: #empty
            cell: DC
            cell: 0.0019
            cell: 0.0021
            cell: #empty

        row:
            cell: #empty
            cell: JS
            cell: 0.9975
            cell: 0.9916
            cell: #empty

        row:
            cell: #empty
            cell: DSC
            cell: 0.9987
            cell: 0.9958
            cell: #empty
mbakeranalecta commented 7 years ago

Alternative that is actually a little more logical, though it would result in a slightly different layout:

table:
    header:
        row:
            cell: Paper Title
            cell: Performance Measure
            cell: Image Type
    body:
        row: 
            cell: 
            cell:
                table:
                    header:
                            cell: Evaluation Metric
                            cell: Proposed Method
                            cell: traditional method
                    body:
                        row:
                            cell: DC
                            cell: 0.0019
                            cell: 0.0021

                        row:
                            cell: JS
                            cell: 0.9975
                            cell: 0.9916

                        row:
                            cell: DSC
                            cell: 0.9987
                            cell: 0.9958
            cell: 
mbakeranalecta commented 7 years ago

Or this:

table:
    header:
        row:
            cell: Paper Title
            cell: Performance Measure
            cell: Image Type
    body:
        row: 
            cell: 
            cell:
                +++
                    Evaluation Metric | Proposed Method | traditional method      
                    DC                | 0.0019          | 0.0021             
                    JS                | 0.9975          | 0.9916              
                    DSC               | 0.9987          | 0.9958              
            cell: 
mbakeranalecta commented 7 years ago

Example comes from https://tex.stackexchange.com/questions/368176/i-badly-need-to-generate-the-following-table which has shots of layout.

mbakeranalecta commented 6 years ago

It is worth noting that this proposal could be implemented in the application layer (which would allow for any other convention you liked to be implemented as well). Quite simply, the application layer could choose to see any cell with an empty string (as opposed to white space) for content is to be treated as an hspan, and any cell with just a single underscore for content is to be treated as a vspan.

This is obviously not as convenient as having a fixed syntax of hspan and vspan but it is much more flexible (not to mention simpler on the parser end). We could even provide a sample XSLT script to process it.

mbakeranalecta commented 6 years ago

The logic here is that the marked cells are dropped and the processing requires a lookahead from each cell to see if later cells are dropped and setting the vapan and hspan counts appropriately. Not really that difficult.

mbakeranalecta commented 6 years ago

It seems to me a good principle that we should only add to the language syntax that cannot reasonably be implemented at the application layer. Clearly this functionality can be added at the application layer, so I am changing this to a docs issue.

mbakeranalecta commented 6 years ago

Documented in 3d935b11e82f9980e6bed445f28e80acb3543b56