Kirby-spreadsheet plugin with greater and less than symbols

It seems, when using the kirby-spreadsheet plugin (v 1.1.0, kirby 3.3.2) to display a csv file containing greater and less than symbols, doesn’t render the table properly. Can you reproduce this?

csv:

Color,nm,THz,μm−1,eV,kJ mol−1
Infrared,> 1000,< 300,< 1.00,< 1.24,< 120
Red,700,428,1.43,1.77,171
Orange,620,484,1.61,2.00,193
Yellow,580,517,1.72,2.14,206
Green,530,566,1.89,2.34,226
Cyan,500,600,,,
Blue,470,638,2.13,2.64,254
Violet (visible),420,714,2.38,2.95,285
Near ultraviolet,300,1000,3.33,4.15,400
Far ultraviolet,< 200,> 1500,> 5.00,> 6.20,> 598

Result (no content in first row, 3-6 td and last row, first td):


Replaced with html entities:

(btw: I’ve added attr => title for the table caption, but also tested this without the adjustment.)

In addition: was just trying to use an excel file from here Sample xlsx 5 kb, 10 rows throws an error: Call to a member function read() on boolean

I copy/pasted your csv data into a file and can’t reproduce the issue. All columns come out ok. So I wonder how to reproduce the issue.

So you must have 'markdown' => ['extra' => false ]?
Because that solved it for me.

The other sample xlsx file that caused Call to a member function read(), did you check that one?

Ah, ok, if I enable Markdown extra, I get the same issue.

Looks like you can fix it by providing a custom snippet with the following markup

<table class="<?php echo $class ?>">
    <?php if ($tableHead): ?>
        <thead>
        <?php  foreach ($tableHead as $headCell): ?>
              <th><?php echo $headCell ?></th>
        <?php endforeach ?>
        </thead>
    <?php endif ?>
    <tbody>
      <?php while ($row = $reader->next()): ?>
      <tr>
          <?php foreach ($row as $cell): ?>
              <td><?php echo html($cell) ?></td>
          <?php endforeach ?>
      </tr>
      <?php endwhile ?>
    </tbody>
</table>

i.e. the $cell output in the html() helper.

No, haven’t had the time to check that yet.

I tried $cell->html() before and didn’t solve it, I’ll try again.

Nope; doesn’t work with md-extra enabled.

$cell->html() cannot work, we are dealing with a string here, please use the code I suggested above.

Yes, I did and understand but html($cell) doesn’t work for me.

Have you cleared the plugin cache before trying that?

After clearing the plugin cache that’s working now, with markdown extra, thanks.

I hope you will find a mo to test that excel demo file, would be grand.

I got a memory issue with that file. It works perfectly once converted to xlsx format, instead of old outdated xls.

I was pointing to a xlsx file which was causing the error.

Ok, getting the same issue with that file, I think the problem is the header with the zero as column name

We gotta be prepared for all sorts of abnormalities …

The error is thrown in the library I use for the plugin. I guess I have to check what the read function returns and then just return nothing or an error message for an invalid file.

Your guess is better than mine, I’m sure :wink: