tomduck / pandoc-tablenos

A pandoc filter for numbering tables and table references.
GNU General Public License v3.0
108 stars 8 forks source link

missing table identifiers in epub output #13

Closed roseman closed 5 years ago

roseman commented 5 years ago

Hi Tom, I'm using pandoc-tablenos for a book. The TeX/PDF output works perfectly, but when I generate an epub, the generated links to the table are broken.

This can be verified by running e.g. demo3.epub through an epub validator (e.g. validator.idpf.org), which will generate error messages reading "Fragment identifier is not defined."

The issue is that the tables have no id's assigned to them. I added before the tables in the output, which addressed the problem (so same workaround as for html, except that it needs the attribute "id" instead of "name").

tomduck commented 5 years ago

Hi, Mark.

Thanks for your feedback, which I appreciate.

As luck would have it, I discovered this problem an hour or so ago and fixed it. I have a few other minor issues to clean up, and then will put out a new release (within an hour, I expect). Stay tuned...

Cheers, Tom

tomduck commented 5 years ago

I just posted a new version which fixes the problem. If you have any difficulty with it, please go ahead and re-open this issue. Thanks again for your feedback, which is much appreciated. --Tom

roseman commented 5 years ago

Gotta love impeccable timing! Thanks! Two small tweaks I'd suggest for the solution...

  1. I needed to add 'epub3' to the 'fmt in (...)'. I was a bit confused at first but then noticed the wrapper script I'm using to run pandoc explicitly specified "-t epub3". Even though internally 'epub' and 'epub3' now amount to the same thing, apparently either format value can show up. I'd suggest adding 'epub2' to that list as well. However...

  2. I verified that the links to the tables (using <a name=...>) now worked correctly, at least in Calibre and I'd suspect everywhere else. This is getting picky, but for the epub formats you should technically be outputting <a id=...> instead. This is because epub files are XHTML and not straight HTML, and apparently 'name' is not a valid attribute for <a> tags (see details here). The practical consequences of this is that epub validators, which use XHTML parsers, will complain if you use 'name' rather than 'id'.

The upshot of all this is you should probably add a separate elif branch for epub, epub2, and epub3 that looks like the html, html5 branch but changes name to id.

tomduck commented 5 years ago

This is really helpful feedback. Thanks.

I have posted a new version with the corrections you suggested. Please let me know if you have any further difficulties with it.

I would be grateful to hear any other suggestions you have for improving epub output.

Cheers, Tom

tomduck commented 5 years ago

I assume that this is no longer an issue. Please re-open if I am mistaken.

Note that there is a new beta release in the 2.0 branch that fixes a variety of related epub issues.

Thanks again for your feedback.

Cheers, Tom