Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-21-2019, 07:10 AM   #1
lomtickofbooks
Junior Member
lomtickofbooks began at the beginning.
 
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>
Shows as a table in the Sigil's 'preview' pane
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
lomtickofbooks is offline   Reply With Quote
Old 09-21-2019, 07:31 AM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
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>
Turtle91 is offline   Reply With Quote
Old 09-21-2019, 08:03 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
Yes, the table tag is required in xhtml.
KevinH is online now   Reply With Quote
Old 09-21-2019, 08:10 AM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is offline   Reply With Quote
Old 09-21-2019, 08:23 AM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Old 09-21-2019, 09:02 AM   #6
lomtickofbooks
Junior Member
lomtickofbooks began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2019
Device: iPad
Quote:
Originally Posted by Turtle91 View Post
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.
Quote:
Originally Posted by KevinH View Post
Yes, the table tag is required in xhtml.
Quote:
Originally Posted by DiapDealer View Post
Why would anyone try to create a table without the table tags?
I'm just now learning HTML.

Quote:
Originally Posted by KevinH View Post
That said, it is not even valid html to use tr without at least an opening table tag.
Thanks everyone!! Sigil saves the ePub correctly if I add the table tags.
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!
lomtickofbooks is offline   Reply With Quote
Old 09-21-2019, 09:15 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is offline   Reply With Quote
Old 09-21-2019, 01:35 PM   #8
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
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.
exaltedwombat is offline   Reply With Quote
Old 09-22-2019, 07:38 AM   #9
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
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:
Originally Posted by DiapDealer View Post
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.
+1

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
Turtle91 is offline   Reply With Quote
Old 09-22-2019, 10:16 AM   #10
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is offline   Reply With Quote
Old 09-23-2019, 09:25 AM   #11
lomtickofbooks
Junior Member
lomtickofbooks began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2019
Device: iPad
Quote:
Originally Posted by DiapDealer View Post
If you're new to html, make sure to install the EpubCheck plugin.
Thanks. That looks more convenient than uploading my code to a validation site, I'll install that and check it out,

Quote:
Originally Posted by Turtle91 View Post
I would also recommend (works for me anyway) disabling "mend on save". [...]
Step 1 - save
[...]
Step 7 - Save again, just to be sure
Thanks for sharing you're "pipeline."

Quote:
Originally Posted by DiapDealer View Post
I can't, in good conscience, recommend neophytes disabling Mend on Open/Save.
I'll only run some tests. I'll likily leave "Mend" as designed for the most part!
lomtickofbooks is offline   Reply With Quote
Old 09-23-2019, 10:27 AM   #12
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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.
theducks is online now   Reply With Quote
Old 09-24-2019, 04:35 AM   #13
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Quote:
Originally Posted by lomtickofbooks View Post
Thanks. That looks more convenient than uploading my code to a validation site, I'll install that and check it out,
The validation site would very likely use epubcheck as its engine. But yes, having it as a plugin is convenient.

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.
exaltedwombat is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:30 PM.


MobileRead.com is a privately owned, operated and funded community.