finanalyst / grav-plugin-datatables

Grav plugin shortcode to add in DataTables Jquery
MIT License
8 stars 2 forks source link

Plugin does not work at all #6

Open FravBox opened 9 months ago

FravBox commented 9 months ago

I'm using Grav 1.7.38 and installed this plugin for the first time, on a mostly empty and new Grav install. I installed the plugin through the Grav Admin interface and made sure it is enabled.

[datatables]
| editor | title | 
---- |
editorname | video title + link here 
editorname | video title + link here 
editorname | video title + link here 
editorname | video title + link here
editorname | video title + link here 
[/datatables]

results in: image

I then thought it might have a dependency that wasn't listed, so installed the Shortcodes Core plugin.
That helped, because the shortcode makes it an html table, but then the html is not actually rendered:

image

Please advise? I'd really like to use this plugin.

finanalyst commented 9 months ago

@FravBox a) I haven't used Grav for nearly 3 years, as I have been focussed on other things. b) The README file (of this repo) lists ShortCodes and Problems as dependencies. c) Have you tried the example given in the README to see whether it worked as expected?

Looking at your test table, I think the MarkDown is incorrect. The data lines are not started & ended with a | and the separator between the table header and data only has one cell, viz ----|, but I think it should be |---|---|

Hope this helps.

FravBox commented 9 months ago

a.) Yeah, but the only other plugin that does this (tablesorter) is even older and publicly archived.😅 (and also doesn't appear to work) b.) I somehow missed that, but Error and Problems appear to already be installed, so that is covered. c.) It shouldn't matter, but correcting it did not change the outcome.

Using this from the readme:

[datatables paging=false ordering=false info=false]
|Field 1|Field2|
|---|---|
|Data|1234|
[/datatables]

Still results in html in plain text image

If you don't want to support the plugin I understand. But since the repo wasn't archived like the other one, I figured I'd give it a shot anyway.

reisir commented 9 months ago

I've identified the issue, in DataTablesShortcode.php, twig->processTemplate() returns sanitized HTML, eg. <table> is turned into &lt;table&gt;.

Grav docs are undecipherable to me so I can't tell if there's an option you can give processTemplate() to make it return raw HTML, in twig itself you can do |raw but that doesn't really help here