openlibhums / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
172 stars 65 forks source link

Apply same "table header" style to <th> tags whether they're in <thead> or <tbody> #2874

Closed pgoussy closed 2 years ago

pgoussy commented 2 years ago

Describe the bug Often, a table will include a secondary mid-table header row as a way of sub-dividing the table into multiple sections. We've asked our XML vendor to tag these cells as <th> rather than <td>; however, Janeway is still rendering them as plain text, so there's no functional distinction between these <th> cells and surrounding <td> cells.

Janeway version 1.4.1

To Reproduce Steps to reproduce the behavior:

  1. Go to https://journals.publishing.umich.edu/jmmh/plugins/typesetting/preview_galley/article/135/galley/730/#T2 to navigate directly to Table 2
  2. The row beginning with "PDS negatively worded questions" is tagged in <th>, and we expected it to render the same as the <th> tags within <thead> at the top of the table.

2022-05-13_15-11-34

Expected behavior We would like Janeway to apply the same text style to <th> tags equally, whether they appear in <thead> or <tbody>.

Additional context According to my research, <th> should be taggable within both <thead> and <tbody>, which would allow the tagging that I've requested for articles 234 and 135. The JATS spec definition for <th> provides the following sample tagging, which indicates that it should be possible to use <th> at multiple locations in a single table:

Table headers at two levels Headers for the entire table (inside ) and a table segment (inside ) ...

<table-wrap id="TN0.170">
 <caption>
  <title>Patient Care at End of Follow Up</title>
  <p>Numbers of patients receiving institutional care at
   the end of scheduled follow up and use of hospital beds
   among those allocated to day hospital or alternative
   services</p>
 </caption>
 <table frame="box" rules="all" cellpadding="5">

  <thead>
   <tr>
    <th colspan="3" align="center" rowspan="1">Institutional care</th>
    <th></th>
    <th colspan="2" align="center" rowspan="1">&#x2003;Bed use (days)</th>
   </tr>
  </thead>

  <tfoot>
   <tr>
    <td align="center">Patients</td>
    <td align="center">Patients</td>
    <td align="center">Odds ratio</td>
    <td></td>
    <td align="center">Patients</td>
    <td align="center">Patients</td>
   </tr>
  </tfoot>

  <tbody>
   <tr>
    <td colspan="3"><hr/></td>
    <td colspan="2"><hr/></td>
   </tr>
   <tr>
    <th>Control group</th>
    <th align="center">Day hospital</th>
    <th align="center">Control</th>
    <th align="center">Odds ratio (95&#x0025; CI)</th>
    <th></th>
    <th align="center">Day hospital</th>
    <th align="center">Control</th>
   </tr>
   <tr>
    <td colspan="7"><hr/></td>
   </tr>
   <tr>
    <td>Comprehensive care (5 trials)</td>
    <td align="center">151/597<xref ref-type="table-fn"
      rid="TF1-150"></xref></td>
    <td align="center">159/584</td>
    <td align="center">0.91 (0.70 to 1.19)</td>
    <td></td>
    <td align="center">20.5</td>
    <td align="center">21.4</td>
   </tr>
   <tr>
    <td>Domiciliary care (4 trials)</td>
    <td align="center">20/216</td>
    <td align="center">&#x2002;19/227</td>
    <td align="center">1.61 (0.30 to 8.55)</td>
    <td></td>
    <td align="center">&#x2002;7.7</td>
    <td align="center">11.1</td>
   </tr>
   <tr>
    <td>No comprehensive care (3 trials)</td>
    <td align="center">37/411</td>
    <td align="center">&#x2002;66/403</td>
    <td align="center">0.50<xref ref-type="table-fn"
      rid="TF1-151"></xref> (0.26 to 0.96)</td>
    <td></td>
    <td align="center">11.2</td>
    <td align="center">11.7</td>
   </tr>
   <tr>
    <td>Total</td>
    <td align="center">208/1224</td>
    <td align="center">244/1214</td>
    <td align="center">0.77 (0.52 to 1.13)</td>
    <td></td>
    <td align="center">15.0</td>
    <td align="center">16.4</td>
   </tr>
  </tbody>
 </table>
 <table-wrap-foot>
  <fn id="TF1-150"><p>Data not available for 1 trial.</p></fn>
  <fn id="TF1-151"><p>P&#x003C;0.05 (random effects model).</p></fn>
 </table-wrap-foot>
</table-wrap>
pgoussy commented 2 years ago

I just realized that the lack of bold was because the mid-table <th> also included <bold> tags in the XML, which was negating the bold text that Janeway was trying to apply to the <th> text.

So...maybe this request is moot?

ajrbyers commented 2 years ago

<bold> inside <th> should still return strong styling imo.

ajrbyers commented 2 years ago

As @pgoussy points out the original premise of this issue is okay, but tagging https://github.com/BirkbeckCTP/janeway/issues/2862 as the issue is reported there.