substance / texture

A visual editor for research.
MIT License
1k stars 83 forks source link

Tables #1322

Open fred-atherden opened 5 years ago

fred-atherden commented 5 years ago

Tables within an article.

User Stories

Author

  1. A an author, I want to be able to see the title and legend for a table so that I can check the content is correct.
  2. As an author, I want to be able to edit the title and legend for a table so that I can correct any errors.
  3. As an author, I want to be able to add a reference or asset citation to a table title or legend so that I can cite other articles or items in this context.
  4. As an author, I want to be able to add, edit or remove equations in a table title or legend so that I can include mathematical content.
  5. As an author, I want to be able to add new rows and columns to a table so that I can add new content.
  6. As an author, I want to be able to remove rows and columns from a table so that I can remove content.
  7. As an author I want to be able to add text to new cells so that I can add new content.
  8. As an author, I want to be able to edit or remove the existing content in a cell so that I can correct any errors.
  9. As an author, I want to be able to paste multiple cells copied from a spreadsheet into a table so that I can add new content in bulk.
  10. As an author, I want to be able to add, edit or delete a reference or asset citation in the content of a cell so that I can cite other articles or items in this context.
  11. As an author, I want to be able to add, edit or delete an equation in the content of a cell so that I can include mathematical content in a table.
  12. As an author, I want to be able to apply style formatting (bold, italic etc) to the content in a cell so that I can add emphasis.
  13. As an author, I want to be able to remove style formatting from the content in a cell so that I can remove emphasis.
  14. As an author, I want to be able to add and remove style formatting across multiple cells at once so that I can make mass formatting changes in a table.
  15. As an author, I want to be able to set the vertical and horizontal alignment of content in one or more cells so that I can improve the readability of the table.
  16. As an author, I want to be able to designate one or more rows as header rows so that I can indicate the headings for my table.
  17. As an author, I want to be able to remove header row status from one or more rows so that I can correct errors.
  18. As an author, I want to be able to merge two or more cells into cells that cross rows and/or columns so that I can improve the readability of the table.
  19. As an author, I want to be able to unmerge cells that cross rows and/or columns so that I can improve the readability of the table.

Production staff

  1. As production staff, I want to be able to add a new table so that I can capture missing content.
  2. As production staff, I want to be able to chose whether a new table should be a main table (label, title and legend) or an inline table (just the cells and footnotes) so that I can pick the most appropriate option for the content.
  3. As production staff, I want to be able to add a title to a new table so that I can describe the content.
  4. As production staff, I want to be able to add a legend to a new table so that I can describe the content.
  5. As production staff, I want to be able to remove a table so that I can correct errors.

Érudit

  1. As production staff, I want to be able to add an image to represent a table so that I can capture table content supplied in this manner.
  2. As production staff, I want to be able to repalce the image representing a table so that I can correct any errors.
  3. As production staff, I want to be able to add an attribution to a table so that I can acknowledge the source of the content.
  4. As production staff, I want to be able to edit the attribution for a table so that I can correct any errors.
  5. As production staff, I want to be able to remove the attribution for a table so that I can correct any errors.

But what if . . . ?

Considerations

XML requirements

Tables are captured using table-wrap. table-wrap may or may not have a child label element. Similarly they may or may not have a caption or title.

A table-wrap may have the attributes @position and @orientation, which are generally used for the purposes of PDF generation. Typical values are position="float", position="anchor", orientation="portrait", orientation="landscape".

Every table-wrap should contain one and only one table element. This table element may have a thead or a tfoot, and must have a tbody. Rows are determined by the element tr which can contain th and td elements. th must be allowed as a descendant of both thead and tbody, whereas td should be allowed as a descendant of tbody and tfoot.

The @colspan attribute can be used in order to specify if a th/td spans more than one column. The @rowspan attribute can be used in order to specify if a th/td spans more than one row. The @align attribute can be used in order to specify th/td data horizontal alignment. The @valign attribute can be used in order to specify th/td data vertical alignment.

The break element should be used in order to add line breaks within th/td elements.

<table-wrap id="table1" position="float" orientation="portrait">
    <label>Table 1.</label>
    <caption>
        <title>Data collection and refinement statistics</title>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus consequat justo lacinia tortor placerat pretium. ...</p>
    </caption>
    <table frame="hsides" rules="groups">
        <thead>
            <tr>
                <th colspan="2" valign="top">Protein:RNA</th>
                <th valign="top">PUF-8: <break/>PBE</th>
                <th valign="top">FBF-2 SS/Y: <break/>PBE</th>
                <th valign="top">FBF-2 AS/Y: <break/>PBE</th>
                <th valign="top">FBF-2 AQ/Y: PBE</th>
            </tr>
            <tr>
                <th colspan="2" valign="top">Data collection</th>
                <th valign="top"/>
                <th valign="top"/>
                <th valign="top"/>
                <th valign="top"/>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td colspan="2" valign="top"> Space group</td>
                <td valign="top">C2</td>
                <td valign="top">P61</td>
                <td valign="top">P61</td>
                <td valign="top">P61</td>
            </tr>
            <tr>
                <td rowspan="2" valign="top"> Unit Cell</td>
                <td valign="top"><italic>a</italic>, <break/><italic>b</italic>,
                        <break/><italic>c</italic> (Å)</td>
                <td valign="top">109.2, <break/>189.0, <break/>63.2</td>
                <td valign="top">96.4, <break/>96.4, <break/>99.9</td>
                <td valign="top">96.5, <break/>96.5, <break/>101.1</td>
                <td valign="top">95.9, <break/>95.9, <break/>100.4</td>
            </tr>
            <tr>
                <td valign="top">α, <break/><italic>β,</italic>
                    <break/><italic>γ</italic> (°)</td>
                <td valign="top">90, <break/>103.6, <break/>90</td>
                <td valign="top">90, <break/>90, <break/>120</td>
                <td valign="top">90, <break/>90, <break/>120</td>
                <td valign="top">90, <break/>90, <break/>120</td>
            </tr>
            <tr>
                <td colspan="2" valign="top">Resolution (Å)</td>
                <td valign="top">50–2.55 <break/>(2.59–2.55)<sup>*</sup></td>
                <td valign="top">50–2.25 <break/>(2.29–2.25)<sup>*</sup></td>
                <td valign="top">50–2.25 <break/>(2.33–2.25)<sup>*</sup></td>
                <td valign="top">50–2.85 <break/>(2.9–2.85)<sup>*</sup></td>
            </tr>
            <tr>
                <td colspan="2" valign="top"><italic>R</italic><sub>sym</sub> or
                        <italic>R</italic><sub>merge</sub></td>
                <td valign="top">0.191 (0.692)</td>
                <td valign="top">0.101 (0.704)</td>
                <td valign="top">0.104 (0.772)</td>
                <td valign="top">0.191 (0.957)</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"><italic>I</italic> /σ<italic>I</italic></td>
                <td valign="top">9.4 (1.9)</td>
                <td valign="top">19.2 (3.42)</td>
                <td valign="top">17.1 (2.98)</td>
                <td valign="top">12.8 (2.34)</td>
            </tr>
            <tr>
                <td colspan="2" valign="top">Completeness (%)</td>
                <td valign="top">98.9 (98.0)</td>
                <td valign="top">99.9 (100)</td>
                <td valign="top">99.9 (100)</td>
                <td valign="top">99.6 (99.2)</td>
            </tr>
            <tr>
                <td colspan="2" valign="top">Redundancy</td>
                <td valign="top">6.9 (3.6)</td>
                <td valign="top">5.7 (5.7)</td>
                <td valign="top">5.7 (5.7)</td>
                <td valign="top">10.7 (8.8)</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
            </tr>
            <tr>
                <th colspan="2" valign="top">Refinement</th>
                <th valign="top"/>
                <th valign="top"/>
                <th valign="top"/>
                <th valign="top"/>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Resolution (Å)</td>
                <td valign="top">33.8–2.6</td>
                <td valign="top">32.0–2.3</td>
                <td valign="top">31.6–2.3</td>
                <td valign="top">27.5–2.9</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> No. reflections</td>
                <td valign="top">37,625</td>
                <td valign="top">25,089</td>
                <td valign="top">25,386</td>
                <td valign="top">12,185</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> <italic>R</italic><sub>work</sub>/<italic>R</italic><sub>free</sub></td>
                <td valign="top">0.229/ <break/>0.285</td>
                <td valign="top">0.158/ <break/>0.204</td>
                <td valign="top">0.167/ <break/>0.223</td>
                <td valign="top">0.219/ <break/>0.272</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> No. atoms</td>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Protein</td>
                <td valign="top">8415</td>
                <td valign="top">3197</td>
                <td valign="top">3194</td>
                <td valign="top">3189</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> RNA</td>
                <td valign="top">507</td>
                <td valign="top">150</td>
                <td valign="top">168</td>
                <td valign="top">168</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Solvent</td>
                <td valign="top">229</td>
                <td valign="top">169</td>
                <td valign="top">109</td>
                <td valign="top">21</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> <italic>B</italic>-factors (Å<sup>2</sup>)</td>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Wilson B</td>
                <td valign="top">29.7</td>
                <td valign="top">36.6</td>
                <td valign="top">35.5</td>
                <td valign="top">48.4</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Protein</td>
                <td valign="top">32.8</td>
                <td valign="top">45.3</td>
                <td valign="top">45.1</td>
                <td valign="top">50.2</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> RNA</td>
                <td valign="top">43.6</td>
                <td valign="top">51.4</td>
                <td valign="top">58.8</td>
                <td valign="top">64.8</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Solvent</td>
                <td valign="top">32.7</td>
                <td valign="top">49.6</td>
                <td valign="top">44.3</td>
                <td valign="top">23.1</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> R.m.s deviations</td>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
                <td valign="top"/>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Bond lengths (Å)</td>
                <td valign="top">0.002</td>
                <td valign="top">0.007</td>
                <td valign="top">0.007</td>
                <td valign="top">0.002</td>
            </tr>
            <tr>
                <td colspan="2" valign="top"> Bond angles (°)</td>
                <td valign="top">0.45</td>
                <td valign="top">0.77</td>
                <td valign="top">0.78</td>
                <td>
                    <p>bar charts</p>
                    <p>flow charts</p>
                </td>
            </tr>
        </tbody>
    </table>
    <table-wrap-foot>
        <fn>
            <p><sup>*</sup>Values in parentheses are for the highest-resolution shell.</p>
        </fn>
    </table-wrap-foot>
</table-wrap>

Example of PKP content:

    <table-wrap specific-use="rules" id="IDb259e5ef-e160-4d78-9588-cc16787d10bb"
                        position="float" orientation="portrait">
                        <table>
                            <tr>
                                <td colspan="3"><p content-type="centered"/></td>
                            </tr>
                            <tr>
                                <td><p><bold>Complexity type</bold></p></td>
                                <td style="vertical-align:top;"><p><bold>Natural Language Processing
                                            methods used</bold></p></td>
                                <td><p><bold>Visualization methods used</bold></p></td>
                            </tr>
                            <tr>
                                <td><p>Language complexity</p></td>
                                <td><p>Readability measures, proportion of rare words, proportion of
                                        foreign words, density of entities, &#160;proportion of part
                                        of speech types, occurrence of topics discussed (topic
                                        lists, LIWC lexicon), emotions (NRC Emotion Lexicon),
                                        sentiment (Stanford Sentiment Analyzer), high-level verb and
                                        noun types (WordNet lexicographer files)</p></td>
                                <td>
                                    <p>paragraph squares</p>
                                    <p>bar charts</p>
                                    <p>aligned bar charts</p>
                                    <p>flow charts</p></td>
                            </tr>
                            <tr>
                                <td><p>Interaction complexity</p></td>
                                <td><p>Named entity recognition and classification (person,
                                        location, organization), entity graph (strength of
                                        relationship metrics)</p></td>
                                <td><p>co-occurrence matrices</p></td>
                            </tr>
                            <tr>
                                <td><p>Character complexity</p></td>
                                <td><p>Speaker identification, emotion development analysis,
                                        sentiment development analysis, WordNet lexicographer files
                                        for individual character&#8217;s activities</p></td>
                                <td><p>bar charts</p>
                                    <p>flow charts</p></td>
                            </tr>
                        </table>
                    </table-wrap>

The following elements should be allowed as children of th/td:

Érudit example

Érudit capture tables as images:

<table-wrap id="ta2" position="float">
    <label>TABLEAU 2</label>
    <caption>
        <title>Résultats des régressions Tobit</title>
    </caption>
    <graphic xlink:href="table2_figure_1.png">...</graphic>
    <table-wrap-foot>
        <fn-group>
            <fn>
               <label><sup>a</sup></label>
               <p>Pharmacie, CLSC et organismes communautaires collectant les seringues à moins de 100 mètres (variable muette).</p>
            </fn>
            <fn>
               <label><sup>b</sup></label>
               <p>Poste de quartier à moins de 100 mètres (variable muette).</p>
            </fn>
            <fn>
               <label><sup>c</sup></label>
               <p>Autoroute, nationale, collectrice ou artère.</p>
            </fn>
        </fn-group>
    </table-wrap-foot>
</table-wrap>

Published HTML

Mock ups

This is not required, but if you have mock ups of what you would like to see please provide them here.

Proposal

This will be added by the Texture team after the feature request is discussed and agreed.