MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Something in Sigil disturbs my tags (https://www.mobileread.com/forums/showthread.php?t=334112)

steve100 10-16-2020 06:26 PM

Something in Sigil disturbs my tags
 
I'm using Sigil 1.3.0 on Windows 7 64-bit.

I seem to be going around in circles with formatting my book.
My book is organized so that it has every chapter in it's own file.
I have a working CSS stylesheet.
I am working partially from NotJohn's guide.
I have gone through and re-edited issues in all the files countless times.

But something keeps messing with my html tags.

For instance, certain operations will change:
<p><h2 id="sigil_toc_id_1">ABOUT THIS BOOK</h2></p>

to invalidate my <p> tags:
<p></p>
<h2 id="sigil_toc_id_1">ABOUT THIS BOOK</h2>
<p></p>

But whatever is doing it, does this to all the p-tags in all the chapters when it happens.
So if I have <p class="first">here's some text</p>
It will get changed to <p class="first"></p>here's some text<p></p>

I have found a few things that change all my tags:
Generate Table of Contents
Open Files
Saving Files
changing the name of a chapter file in the Book Browser column

When this happens, I have to go through my book, line by line, and change back all my tags to the way I had them. Have I missed something obvious?

theducks 10-16-2020 06:48 PM

You can't nest a H2 inside a P

Your invalid code may have confused things when trying to clean the errors

steve100 10-16-2020 06:58 PM

OK, Thanks. I didn't know that. I wonder if I have that kind of error elsewhere? <stray thought>

hobnail 10-16-2020 08:55 PM

Quote:

Originally Posted by steve100 (Post 4047921)
OK, Thanks. I didn't know that. I wonder if I have that kind of error elsewhere? <stray thought>

No doubt you do. :p

This is the plugin that I use to verify my epubs. The title might be misleading; the plugin/wrapper may be considered simple but epubcheck is rigorous.

https://www.mobileread.com/forums/sh...d.php?t=248186

It may seem intimidating but it's not, but you'll first need to install Java before you can install that plugin. Installing Java these days is pretty brainless. Java SE 15 seems to be the latest and greatest.

DNSB 10-17-2020 01:05 AM

Probably more than you want to know but you can check the HTML spec at whatwg.org, specifically 3.2.5.2.5 Phrasing content which lists those elements that can be used inside <p>...</p>.

Interesting reading if taken with a large supply of your favourite source of caffeine.

exaltedwombat 10-18-2020 08:57 AM

What were the <p> tags around your <h2> ones intended to do? Extra spacing? You can get the same result by modifying the effect of 'h2' in your stylesheet.

hobnail 10-18-2020 01:22 PM

Quote:

Originally Posted by exaltedwombat (Post 4048490)
What were the <p> tags around your <h2> ones intended to do? Extra spacing? You can get the same result by modifying the effect of 'h2' in your stylesheet.

Sometimes having h tags grouped together can be helpful. In that case a div can be used around them. I use the <header> tag for that grouping but that doesn't fly with epub 2 which is one of the reasons I use epub 3. For the sake of consistency (one of the hobgoblins of my small mind) I use header tags around single h tags as well as multiple ones.

AlanHK 10-19-2020 09:57 AM

Quote:

Originally Posted by hobnail (Post 4048564)
I use the <header> tag for that grouping but that doesn't fly with epub 2 which is one of the reasons I use epub 3. For the sake of consistency (one of the hobgoblins of my small mind) I use header tags around single h tags as well as multiple ones.

If you run kindlegen on an epub3 with <header> tags, you get a warning for each.

Warning(inputpreprocessor):W29004: Forcefully closed opened Tag: <header>

Not a fatal error, and you get a usable file. But still annoying.
I don't know what would happen if you submitted such a file to Amazon to publish.

Since my small mind cannot see any need for these tags, I delete them on sight, the files are still good per epubcheck.

hobnail 10-19-2020 05:28 PM

Quote:

Originally Posted by AlanHK (Post 4048891)
Since my small mind cannot see any need for these tags, I delete them on sight, the files are still good per epubcheck.

Kill those pesky buggers!

Notjohn 10-20-2020 02:16 PM

Quote:

I use the <header> tag for that grouping but that doesn't fly with epub 2 which is one of the reasons I use epub 3
Interesting, thanks!

Quote:

I don't know what would happen if you submitted such a file to Amazon to publish.
Amazon/KDP doesn't use epubcheck, so if looks okay in the KDP online preview, I suspect it would sail through.

exaltedwombat 10-20-2020 05:44 PM

I'm still intrigued why you would WANT an extra tag round a h1? What does it do?

hobnail 10-20-2020 06:01 PM

Quote:

Originally Posted by exaltedwombat (Post 4049458)
I'm still intrigued why you would WANT an extra tag round a h1? What does it do?

I suppose it could depend upon what you consider header material. For example, some books have a quote after the chapter title, or a few lines of a poem. Those I put inside the header tag along with the h2. I use it so that I get consistent spacing after the stuff at the top of the page. If you want to go buck wild with semantic tags there are also article, main, section, and others. For example download an epub 3 book from standardebooks.org; Ivanhoe is a good example. (They now call them Advanced epub, they used to call them epub3.)

https://standardebooks.org/ebooks/walter-scott/ivanhoe

https://www.w3schools.com/tags/tag_header.asp

slowsmile 11-03-2020 04:17 AM

@steve999...Just run the Sigil plugin called CustomCleanerPlus. The plugin cleans up the code and will remove any dross or redundant code. It will also remove all instances of "<p></p>" from the epub html in one hit. You can download and install this Sigil plugin from here.

JSWolf 11-03-2020 07:49 AM

Quote:

Originally Posted by hobnail (Post 4049461)
I suppose it could depend upon what you consider header material. For example, some books have a quote after the chapter title, or a few lines of a poem. Those I put inside the header tag along with the h2. I use it so that I get consistent spacing after the stuff at the top of the page. If you want to go buck wild with semantic tags there are also article, main, section, and others. For example download an epub 3 book from standardebooks.org; Ivanhoe is a good example. (They now call them Advanced epub, they used to call them epub3.)

https://standardebooks.org/ebooks/walter-scott/ivanhoe

https://www.w3schools.com/tags/tag_header.asp

But in ePub 2, I've never had an inconsistent chapter header/sub-header/quote/etc. You just make sure the CSS is correct. You don't need <header>. Just make sure <h2> is set in CSS for the chapter header is correct in CSS and that whatever classes you need to style the text before the main text is correct. Again, no need for <header>. What does <header> actually do that you cannot do in CSS with <h2>?

I've edited ePub 3 back to ePub 2 and the things removed didn't make one difference once I fixed the CSS.

DiapDealer 11-03-2020 07:58 AM

Again, Jon. Your penchant for constantly poo-pooing all things EPUB3 at every turn is not welcome in the Sigil area. Stop it, or stay out. Those are your choices.


All times are GMT -4. The time now is 07:56 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.