09-21-2019, 07:10 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Sep 2019
Device: iPad
|
Sigil removes required HTML Table code
I'm more than happy to report this as an issue on Sigil's GitHub page, but this forum may be able to help with this issue.
Versions tested: Sigil 0.9.18 and Sigil-0.9.17 Issue: When saving an ePub, Sigil strips off the HTML Table code and only leaves the 'cell' content. Research done: Thread from 2013 shows that this was something that Sigil is capable of doing: https://www.mobileread.com/forums/sh...67&postcount=5 Tests done (work around): I've opened the same ePub in Calibre and added the identical HTML table code and saved the file with no complaints. I tested the ePub made by Calibre in several eBook readers and it looks fine. To assist anyone looking to test this, you can go to this site https://divtable.com/table-styler/ and generate a table and style code and see for yourself. If you choose the "no style" and un-tick the header and footer choices from this site, than all you need is the plain HTML code and don't need to add the CSS code to the ePub style page. Example: Table Code (four columns of third row for example): Code:
<tr> <td>cell1_3</td> <td>cell2_3</td> <td>cell3_3</td> <td>cell4_3</td> </tr> Save it in Sigil. A pop-up flashes for a second saying something about "cleaning up code" What is left is only the words cell1_3 cell2_3 cell3_3 cell4_3 |
09-21-2019, 07:31 AM | #2 |
A Hairy Wizard
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I agree with this report....but it ONLY happens if you do not include the <table> tags around the <tr>/<td> tags. The "mend" function doesn't know it's supposed to be a table without the <table> tags...and removes the <tr>/<td> tags.
I recommend you use the following code: Code:
<table> <tr> <td>cell1_3</td> <td>cell2_3</td> <td>cell3_3</td> <td>cell4_3</td> </tr> </table> |
09-21-2019, 08:03 AM | #3 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
Yes, the table tag is required in xhtml.
|
09-21-2019, 08:10 AM | #4 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Why would anyone try to create a table without the table tags?
That's an example of the Sigil/Gumbo guarantee that no content will be lost when trying to guess how to fix invalid xhtml. Last edited by DiapDealer; 09-21-2019 at 08:15 AM. |
09-21-2019, 08:23 AM | #5 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
I think that website allows you to turn off generation of the table tag in case you are building up a larger table row by row.
That said, it is not even valid html to use tr without at least an opening table tag. |
09-21-2019, 09:02 AM | #6 | |||
Junior Member
Posts: 3
Karma: 10
Join Date: Sep 2019
Device: iPad
|
Quote:
Quote:
Quote:
I had originally made an overly fussy table using the site I posted and in the process of manually removing the code I didn't want, I hacked off the table tags. I guess what blinded me to this mistake was that both Sigil and Calibre display the table in the preview window without showing any errors and Calibre successfully saves the ePub even with my badly written HTML code. Plus all the readers I tried, show the page with the flawed table code just fine. It goes to show flexible eBook readers are with badly written code! |
|||
09-21-2019, 09:15 AM | #7 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
If you're new to html, make sure to install the EpubCheck plugin. If you get in the habit of using it before saving an epub, it will point out problem areas like this one and give you an opportunity to address them first.
|
09-21-2019, 01:35 PM | #8 |
Guru
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
|
When the table tags are present, Sigil even adds 'tbody' tags when saving. In case we want some 'thead' content I suppose.
Code:
<table> <tbody><tr> <td>cell1_3</td> <td>cell2_3</td> <td>cell3_3</td> <td>cell4_3</td> </tr> </tbody> </table> Last edited by exaltedwombat; 09-21-2019 at 01:37 PM. |
09-22-2019, 07:38 AM | #9 | |
A Hairy Wizard
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Quote:
I would also recommend (works for me anyway) disabling "mend on save". You can always right click in a given html file and select "mend" manually. This allows you to save in the middle of your workflow (if you need to take a quick break or something) without having the mend function potentially change your code. Manually mending (either page-by-page or all of them at once) means you can check it first. Step 1 - save Step 2 - hit F7 for a Well-Formed-Check Step 3 - Use the ePubCheck Plugin Step 4 - Right Click and select "Reformat HTML" then "Mend and Prettify Code" (all or singly) Step 5 - Check your book Step 6 - Save Step 7 - Save again, just to be sure |
|
09-22-2019, 10:16 AM | #10 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I can't, in good conscience, recommend neophytes disabling Mend on Open/Save. It's one thing for those who know exactly what they're doing, but bad things can happen to those who don't know all the ramifications of trying to save/open invalid xhtml.
Heck, I know exactly what I'm doing, and the only time I disable either one of them is when I'm testing what might go wrong for those who do. |
09-23-2019, 09:25 AM | #11 | ||
Junior Member
Posts: 3
Karma: 10
Join Date: Sep 2019
Device: iPad
|
Quote:
Quote:
I'll only run some tests. I'll likily leave "Mend" as designed for the most part! |
||
09-23-2019, 10:27 AM | #12 |
Well trained by Cats
Posts: 29,801
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
There are all sorts of issues with allowing (disabling mend) broken/malformed code. You might forget that it was done. The editor may not be able to resume the edit with that code (fails to load book).
BUT It may be necessary due to conditions (Laptop battery running flat, employment) where you must shut down NOW, rather than find and fix the error that is blocking the save without auto-mend (whose mend may really be UNDESIRED, like what happened here.) Last edited by theducks; 09-23-2019 at 10:29 AM. |
09-24-2019, 04:35 AM | #13 | |
Guru
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
|
Quote:
Remember to check for stylesheet conformance too. Some readers just shut off after a stylesheet error, all following code is ignored. This may not show up directly in Sigil. The easiest way to do this is online, via the Validate with W3C function, available by R-clicking on a CSS file in the filelist. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can´t create an html table of contents on Sigil | Danila | Sigil | 2 | 02-16-2017 03:29 PM |
Sigil Error = missing required attribute content | ScottSowers | Sigil | 22 | 01-27-2015 02:24 PM |
Converting Epub to HTML from CLI removes formatting | drjonez | Conversion | 2 | 01-20-2012 12:07 PM |
table of contents code for converted oreilly chm | luckycharms | Conversion | 4 | 08-05-2011 09:31 AM |
Anyone know how to convert a pdf table into a table in Word or HTML? | BasilC | Workshop | 7 | 06-25-2010 01:02 AM |